PageSourceSearch

https://hjaelp.ai/assets/index-zN32pAnd.js

js hjaelp.ai collected 2026-10-05 14:35:23 UTC 3,399,966 bytes, 5,166 lines download raw bytes

vendor: 5,011 bytes, lines 1-9
1var g1e=Object.defineProperty;var Z9=t=>{throw TypeError(t)};var x1e=(t,e,n)=>e in t?g1e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var up=(t,e,n)=>x1e(t,typeof e!="symbol"?e+"":e,n),SO=(t,e,n)=>e.has(t)||Z9("Cannot "+n);var be=(t,e,n)=>(SO(t,e,"read from private field"),n?n.call(t):e.get(t)),Rt=(t,e,n)=>e.has(t)?Z9("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),ut=(t,e,n,r)=>(SO(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),yn=(t,e,n)=>(SO(t,e,"access private method"),n);var NN=(t,e,n,r)=>({set _(i){ut(t,e,i,n)},get _(){return be(t,e,r)}});function y1e(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in t)){const s=Object.getOwnPropertyDescriptor(r,i);s&&Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var Vf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function An(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Xte={exports:{}},KA={},Qte={exports:{}},Tn={};/**
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 gS=Symbol.for("react.element"),v1e=Symbol.for("react.portal"),b1e=Symbol.for("react.fragment"),w1e=Symbol.for("react.strict_mode"),_1e=Symbol.for("react.profiler"),S1e=Symbol.for("react.provider"),N1e=Symbol.for("react.context"),j1e=Symbol.for("react.forward_ref"),C1e=Symbol.for("react.suspense"),k1e=Symbol.for("react.memo"),E1e=Symbol.for("react.lazy"),eV=Symbol.iterator;function A1e(t){return t===null||typeof t!="object"?null:(t=eV&&t[eV]||t["@@iterator"],typeof t=="function"?t:null)}var Jte={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Zte=Object.assign,ene={};function y0(t,e,n){this.props=t,this.context=e,this.refs=ene,this.updater=n||Jte}y0.prototype.isReactComponent={};y0.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};y0.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function tne(){}tne.prototype=y0.prototype;function iU(t,e,n){this.props=t,this.context=e,this.refs=ene,this.updater=n||Jte}var sU=iU.prototype=new tne;sU.constructor=iU;Zte(sU,y0.prototype);sU.isPureReactComponent=!0;var tV=Array.isArray,nne=Object.prototype.hasOwnProperty,aU={current:null},rne={key:!0,ref:!0,__self:!0,__source:!0};function ine(t,e,n){var r,i={},s=null,a=null;if(e!=null)for(r in e.ref!==void 0&&(a=e.ref),e.key!==void 0&&(s=""+e.key),e)nne.call(e,r)&&!rne.hasOwnProperty(r)&&(i[r]=e[r]);var l=arguments.length-2;if(l===1)i.children=n;else if(1<l){for(var c=Array(l),u=0;u<l;u++)c[u]=arguments[u+2];i.children=c}if(t&&t.defaultProps)for(r in l=t.defaultProps,l)i[r]===void 0&&(i[r]=l[r]);return{$$typeof:gS,type:t,key:s,ref:a,props:i,_owner:aU.current}}function T1e(t,e){return{$$typeof:gS,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function oU(t){return typeof t=="object"&&t!==null&&t.$$typeof===gS}function M1e(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var nV=/\/+/g;function NO(t,e){return typeof t=="object"&&t!==null&&t.key!=null?M1e(""+t.key):e.toString(36)}function EC(t,e,n,r,i){var s=typeof t;(s==="undefined"||s==="boolean")&&(t=null);var a=!1;if(t===null)a=!0;else switch(s){case"string":case"number":a=!0;break;case"object":switch(t.$$typeof){case gS:case v1e:a=!0}}if(a)return a=t,i=i(a),t=r===""?"."+NO(a,0):r,tV(i)?(n="",t!=null&&(n=t.replace(nV,"$&/")+"/"),EC(i,e,n,"",function(u){return u})):i!=null&&(oU(i)&&(i=T1e(i,n+(!i.key||a&&a.key===i.key?"":(""+i.key).replace(nV,"$&/")+"/")+t)),e.push(i)),1;if(a=0,r=r===""?".":r+":",tV(t))for(var l=0;l<t.length;l++){s=t[l];var c=r+NO(s,l);a+=EC(s,e,n,c,i)}
vendor: 4,268 bytes, lines 9-17
9else if(c=A1e(t),typeof c=="function")for(t=c.call(t),l=0;!(s=t.next()).done;)s=s.value,c=r+NO(s,l++),a+=EC(s,e,n,c,i);else if(s==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return a}function jN(t,e,n){if(t==null)return t;var r=[],i=0;return EC(t,r,"","",function(s){return e.call(n,s,i++)}),r}function P1e(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(n){(t._status===0||t._status===-1)&&(t._status=1,t._result=n)},function(n){(t._status===0||t._status===-1)&&(t._status=2,t._result=n)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var wa={current:null},AC={transition:null},O1e={ReactCurrentDispatcher:wa,ReactCurrentBatchConfig:AC,ReactCurrentOwner:aU};function sne(){throw Error("act(...) is not supported in production builds of React.")}Tn.Children={map:jN,forEach:function(t,e,n){jN(t,function(){e.apply(this,arguments)},n)},count:function(t){var e=0;return jN(t,function(){e++}),e},toArray:function(t){return jN(t,function(e){return e})||[]},only:function(t){if(!oU(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};Tn.Component=y0;Tn.Fragment=b1e;Tn.Profiler=_1e;Tn.PureComponent=iU;Tn.StrictMode=w1e;Tn.Suspense=C1e;Tn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=O1e;Tn.act=sne;Tn.cloneElement=function(t,e,n){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var r=Zte({},t.props),i=t.key,s=t.ref,a=t._owner;if(e!=null){if(e.ref!==void 0&&(s=e.ref,a=aU.current),e.key!==void 0&&(i=""+e.key),t.type&&t.type.defaultProps)var l=t.type.defaultProps;for(c in e)nne.call(e,c)&&!rne.hasOwnProperty(c)&&(r[c]=e[c]===void 0&&l!==void 0?l[c]:e[c])}var c=arguments.length-2;if(c===1)r.children=n;else if(1<c){l=Array(c);for(var u=0;u<c;u++)l[u]=arguments[u+2];r.children=l}return{$$typeof:gS,type:t.type,key:i,ref:s,props:r,_owner:a}};Tn.createContext=function(t){return t={$$typeof:N1e,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:S1e,_context:t},t.Consumer=t};Tn.createElement=ine;Tn.createFactory=function(t){var e=ine.bind(null,t);return e.type=t,e};Tn.createRef=function(){return{current:null}};Tn.forwardRef=function(t){return{$$typeof:j1e,render:t}};Tn.isValidElement=oU;Tn.lazy=function(t){return{$$typeof:E1e,_payload:{_status:-1,_result:t},_init:P1e}};Tn.memo=function(t,e){return{$$typeof:k1e,type:t,compare:e===void 0?null:e}};Tn.startTransition=function(t){var e=AC.transition;AC.transition={};try{t()}finally{AC.transition=e}};Tn.unstable_act=sne;Tn.useCallback=function(t,e){return wa.current.useCallback(t,e)};Tn.useContext=function(t){return wa.current.useContext(t)};Tn.useDebugValue=function(){};Tn.useDeferredValue=function(t){return wa.current.useDeferredValue(t)};Tn.useEffect=function(t,e){return wa.current.useEffect(t,e)};Tn.useId=function(){return wa.current.useId()};Tn.useImperativeHandle=function(t,e,n){return wa.current.useImperativeHandle(t,e,n)};Tn.useInsertionEffect=function(t,e){return wa.current.useInsertionEffect(t,e)};Tn.useLayoutEffect=function(t,e){return wa.current.useLayoutEffect(t,e)};Tn.useMemo=function(t,e){return wa.current.useMemo(t,e)};Tn.useReducer=function(t,e,n){return wa.current.useReducer(t,e,n)};Tn.useRef=function(t){return wa.current.useRef(t)};Tn.useState=function(t){return wa.current.useState(t)};Tn.useSyncExternalStore=function(t,e,n){return wa.current.useSyncExternalStore(t,e,n)};Tn.useTransition=function(){return wa.current.useTransition()};Tn.version="18.3.1";Qte.exports=Tn;var b=Qte.exports;const te=An(b),YA=y1e({__proto__:null,default:te},[b]);/**
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 R1e=b,I1e=Symbol.for("react.element"),D1e=Symbol.for("react.fragment"),L1e=Object.prototype.hasOwnProperty,$1e=R1e.__SECRET_INT
vendor: 6,224 bytes, lines 17-33
17ERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,F1e={key:!0,ref:!0,__self:!0,__source:!0};function ane(t,e,n){var r,i={},s=null,a=null;n!==void 0&&(s=""+n),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(a=e.ref);for(r in e)L1e.call(e,r)&&!F1e.hasOwnProperty(r)&&(i[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)i[r]===void 0&&(i[r]=e[r]);return{$$typeof:I1e,type:t,key:s,ref:a,props:i,_owner:$1e.current}}KA.Fragment=D1e;KA.jsx=ane;KA.jsxs=ane;Xte.exports=KA;var o=Xte.exports,hD={},one={exports:{}},Io={},lne={exports:{}},cne={};/**
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(t){function e(T,D){var F=T.length;T.push(D);e:for(;0<F;){var q=F-1>>>1,B=T[q];if(0<i(B,D))T[q]=D,T[F]=B,F=q;else break e}}function n(T){return T.length===0?null:T[0]}function r(T){if(T.length===0)return null;var D=T[0],F=T.pop();if(F!==D){T[0]=F;e:for(var q=0,B=T.length,z=B>>>1;q<z;){var H=2*(q+1)-1,W=T[H],G=H+1,K=T[G];if(0>i(W,F))G<B&&0>i(K,W)?(T[q]=K,T[G]=F,q=G):(T[q]=W,T[H]=F,q=H);else if(G<B&&0>i(K,F))T[q]=K,T[G]=F,q=G;else break e}}return D}function i(T,D){var F=T.sortIndex-D.sortIndex;return F!==0?F:T.id-D.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var a=Date,l=a.now();t.unstable_now=function(){return a.now()-l}}var c=[],u=[],d=1,f=null,h=3,p=!1,m=!1,x=!1,y=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function v(T){for(var D=n(u);D!==null;){if(D.callback===null)r(u);else if(D.startTime<=T)r(u),D.sortIndex=D.expirationTime,e(c,D);else break;D=n(u)}}function N(T){if(x=!1,v(T),!m)if(n(c)!==null)m=!0,O(S);else{var D=n(u);D!==null&&L(N,D.startTime-T)}}function S(T,D){m=!1,x&&(x=!1,g(A),A=-1),p=!0;var F=h;try{for(v(D),f=n(c);f!==null&&(!(f.expirationTime>D)||T&&!M());){var q=f.callback;if(typeof q=="function"){f.callback=null,h=f.priorityLevel;var B=q(f.expirationTime<=D);D=t.unstable_now(),typeof B=="function"?f.callback=B:f===n(c)&&r(c),v(D)}else r(c);f=n(c)}if(f!==null)var z=!0;else{var H=n(u);H!==null&&L(N,H.startTime-D),z=!1}return z}finally{f=null,h=F,p=!1}}var _=!1,j=null,A=-1,C=5,k=-1;function M(){return!(t.unstable_now()-k<C)}function I(){if(j!==null){var T=t.unstable_now();k=T;var D=!0;try{D=j(!0,T)}finally{D?R():(_=!1,j=null)}}else _=!1}var R;if(typeof w=="function")R=function(){w(I)};else if(typeof MessageChannel<"u"){var E=new MessageChannel,P=E.port2;E.port1.onmessage=I,R=function(){P.postMessage(null)}}else R=function(){y(I,0)};function O(T){j=T,_||(_=!0,R())}function L(T,D){A=y(function(){T(t.unstable_now())},D)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(T){T.callback=null},t.unstable_continueExecution=function(){m||p||(m=!0,O(S))},t.unstable_forceFrameRate=function(T){0>T||125<T?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):C=0<T?Math.floor(1e3/T):5},t.unstable_getCurrentPriorityLevel=function(){return h},t.unstable_getFirstCallbackNode=function(){return n(c)},t.unstable_next=function(T){switch(h){case 1:case 2:case 3:var D=3;break;default:D=h}var F=h;h=D;try{return T()}finally{h=F}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(T,D){switch(T){case 1:case 2:case 3:case 4:case 5:break;default:T=3}var F=h;h=T;try{return D()}finally{h=F}},t.unstable_scheduleCallback=function(T,D,F){var q=t.unstable_now();switch(typeof F=="object"&&F!==null?(F=F.delay,F=typeof F=="number"&&0<F?q+F:q):F=q,T){case 1:var B=-1;break;case 2:B=250;break;case 5:B=1073741823;break;case 4:B=1e4;break;default:B=5e3}return B=F+B,T={id:d++,callback:D,priorityLevel:T,startTime:F,expirationTime:B,sortIndex:-1},F>q?(T.sortIndex=F,e(u,T),n(c)===null&&T===n(u)&&(x?(g(A),A=-1):x=!0,L(N,F-q))):(T.sortIndex=B,e(c,T),m||p||(m=!0,O(S))),T},t.unstable_shouldYield=M,t.unstable_wrapCallback=function(T){var D=h;return function(){var F=h;h=D;try{return T.apply(this,arguments)}finally{h=F}}}})(cne);lne.exports=cne;var U1e=lne.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 z1e=b,Eo=U1e;function Je(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var une=new Set,g1={};function yg(t,e){ev(t,e),ev(t+"Capture",e)}function ev(t,e){for(g1[t]=e,t=0;t<e.length;t++)une.add(e[t])}var xd=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),pD=Object.prototype.hasOwnProperty,B1e=/^[: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]*$/,rV={},iV={};function V1e(t){return pD.call(iV,t)?!0:pD.call(rV,t)?!1:B1e.test(t)?iV[t]=!0:(rV[t]=!0,!1)}function H1e(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function W1e(t,e,n,r){if(e===null||typeof e>"u"||H1e(t,e,n,r))return!0;
vendor: 4,289 bytes, line 33
33if(r)return!1;if(n!==null)switch(n.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 _a(t,e,n,r,i,s,a){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=a}var Ds={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Ds[t]=new _a(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Ds[e]=new _a(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Ds[t]=new _a(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Ds[t]=new _a(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){Ds[t]=new _a(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Ds[t]=new _a(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Ds[t]=new _a(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Ds[t]=new _a(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Ds[t]=new _a(t,5,!1,t.toLowerCase(),null,!1,!1)});var lU=/[\-:]([a-z])/g;function cU(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(lU,cU);Ds[e]=new _a(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(lU,cU);Ds[e]=new _a(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(lU,cU);Ds[e]=new _a(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Ds[t]=new _a(t,1,!1,t.toLowerCase(),null,!1,!1)});Ds.xlinkHref=new _a("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Ds[t]=new _a(t,1,!1,t.toLowerCase(),null,!0,!0)});function uU(t,e,n,r){var i=Ds.hasOwnProperty(e)?Ds[e]:null;(i!==null?i.type!==0:r||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(W1e(e,n,i,r)&&(n=null),r||i===null?V1e(e)&&(n===null?t.removeAttribute(e):t.setAttribute(e,""+n)):i.mustUseProperty?t[i.propertyName]=n===null?i.type===3?!1:"":n:(e=i.attributeName,r=i.attributeNamespace,n===null?t.removeAttribute(e):(i=i.type,n=i===3||i===4&&n===!0?"":""+n,r?t.setAttributeNS(r,e,n):t.setAttribute(e,n))))}var Ld=z1e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,CN=Symbol.for("react.element"),qx=Symbol.for("react.portal"),Kx=Symbol.for("react.fragment"),dU=Symbol.for("react.strict_mode"),mD=Symbol.for("react.profiler"),dne=Symbol.for("react.provider"),fne=Symbol.for("react.context"),f
vendor: 19,194 bytes, lines 33-37
33U=Symbol.for("react.forward_ref"),gD=Symbol.for("react.suspense"),xD=Symbol.for("react.suspense_list"),hU=Symbol.for("react.memo"),xf=Symbol.for("react.lazy"),hne=Symbol.for("react.offscreen"),sV=Symbol.iterator;function rb(t){return t===null||typeof t!="object"?null:(t=sV&&t[sV]||t["@@iterator"],typeof t=="function"?t:null)}var ii=Object.assign,jO;function sw(t){if(jO===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);jO=e&&e[1]||""}return`
34`+jO+t}var CO=!1;function kO(t,e){if(!t||CO)return"";CO=!0;var n=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(t,[],e)}else{try{e.call()}catch(u){r=u}t.call(e.prototype)}else{try{throw Error()}catch(u){r=u}t()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var i=u.stack.split(`
35`),s=r.stack.split(`
36`),a=i.length-1,l=s.length-1;1<=a&&0<=l&&i[a]!==s[l];)l--;for(;1<=a&&0<=l;a--,l--)if(i[a]!==s[l]){if(a!==1||l!==1)do if(a--,l--,0>l||i[a]!==s[l]){var c=`
37`+i[a].replace(" at new "," at ");return t.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",t.displayName)),c}while(1<=a&&0<=l);break}}}finally{CO=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?sw(t):""}function G1e(t){switch(t.tag){case 5:return sw(t.type);case 16:return sw("Lazy");case 13:return sw("Suspense");case 19:return sw("SuspenseList");case 0:case 2:case 15:return t=kO(t.type,!1),t;case 11:return t=kO(t.type.render,!1),t;case 1:return t=kO(t.type,!0),t;default:return""}}function yD(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Kx:return"Fragment";case qx:return"Portal";case mD:return"Profiler";case dU:return"StrictMode";case gD:return"Suspense";case xD:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case fne:return(t.displayName||"Context")+".Consumer";case dne:return(t._context.displayName||"Context")+".Provider";case fU:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case hU:return e=t.displayName||null,e!==null?e:yD(t.type)||"Memo";case xf:e=t._payload,t=t._init;try{return yD(t(e))}catch{}}return null}function q1e(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return yD(e);case 8:return e===dU?"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 Ch(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function pne(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function K1e(t){var e=pne(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,s=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(a){r=""+a,s.call(this,a)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function kN(t){t._valueTracker||(t._valueTracker=K1e(t))}function mne(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=pne(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function bk(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function vD(t,e){var n=e.checked;return ii({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function aV(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=Ch(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function gne(t,e){e=e.checked,e!=null&&uU(t,"checked",e,!1)}function bD(t,e){gne(t,e);var n=Ch(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?wD(t,e.type,n):e.hasOwnProperty("defaultValue")&&wD(t,e.type,Ch(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function oV(t,e,n){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=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function wD(t,e,n){(e!=="number"||bk(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var aw=Array.isArray;function xy(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i<n.length;i++)e["$"+n[i]]=!0;for(n=0;n<t.length;n++)i=e.hasOwnProperty("$"+t[n].value),t[n].selected!==i&&(t[n].selected=i),i&&r&&(t[n].defaultSelected=!0)}else{for(n=""+Ch(n),e=null,i=0;i<t.length;i++){if(t[i].value===n){t[i].selected=!0,r&&(t[i].defaultSelected=!0);return}e!==null||t[i].disabled||(e=t[i])}e!==null&&(e.selected=!0)}}function _D(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(Je(91));return ii({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function lV(t,e){var n=e.value;if(n==null){if(n=e.children,e=e.defaultValue,n!=null){if(e!=null)throw Error(Je(92));if(aw(n)){if(1<n.length)throw Error(Je(93));n=n[0]}e=n}e==null&&(e=""),n=e}t._wrapperState={initialValue:Ch(n)}}function xne(t,e){var n=Ch(e.value),r=Ch(e.defaultValue);n!=null&&(n=""+n,n!==t.value&&(t.value=n),e.defaultValue==null&&t.defaultValue!==n&&(t.defaultValue=n)),r!=null&&(t.defaultValue=""+r)}function cV(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function yne(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function SD(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?yne(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var EN,vne=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,n,r,i){MSApp.execUnsafeLocalFunction(function(){return t(e,n,r,i)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(EN=EN||document.createElement("div"),EN.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=EN.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function x1(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var kw={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},Y1e=["Webkit","ms","Moz","O"];Object.keys(kw).forEach(function(t){Y1e.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),kw[e]=kw[t]})});function bne(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||kw.hasOwnProperty(t)&&kw[t]?(""+e).trim():e+"px"}function wne(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=bne(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var X1e=ii({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 ND(t,e){if(e){if(X1e[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Je(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Je(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Je(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Je(62))}}function jD(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var CD=null;function pU(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var kD=null,yy=null,vy=null;function uV(t){if(t=vS(t)){if(typeof kD!="function")throw Error(Je(280));var e=t.stateNode;e&&(e=eT(e),kD(t.stateNode,t.type,e))}}function _ne(t){yy?vy?vy.push(t):vy=[t]:yy=t}function Sne(){if(yy){var t=yy,e=vy;if(vy=yy=null,uV(t),e)for(t=0;t<e.length;t++)uV(e[t])}}function Nne(t,e){return t(e)}function jne(){}var EO=!1;function Cne(t,e,n){if(EO)return t(e,n);EO=!0;try{return Nne(t,e,n)}finally{EO=!1,(yy!==null||vy!==null)&&(jne(),Sne())}}function y1(t,e){var n=t.stateNode;if(n===null)return null;var r=eT(n);if(r===null)return null;n=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)||(t=t.type,r=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!r;break e;default:t=!1}if(t)return null;if(n&&typeof n!="function")throw Error(Je(231,e,typeof n));return n}var ED=!1;if(xd)try{var ib={};Object.defineProperty(ib,"passive",{get:function(){ED=!0}}),window.addEventListener("test",ib,ib),window.removeEventListener("test",ib,ib)}catch{ED=!1}function Q1e(t,e,n,r,i,s,a,l,c){var u=Array.prototype.slice.call(arguments,3);try{e.apply(n,u)}catch(d){this.onError(d)}}var Ew=!1,wk=null,_k=!1,AD=null,J1e={onError:function(t){Ew=!0,wk=t}};function Z1e(t,e,n,r,i,s,a,l,c){Ew=!1,wk=null,Q1e.apply(J1e,arguments)}function e_e(t,e,n,r,i,s,a,l,c){if(Z1e.apply(this,arguments),Ew){if(Ew){var u=wk;Ew=!1,wk=null}else throw Error(Je(198));_k||(_k=!0,AD=u)}}function vg(t){var e=t,n=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(n=e.return),t=e.return;while(t)}return e.tag===3?n:null}function kne(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function dV(t){if(vg(t)!==t)throw Error(Je(188))}function t_e(t){var e=t.alternate;if(!e){if(e=vg(t),e===null)throw Error(Je(188));return e!==t?null:t}for(var n=t,r=e;;){var i=n.return;if(i===null)break;var s=i.alternate;if(s===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===n)return dV(i),t;if(s===r)return dV(i),e;s=s.sibling}throw Error(Je(188))}if(n.return!==r.return)n=i,r=s;else{for(var a=!1,l=i.child;l;){if(l===n){a=!0,n=i,r=s;break}if(l===r){a=!0,r=i,n=s;break}l=l.sibling}if(!a){for(l=s.child;l;){if(l===n){a=!0,n=s,r=i;break}if(l===r){a=!0,r=s,n=i;break}l=l.sibling}if(!a)throw Error(Je(189))}}if(n.alternate!==r)throw Error(Je(190))}if(n.tag!==3)throw Error(Je(188));return n.stateNode.current===n?t:e}function Ene(t){return t=t_e(t),t!==null?Ane(t):null}function Ane(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=Ane(t);if(e!==null)return e;t=t.sibling}return null}var Tne=Eo.unstable_scheduleCallback,fV=Eo.unstable_cancelCallback,n_e=Eo.unstable_shouldYield,r_e=Eo.unstable_requestPaint,mi=Eo.unstable_now,i_e=Eo.unstable_getCurrentPriorityLevel,mU=Eo.unstable_ImmediatePriority,Mne=Eo.unstable_UserBlockingPriority,Sk=Eo.unstable_NormalPriority,s_e=Eo.unstable_LowPriority,Pne=Eo.unstable_IdlePriority,XA=null,Wc=null;function a_e(t){if(Wc&&typeof Wc.onCommitFiberRoot=="function")try{Wc.onCommitFiberRoot(XA,t,void 0,(t.current.flags&128)===128)}catch{}}var sc=Math.clz32?Math.clz32:c_e,o_e=Math.log,l_e=Math.LN2;function c_e(t){return t>>>=0,t===0?32:31-(o_e(t)/l_e|0)|0}var AN=64,TN=4194304;function ow(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Nk(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,i=t.suspendedLanes,s=t.pingedLanes,a=n&268435455;if(a!==0){var l=a&~i;l!==0?r=ow(l):(s&=a,s!==0&&(r=ow(s)))}else a=n&~i,a!==0?r=ow(a):s!==0&&(r=ow(s));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,s=e&-e,i>=s||i===16&&(s&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0<e;)n=31-sc(e),i=1<<n,r|=t[n],e&=~i;return r}function u_e(t,e){switch(t){case 1:case 2:case 4:return e+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function d_e(t,e){for(var n=t.suspendedLanes,r=t.pingedLanes,i=t.expirationTimes,s=t.pendingLanes;0<s;){var a=31-sc(s),l=1<<a,c=i[a];c===-1?(!(l&n)||l&r)&&(i[a]=u_e(l,e)):c<=e&&(t.expiredLanes|=l),s&=~l}}function TD(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function One(){var t=AN;return AN<<=1,!(AN&4194240)&&(AN=64),t}function AO(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function xS(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-sc(e),t[e]=n}function f_e(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0<n;){var i=31-sc(n),s=1<<i;e[i]=0,r[i]=-1,t[i]=-1,n&=~s}}function gU(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var r=31-sc(n),i=1<<r;i&e|t[r]&e&&(t[r]|=e),n&=~i}}var rr=0;function Rne(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var Ine,xU,Dne,Lne,$ne,MD=!1,MN=[],nh=null,rh=null,ih=null,v1=new Map,b1=new Map,jf=[],h_e="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 hV(t,e){switch(t){case"focusin":case"focusout":nh=null;break;case"dragenter":case"dragleave":rh=null;break;case"mouseover":case"mouseout":ih=null;break;case"pointerover":case"pointerout":v1.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":b1.delete(e.pointerId)}}function sb(t,e,n,r,i,s){return t===null||t.nativeEvent!==s?(t={blockedOn:e,domEventName:n,eventSystemFlags:r,nativeEvent:s,targetContainers:[i]},e!==null&&(e=vS(e),e!==null&&xU(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,i!==null&&e.indexOf(i)===-1&&e.push(i),t)}function p_e(t,e,n,r,i){switch(e){case"focusin":return nh=sb(nh,t,e,n,r,i),!0;case"dragenter":return rh=sb(rh,t,e,n,r,i),!0;case"mouseover":return ih=sb(ih,t,e,n,r,i),!0;case"pointerover":var s=i.pointerId;return v1.set(s,sb(v1.get(s)||null,t,e,n,r,i)),!0;case"gotpointercapture":return s=i.pointerId,b1.set(s,sb(b1.get(s)||null,t,e,n,r,i)),!0}return!1}function Fne(t){var e=Wp(t.target);if(e!==null){var n=vg(e);if(n!==null){if(e=n.tag,e===13){if(e=kne(n),e!==null){t.blockedOn=e,$ne(t.priority,function(){Dne(n)});return}}else if(e===3&&n.stateNode.current.memoizedState.isDehydrated){t.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}t.blockedOn=null}function TC(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=PD(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n===null){n=t.nativeEvent;var r=new n.constructor(n.type,n);CD=r,n.target.dispatchEvent(r),CD=null}else return e=vS(n),e!==null&&xU(e),t.blockedOn=n,!1;e.shift()}return!0}function pV(t,e,n){TC(t)&&n.delete(e)}function m_e(){MD=!1,nh!==null&&TC(nh)&&(nh=null),rh!==null&&TC(rh)&&(rh=null),ih!==null&&TC(ih)&&(ih=null),v1.forEach(pV),b1.forEach(pV)}function ab(t,e){t.blockedOn===e&&(t.blockedOn=null,MD||(MD=!0,Eo.unstable_scheduleCallback(Eo.unstable_NormalPriority,m_e)))}function w1(t){function e(i){return ab(i,t)}if(0<MN.length){ab(MN[0],t);for(var n=1;n<MN.length;n++){var r=MN[n];r.blockedOn===t&&(r.blockedOn=null)}}for(nh!==null&&ab(nh,t),rh!==null&&ab(rh,t),ih!==null&&ab(ih,t),v1.forEach(e),b1.forEach(e),n=0;n<jf.length;n++)r=jf[n],r.blockedOn===t&&(r.blockedOn=null);for(;0<jf.length&&(n=jf[0],n.blockedOn===null);)Fne(n),n.blockedOn===null&&jf.shift()}var by=Ld.ReactCurrentBatchConfig,jk=!0;function g_e(t,e,n,r){var i=rr,s=by.transition;by.transition=null;try{rr=1,yU(t,e,n,r)}finally{rr=i,by.transition=s}}function x_e(t,e,n,r){var i=rr,s=by.transition;by.transition=null;try{rr=4,yU(t,e,n,r)}finally{rr=i,by.transition=s}}function yU(t,e,n,r){if(jk){var i=PD(t,e,n,r);if(i===null)FO(t,e,r,Ck,n),hV(t,r);else if(p_e(i,t,e,n,r))r.stopPropagation();else if(hV(t,r),e&4&&-1<h_e.indexOf(t)){for(;i!==null;){var s=vS(i);if(s!==null&&Ine(s),s=PD(t,e,n,r),s===null&&FO(t,e,r,Ck,n),s===i)break;i=s}i!==null&&r.stopPropagation()}else FO(t,e,r,null,n)}}var Ck=null;function PD(t,e,n,r){if(Ck=null,t=pU(r),t=Wp(t),t!==null)if(e=vg(t),e===null)t=null;else if(n=e.tag,n===13){if(t=kne(e),t!==null)return t;t=null}else if(n===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return Ck=t,null}
vendor: 10,484 bytes, line 37
37function Une(t){switch(t){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(i_e()){case mU:return 1;case Mne:return 4;case Sk:case s_e:return 16;case Pne:return 536870912;default:return 16}default:return 16}}var Hf=null,vU=null,MC=null;function zne(){if(MC)return MC;var t,e=vU,n=e.length,r,i="value"in Hf?Hf.value:Hf.textContent,s=i.length;for(t=0;t<n&&e[t]===i[t];t++);var a=n-t;for(r=1;r<=a&&e[n-r]===i[s-r];r++);return MC=i.slice(t,1<r?1-r:void 0)}function PC(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function PN(){return!0}function mV(){return!1}function Do(t){function e(n,r,i,s,a){this._reactName=n,this._targetInst=i,this.type=r,this.nativeEvent=s,this.target=a,this.currentTarget=null;for(var l in t)t.hasOwnProperty(l)&&(n=t[l],this[l]=n?n(s):s[l]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?PN:mV,this.isPropagationStopped=mV,this}return ii(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=PN)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=PN)},persist:function(){},isPersistent:PN}),e}var v0={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},bU=Do(v0),yS=ii({},v0,{view:0,detail:0}),y_e=Do(yS),TO,MO,ob,QA=ii({},yS,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:wU,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==ob&&(ob&&t.type==="mousemove"?(TO=t.screenX-ob.screenX,MO=t.screenY-ob.screenY):MO=TO=0,ob=t),TO)},movementY:function(t){return"movementY"in t?t.movementY:MO}}),gV=Do(QA),v_e=ii({},QA,{dataTransfer:0}),b_e=Do(v_e),w_e=ii({},yS,{relatedTarget:0}),PO=Do(w_e),__e=ii({},v0,{animationName:0,elapsedTime:0,pseudoElement:0}),S_e=Do(__e),N_e=ii({},v0,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),j_e=Do(N_e),C_e=ii({},v0,{data:0}),xV=Do(C_e),k_e={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},E_e={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"},A_e={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function T_e(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=A_e[t])?!!e[t]:!1}function wU(){return T_e}var M_e=ii({},yS,{key:function(t){if(t.key){var e=k_e[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=PC(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?E_e[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:wU,charCode:function(t){return t.type==="keypress"?PC(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?PC(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),P_e=Do(M_e),O_e=ii({},QA,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),yV=Do(O_e),R_e=ii({},yS,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:wU}),I_e=Do(R_e),D_e=ii({},v0,{propertyName:0,elapsedTime:0,pseudoElement:0}),L_e=Do(D_e),$_e=ii({},QA,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),F_e=Do($_e),U_e=[9,13,27,32],_U=xd&&"CompositionEvent"in window,Aw=null;xd&&"documentMode"in document&&(Aw=document.documentMode);var z_e=xd&&"TextEvent"in window&&!Aw,Bne=xd&&(!_U||Aw&&8<Aw&&11>=Aw),vV=" ",bV=!1;function Vne(t,e){switch(t){case"keyup":return U_e.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Hne(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Yx=!1;function B_e(t,e){switch(t){case"compositionend":return Hne(e);case"keypress":return e.which!==32?null:(bV=!0,vV);case"textInput":return t=e.data,t===vV&&bV?null:t;default:return null}}function V_e(t,e){if(Yx)return t==="compositionend"||!_U&&Vne(t,e)?(t=zne(),MC=vU=Hf=null,Yx=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return Bne&&e.locale!=="ko"?null:e.data;default:return null}}var H_e={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 wV(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!H_e[t.type]:e==="textarea"}function Wne(t,e,n,r){_ne(r),e=kk(e,"onChange"),0<e.length&&(n=new bU("onChange","change",null,n,r),t.push({event:n,listeners:e}))}var Tw=null,_1=null;function W_e(t){nre(t,0)}function JA(t){var e=Jx(t);if(mne(e))return t}function G_e(t,e){if(t==="change")return e}var Gne=!1;if(xd){var OO;if(xd){var RO="oninput"in document;if(!RO){var _V=document.createElement("div");_V.setAttribute("oninput","return;"),RO=typeof _V.oninput=="function"}OO=RO}else OO=!1;Gne=OO&&(!document.documentMode||9<document.documentMode)}function SV(){Tw&&(Tw.detachEvent("onpropertychange",qne),_1=Tw=null)}function qne(t){if(t.propertyName==="value"&&JA(_1)){var e=[];Wne(e,_1,t,pU(t)),Cne(W_e,e)}}function q_e(t,e,n){t==="focusin"?(SV(),Tw=e,_1=n,Tw.attachEvent("onpropertychange",qne)):t==="focusout"&&SV()}function K_e(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return JA(_1)}function Y_e(t,e){if(t==="click")return JA(e)}function X_e(t,e){if(t==="input"||t==="change")return JA(e)}function Q_e(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var cc=typeof Object.is=="function"?Object.is:Q_e;function S1(t,e){if(cc(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!pD.call(e,i)||!cc(t[i],e[i]))return!1}return!0}function NV(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function jV(t,e){var n=NV(t);t=0;for(var r;n;){if(n.nodeType===3){if(r=t+n.textContent.length,t<=e&&r>=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=NV(n)}}function Kne(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?Kne(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Yne(){for(var t=window,e=bk();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=bk(t.document)}return e}function SU(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function J_e(t){var e=Yne(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&Kne(n.ownerDocument.documentElement,n)){if(r!==null&&SU(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=n.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!t.extend&&s>r&&(i=r,r=s,s=i),i=jV(n,s);var a=jV(n,r);i&&a&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==a.node||t.focusOffset!==a.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),s>r?(t.addRange(e),t.extend(a.node,a.offset)):(e.setEnd(a.node,a.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<e.length;n++)t=e[n],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var Z_e=xd&&"documentMode"in document&&11>=document.documentMode,Xx=null,OD=null,Mw=null,RD=!1;function CV(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;RD||Xx==null||Xx!==bk(r)||(r=Xx,"selectionStart"in r&&SU(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,529 bytes, line 37
37sNode:r.focusNode,focusOffset:r.focusOffset}),Mw&&S1(Mw,r)||(Mw=r,r=kk(OD,"onSelect"),0<r.length&&(e=new bU("onSelect","select",null,e,n),t.push({event:e,listeners:r}),e.target=Xx)))}function ON(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var Qx={animationend:ON("Animation","AnimationEnd"),animationiteration:ON("Animation","AnimationIteration"),animationstart:ON("Animation","AnimationStart"),transitionend:ON("Transition","TransitionEnd")},IO={},Xne={};xd&&(Xne=document.createElement("div").style,"AnimationEvent"in window||(delete Qx.animationend.animation,delete Qx.animationiteration.animation,delete Qx.animationstart.animation),"TransitionEvent"in window||delete Qx.transitionend.transition);function ZA(t){if(IO[t])return IO[t];if(!Qx[t])return t;var e=Qx[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in Xne)return IO[t]=e[n];return t}var Qne=ZA("animationend"),Jne=ZA("animationiteration"),Zne=ZA("animationstart"),ere=ZA("transitionend"),tre=new Map,kV="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 Hh(t,e){tre.set(t,e),yg(e,[t])}for(var DO=0;DO<kV.length;DO++){var LO=kV[DO],eSe=LO.toLowerCase(),tSe=LO[0].toUpperCase()+LO.slice(1);Hh(eSe,"on"+tSe)}Hh(Qne,"onAnimationEnd");Hh(Jne,"onAnimationIteration");Hh(Zne,"onAnimationStart");Hh("dblclick","onDoubleClick");Hh("focusin","onFocus");Hh("focusout","onBlur");Hh(ere,"onTransitionEnd");ev("onMouseEnter",["mouseout","mouseover"]);ev("onMouseLeave",["mouseout","mouseover"]);ev("onPointerEnter",["pointerout","pointerover"]);ev("onPointerLeave",["pointerout","pointerover"]);yg("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));yg("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));yg("onBeforeInput",["compositionend","keypress","textInput","paste"]);yg("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));yg("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));yg("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var lw="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(" "),nSe=new Set("cancel close invalid load scroll toggle".split(" ").concat(lw));function EV(t,e,n){var r=t.type||"unknown-event";t.currentTarget=n,e_e(r,e,void 0,t),t.currentTarget=null}function nre(t,e){e=(e&4)!==0;for(var n=0;n<t.length;n++){var r=t[n],i=r.event;r=r.listeners;e:{var s=void 0;if(e)for(var a=r.length-1;0<=a;a--){var l=r[a],c=l.instance,u=l.currentTarget;if(l=l.listener,c!==s&&i.isPropagationStopped())break e;EV(i,l,u),s=c}else for(a=0;a<r.length;a++){if(l=r[a],c=l.instance,u=l.currentTarget,l=l.listener,c!==s&&i.isPropagationStopped())break e;EV(i,l,u),s=c}}}if(_k)throw t=AD,_k=!1,AD=null,t}function $r(t,e){var n=e[FD];n===void 0&&(n=e[FD]=new Set);var r=t+"__bubble";n.has(r)||(rre(e,t,2,!1),n.add(r))}function $O(t,e,n){var r=0;e&&(r|=4),rre(n,t,r,e)}var RN="_reactListening"+Math.random().toString(36).slice(2);function N1(t){if(!t[RN]){t[RN]=!0,une.forEach(function(n){n!=="selectionchange"&&(nSe.has(n)||$O(n,!1,t),$O(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[RN]||(e[RN]=!0,$O("selectionchange",!1,e))}}function rre(t,e,n,r){switch(Une(e)){case 1:var i=g_e;break;case 4:i=x_e;break;default:i=yU}n=i.bind(null,e,n,t),i=void 0,!ED||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(i=!0),r?i!==void 0?t.addEventListener(e,n,{capture:!0,passive:i}):t.addEventListener(e,n,!0):i!==void 0?t.addEventListener(e,n,{passive:i}):t.addEventListener(e,n,!1)}function FO(t,e,n,r,i){var s=r;if(!(e&1)&&!(e&2)&&r!==null)e:for(;;){if(r===null)return;var a=r.tag;if(a===3||a===4){var l=r.stateNode.containerInfo;
vendor: 5,353 bytes, lines 37-38
37if(l===i||l.nodeType===8&&l.parentNode===i)break;if(a===4)for(a=r.return;a!==null;){var c=a.tag;if((c===3||c===4)&&(c=a.stateNode.containerInfo,c===i||c.nodeType===8&&c.parentNode===i))return;a=a.return}for(;l!==null;){if(a=Wp(l),a===null)return;if(c=a.tag,c===5||c===6){r=s=a;continue e}l=l.parentNode}}r=r.return}Cne(function(){var u=s,d=pU(n),f=[];e:{var h=tre.get(t);if(h!==void 0){var p=bU,m=t;switch(t){case"keypress":if(PC(n)===0)break e;case"keydown":case"keyup":p=P_e;break;case"focusin":m="focus",p=PO;break;case"focusout":m="blur",p=PO;break;case"beforeblur":case"afterblur":p=PO;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=gV;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=b_e;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=I_e;break;case Qne:case Jne:case Zne:p=S_e;break;case ere:p=L_e;break;case"scroll":p=y_e;break;case"wheel":p=F_e;break;case"copy":case"cut":case"paste":p=j_e;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=yV}var x=(e&4)!==0,y=!x&&t==="scroll",g=x?h!==null?h+"Capture":null:h;x=[];for(var w=u,v;w!==null;){v=w;var N=v.stateNode;if(v.tag===5&&N!==null&&(v=N,g!==null&&(N=y1(w,g),N!=null&&x.push(j1(w,N,v)))),y)break;w=w.return}0<x.length&&(h=new p(h,m,null,n,d),f.push({event:h,listeners:x}))}}if(!(e&7)){e:{if(h=t==="mouseover"||t==="pointerover",p=t==="mouseout"||t==="pointerout",h&&n!==CD&&(m=n.relatedTarget||n.fromElement)&&(Wp(m)||m[yd]))break e;if((p||h)&&(h=d.window===d?d:(h=d.ownerDocument)?h.defaultView||h.parentWindow:window,p?(m=n.relatedTarget||n.toElement,p=u,m=m?Wp(m):null,m!==null&&(y=vg(m),m!==y||m.tag!==5&&m.tag!==6)&&(m=null)):(p=null,m=u),p!==m)){if(x=gV,N="onMouseLeave",g="onMouseEnter",w="mouse",(t==="pointerout"||t==="pointerover")&&(x=yV,N="onPointerLeave",g="onPointerEnter",w="pointer"),y=p==null?h:Jx(p),v=m==null?h:Jx(m),h=new x(N,w+"leave",p,n,d),h.target=y,h.relatedTarget=v,N=null,Wp(d)===u&&(x=new x(g,w+"enter",m,n,d),x.target=v,x.relatedTarget=y,N=x),y=N,p&&m)t:{for(x=p,g=m,w=0,v=x;v;v=Gg(v))w++;for(v=0,N=g;N;N=Gg(N))v++;for(;0<w-v;)x=Gg(x),w--;for(;0<v-w;)g=Gg(g),v--;for(;w--;){if(x===g||g!==null&&x===g.alternate)break t;x=Gg(x),g=Gg(g)}x=null}else x=null;p!==null&&AV(f,h,p,x,!1),m!==null&&y!==null&&AV(f,y,m,x,!0)}}e:{if(h=u?Jx(u):window,p=h.nodeName&&h.nodeName.toLowerCase(),p==="select"||p==="input"&&h.type==="file")var S=G_e;else if(wV(h))if(Gne)S=X_e;else{S=K_e;var _=q_e}else(p=h.nodeName)&&p.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(S=Y_e);if(S&&(S=S(t,u))){Wne(f,S,n,d);break e}_&&_(t,h,u),t==="focusout"&&(_=h._wrapperState)&&_.controlled&&h.type==="number"&&wD(h,"number",h.value)}switch(_=u?Jx(u):window,t){case"focusin":(wV(_)||_.contentEditable==="true")&&(Xx=_,OD=u,Mw=null);break;case"focusout":Mw=OD=Xx=null;break;case"mousedown":RD=!0;break;case"contextmenu":case"mouseup":case"dragend":RD=!1,CV(f,n,d);break;case"selectionchange":if(Z_e)break;case"keydown":case"keyup":CV(f,n,d)}var j;if(_U)e:{switch(t){case"compositionstart":var A="onCompositionStart";break e;case"compositionend":A="onCompositionEnd";break e;case"compositionupdate":A="onCompositionUpdate";break e}A=void 0}else Yx?Vne(t,n)&&(A="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(A="onCompositionStart");A&&(Bne&&n.locale!=="ko"&&(Yx||A!=="onCompositionStart"?A==="onCompositionEnd"&&Yx&&(j=zne()):(Hf=d,vU="value"in Hf?Hf.value:Hf.textContent,Yx=!0)),_=kk(u,A),0<_.length&&(A=new xV(A,t,null,n,d),f.push({event:A,listeners:_}),j?A.data=j:(j=Hne(n),j!==null&&(A.data=j)))),(j=z_e?B_e(t,n):V_e(t,n))&&(u=kk(u,"onBeforeInput"),0<u.length&&(d=new xV("onBeforeInput","beforeinput",null,n,d),f.push({event:d,listeners:u}),d.data=j))}nre(f,e)})}function j1(t,e,n){return{instance:t,listener:e,currentTarget:n}}function kk(t,e){for(var n=e+"Capture",r=[];t!==null;){var i=t,s=i.stateNode;i.tag===5&&s!==null&&(i=s,s=y1(t,n),s!=null&&r.unshift(j1(t,s,i)),s=y1(t,e),s!=null&&r.push(j1(t,s,i))),t=t.return}return r}function Gg(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function AV(t,e,n,r,i){for(var s=e._reactName,a=[];n!==null&&n!==r;){var l=n,c=l.alternate,u=l.stateNode;if(c!==null&&c===r)break;l.tag===5&&u!==null&&(l=u,i?(c=y1(n,s),c!=null&&a.unshift(j1(n,c,l))):i||(c=y1(n,s),c!=null&&a.push(j1(n,c,l)))),n=n.return}a.length!==0&&t.push({event:e,listeners:a})}var rSe=/\r\n?/g,iSe=/\u0000|\uFFFD/g;function TV(t){return(typeof t=="string"?t:""+t).replace(rSe,`
38`).replace(iSe,"")}function IN(t,e,n){if(e=TV(e),TV(t)!==e&&n)throw Error(Je(425))}function Ek(){}var ID=null,DD=null;function LD(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var $D=typeof setTimeout=="function"?setTimeout:void 0,sSe=typeof clearTimeout=="function"?clearTimeout:void 0,MV=typeof Promise=="function"?Promise:void 0,aSe=typeof queueMicrotask=="function"?queueMicrotask:typeof MV<"u"?function(t){return MV.resolve(null).then(t).cat
vendor: 4,849 bytes, line 38
38ch(oSe)}:$D;function oSe(t){setTimeout(function(){throw t})}function UO(t,e){var n=e,r=0;do{var i=n.nextSibling;if(t.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(r===0){t.removeChild(i),w1(e);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);w1(e)}function sh(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function PV(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="$"||n==="$!"||n==="$?"){if(e===0)return t;e--}else n==="/$"&&e++}t=t.previousSibling}return null}var b0=Math.random().toString(36).slice(2),$c="__reactFiber$"+b0,C1="__reactProps$"+b0,yd="__reactContainer$"+b0,FD="__reactEvents$"+b0,lSe="__reactListeners$"+b0,cSe="__reactHandles$"+b0;function Wp(t){var e=t[$c];if(e)return e;for(var n=t.parentNode;n;){if(e=n[yd]||n[$c]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=PV(t);t!==null;){if(n=t[$c])return n;t=PV(t)}return e}t=n,n=t.parentNode}return null}function vS(t){return t=t[$c]||t[yd],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function Jx(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(Je(33))}function eT(t){return t[C1]||null}var UD=[],Zx=-1;function Wh(t){return{current:t}}function Hr(t){0>Zx||(t.current=UD[Zx],UD[Zx]=null,Zx--)}function Mr(t,e){Zx++,UD[Zx]=t.current,t.current=e}var kh={},Qs=Wh(kh),Ua=Wh(!1),Om=kh;function tv(t,e){var n=t.type.contextTypes;if(!n)return kh;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=e[s];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function za(t){return t=t.childContextTypes,t!=null}function Ak(){Hr(Ua),Hr(Qs)}function OV(t,e,n){if(Qs.current!==kh)throw Error(Je(168));Mr(Qs,e),Mr(Ua,n)}function ire(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(Je(108,q1e(t)||"Unknown",i));return ii({},n,r)}function Tk(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||kh,Om=Qs.current,Mr(Qs,t),Mr(Ua,Ua.current),!0}function RV(t,e,n){var r=t.stateNode;if(!r)throw Error(Je(169));n?(t=ire(t,e,Om),r.__reactInternalMemoizedMergedChildContext=t,Hr(Ua),Hr(Qs),Mr(Qs,t)):Hr(Ua),Mr(Ua,n)}var Hu=null,tT=!1,zO=!1;function sre(t){Hu===null?Hu=[t]:Hu.push(t)}function uSe(t){tT=!0,sre(t)}function Gh(){if(!zO&&Hu!==null){zO=!0;var t=0,e=rr;try{var n=Hu;for(rr=1;t<n.length;t++){var r=n[t];do r=r(!0);while(r!==null)}Hu=null,tT=!1}catch(i){throw Hu!==null&&(Hu=Hu.slice(t+1)),Tne(mU,Gh),i}finally{rr=e,zO=!1}}return null}var ey=[],ty=0,Mk=null,Pk=0,Xo=[],Qo=0,Rm=null,Xu=1,Qu="";function Ep(t,e){ey[ty++]=Pk,ey[ty++]=Mk,Mk=t,Pk=e}function are(t,e,n){Xo[Qo++]=Xu,Xo[Qo++]=Qu,Xo[Qo++]=Rm,Rm=t;var r=Xu;t=Qu;var i=32-sc(r)-1;r&=~(1<<i),n+=1;var s=32-sc(e)+i;if(30<s){var a=i-i%5;s=(r&(1<<a)-1).toString(32),r>>=a,i-=a,Xu=1<<32-sc(e)+i|n<<i|r,Qu=s+t}else Xu=1<<s|n<<i|r,Qu=t}function NU(t){t.return!==null&&(Ep(t,1),are(t,1,0))}function jU(t){for(;t===Mk;)Mk=ey[--ty],ey[ty]=null,Pk=ey[--ty],ey[ty]=null;for(;t===Rm;)Rm=Xo[--Qo],Xo[Qo]=null,Qu=Xo[--Qo],Xo[Qo]=null,Xu=Xo[--Qo],Xo[Qo]=null}var vo=null,yo=null,Kr=!1,Wl=null;function ore(t,e){var n=rl(5,null,null,0);n.elementType="DELETED",n.stateNode=e,n.return=t,e=t.deletions,e===null?(t.deletions=[n],t.flags|=16):e.push(n)}function IV(t,e){switch(t.tag){case 5:var n=t.type;return e=e.nodeType!==1||n.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,vo=t,yo=sh(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,vo=t,yo=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(n=Rm!==null?{id:Xu,overflow:Qu}:null,t.memoizedState={dehydrated:e,treeContext:n,retryLane:1073741824},n=rl(18,null,null,0),n.stateNode=e,n.return=t,t.child=n,vo=t,yo=null,!0):!1;default:return!1}}function zD(t){return(t.mode&1)!==0&&(t.flags&128)===0}function BD(t){if(Kr){var e=yo;if(e){var n=e;if(!IV(t,e)){if(zD(t))throw Error(Je(418));e=sh(n.nextSibling);var r=vo;e&&IV(t,e)?ore(r,n):(t.flags=t.flags&-4097|2,Kr=!1,vo=t)}}else{if(zD(t))throw Error(Je(418));t.flags=t.flags&-4097|2,Kr=!1,vo=t}}}function DV(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;vo=t}function DN(t){if(t!==vo)return!1;if(!Kr)return DV(t),Kr=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!LD(t.type,t.memoizedProps)),e&&(e=yo)){if(zD(t))throw lre(),Error(Je(418));for(;e;)ore(t,e),e=sh(e.nextSibling)}if(DV(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(Je(317));e:{for(t=t.nextSibling,e=0;t;
vendor: 24,019 bytes, lines 38-40
38){if(t.nodeType===8){var n=t.data;if(n==="/$"){if(e===0){yo=sh(t.nextSibling);break e}e--}else n!=="$"&&n!=="$!"&&n!=="$?"||e++}t=t.nextSibling}yo=null}}else yo=vo?sh(t.stateNode.nextSibling):null;return!0}function lre(){for(var t=yo;t;)t=sh(t.nextSibling)}function nv(){yo=vo=null,Kr=!1}function CU(t){Wl===null?Wl=[t]:Wl.push(t)}var dSe=Ld.ReactCurrentBatchConfig;function lb(t,e,n){if(t=n.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(Je(309));var r=n.stateNode}if(!r)throw Error(Je(147,t));var i=r,s=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===s?e.ref:(e=function(a){var l=i.refs;a===null?delete l[s]:l[s]=a},e._stringRef=s,e)}if(typeof t!="string")throw Error(Je(284));if(!n._owner)throw Error(Je(290,t))}return t}function LN(t,e){throw t=Object.prototype.toString.call(e),Error(Je(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function LV(t){var e=t._init;return e(t._payload)}function cre(t){function e(g,w){if(t){var v=g.deletions;v===null?(g.deletions=[w],g.flags|=16):v.push(w)}}function n(g,w){if(!t)return null;for(;w!==null;)e(g,w),w=w.sibling;return null}function r(g,w){for(g=new Map;w!==null;)w.key!==null?g.set(w.key,w):g.set(w.index,w),w=w.sibling;return g}function i(g,w){return g=ch(g,w),g.index=0,g.sibling=null,g}function s(g,w,v){return g.index=v,t?(v=g.alternate,v!==null?(v=v.index,v<w?(g.flags|=2,w):v):(g.flags|=2,w)):(g.flags|=1048576,w)}function a(g){return t&&g.alternate===null&&(g.flags|=2),g}function l(g,w,v,N){return w===null||w.tag!==6?(w=KO(v,g.mode,N),w.return=g,w):(w=i(w,v),w.return=g,w)}function c(g,w,v,N){var S=v.type;return S===Kx?d(g,w,v.props.children,N,v.key):w!==null&&(w.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===xf&&LV(S)===w.type)?(N=i(w,v.props),N.ref=lb(g,w,v),N.return=g,N):(N=FC(v.type,v.key,v.props,null,g.mode,N),N.ref=lb(g,w,v),N.return=g,N)}function u(g,w,v,N){return w===null||w.tag!==4||w.stateNode.containerInfo!==v.containerInfo||w.stateNode.implementation!==v.implementation?(w=YO(v,g.mode,N),w.return=g,w):(w=i(w,v.children||[]),w.return=g,w)}function d(g,w,v,N,S){return w===null||w.tag!==7?(w=bm(v,g.mode,N,S),w.return=g,w):(w=i(w,v),w.return=g,w)}function f(g,w,v){if(typeof w=="string"&&w!==""||typeof w=="number")return w=KO(""+w,g.mode,v),w.return=g,w;if(typeof w=="object"&&w!==null){switch(w.$$typeof){case CN:return v=FC(w.type,w.key,w.props,null,g.mode,v),v.ref=lb(g,null,w),v.return=g,v;case qx:return w=YO(w,g.mode,v),w.return=g,w;case xf:var N=w._init;return f(g,N(w._payload),v)}if(aw(w)||rb(w))return w=bm(w,g.mode,v,null),w.return=g,w;LN(g,w)}return null}function h(g,w,v,N){var S=w!==null?w.key:null;if(typeof v=="string"&&v!==""||typeof v=="number")return S!==null?null:l(g,w,""+v,N);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case CN:return v.key===S?c(g,w,v,N):null;case qx:return v.key===S?u(g,w,v,N):null;case xf:return S=v._init,h(g,w,S(v._payload),N)}if(aw(v)||rb(v))return S!==null?null:d(g,w,v,N,null);LN(g,v)}return null}function p(g,w,v,N,S){if(typeof N=="string"&&N!==""||typeof N=="number")return g=g.get(v)||null,l(w,g,""+N,S);if(typeof N=="object"&&N!==null){switch(N.$$typeof){case CN:return g=g.get(N.key===null?v:N.key)||null,c(w,g,N,S);case qx:return g=g.get(N.key===null?v:N.key)||null,u(w,g,N,S);case xf:var _=N._init;return p(g,w,v,_(N._payload),S)}if(aw(N)||rb(N))return g=g.get(v)||null,d(w,g,N,S,null);LN(w,N)}return null}function m(g,w,v,N){for(var S=null,_=null,j=w,A=w=0,C=null;j!==null&&A<v.length;A++){j.index>A?(C=j,j=null):C=j.sibling;var k=h(g,j,v[A],N);if(k===null){j===null&&(j=C);break}t&&j&&k.alternate===null&&e(g,j),w=s(k,w,A),_===null?S=k:_.sibling=k,_=k,j=C}if(A===v.length)return n(g,j),Kr&&Ep(g,A),S;if(j===null){for(;A<v.length;A++)j=f(g,v[A],N),j!==null&&(w=s(j,w,A),_===null?S=j:_.sibling=j,_=j);return Kr&&Ep(g,A),S}for(j=r(g,j);A<v.length;A++)C=p(j,g,A,v[A],N),C!==null&&(t&&C.alternate!==null&&j.delete(C.key===null?A:C.key),w=s(C,w,A),_===null?S=C:_.sibling=C,_=C);return t&&j.forEach(function(M){return e(g,M)}),Kr&&Ep(g,A),S}function x(g,w,v,N){var S=rb(v);if(typeof S!="function")throw Error(Je(150));if(v=S.call(v),v==null)throw Error(Je(151));for(var _=S=null,j=w,A=w=0,C=null,k=v.next();j!==null&&!k.done;A++,k=v.next()){j.index>A?(C=j,j=null):C=j.sibling;var M=h(g,j,k.value,N);if(M===null){j===null&&(j=C);break}t&&j&&M.alternate===null&&e(g,j),w=s(M,w,A),_===null?S=M:_.sibling=M,_=M,j=C}if(k.done)return n(g,j),Kr&&Ep(g,A),S;if(j===null){for(;!k.done;A++,k=v.next())k=f(g,k.value,N),k!==null&&(w=s(k,w,A),_===null?S=k:_.sibling=k,_=k);return Kr&&Ep(g,A),S}for(j=r(g,j);!k.done;A++,k=v.next())k=p(j,g,A,k.value,N),k!==null&&(t&&k.alternate!==null&&j.delete(k.key===null?A:k.key),w=s(k,w,A),_===null?S=k:_.sibling=k,_=k);return t&&j.forEach(function(I){return e(g,I)}),Kr&&Ep(g,A),S}function y(g,w,v,N){if(typeof v=="object"&&v!==null&&v.type===Kx&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case CN:e:{for(var S=v.key,_=w;_!==null;){if(_.key===S){if(S=v.type,S===Kx){if(_.tag===7){n(g,_.sibling),w=i(_,v.props.children),w.return=g,g=w;break e}}else if(_.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===xf&&LV(S)===_.type){n(g,_.sibling),w=i(_,v.props),w.ref=lb(g,_,v),w.return=g,g=w;break e}n(g,_);break}else e(g,_);_=_.sibling}v.type===Kx?(w=bm(v.props.children,g.mode,N,v.key),w.return=g,g=w):(N=FC(v.type,v.key,v.props,null,g.mode,N),N.ref=lb(g,w,v),N.return=g,g=N)}return a(g);case qx:e:{for(_=v.key;w!==null;){if(w.key===_)if(w.tag===4&&w.stateNode.containerInfo===v.containerInfo&&w.stateNode.implementation===v.implementation){n(g,w.sibling),w=i(w,v.children||[]),w.return=g,g=w;break e}else{n(g,w);break}else e(g,w);w=w.sibling}w=YO(v,g.mode,N),w.return=g,g=w}return a(g);case xf:return _=v._init,y(g,w,_(v._payload),N)}if(aw(v))return m(g,w,v,N);if(rb(v))return x(g,w,v,N);LN(g,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,w!==null&&w.tag===6?(n(g,w.sibling),w=i(w,v),w.return=g,g=w):(n(g,w),w=KO(v,g.mode,N),w.return=g,g=w),a(g)):n(g,w)}return y}var rv=cre(!0),ure=cre(!1),Ok=Wh(null),Rk=null,ny=null,kU=null;function EU(){kU=ny=Rk=null}function AU(t){var e=Ok.current;Hr(Ok),t._currentValue=e}function VD(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function wy(t,e){Rk=t,kU=ny=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Fa=!0),t.firstContext=null)}function ml(t){var e=t._currentValue;if(kU!==t)if(t={context:t,memoizedValue:e,next:null},ny===null){if(Rk===null)throw Error(Je(308));ny=t,Rk.dependencies={lanes:0,firstContext:t}}else ny=ny.next=t;return e}var Gp=null;function TU(t){Gp===null?Gp=[t]:Gp.push(t)}function dre(t,e,n,r){var i=e.interleaved;return i===null?(n.next=n,TU(e)):(n.next=i.next,i.next=n),e.interleaved=n,vd(t,r)}function vd(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var yf=!1;function MU(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function fre(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function od(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function ah(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,Ln&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,vd(t,n)}return i=r.interleaved,i===null?(e.next=e,TU(r)):(e.next=i.next,i.next=e),r.interleaved=e,vd(t,n)}function OC(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,gU(t,n)}}function $V(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?i=s=a:s=s.next=a,n=n.next}while(n!==null);s===null?i=s=e:s=s.next=e}else i=s=e;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function Ik(t,e,n,r){var i=t.updateQueue;yf=!1;var s=i.firstBaseUpdate,a=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var c=l,u=c.next;c.next=null,a===null?s=u:a.next=u,a=c;var d=t.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==a&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(s!==null){var f=i.baseState;a=0,d=u=c=null,l=s;do{var h=l.lane,p=l.eventTime;if((r&h)===h){d!==null&&(d=d.next={eventTime:p,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var m=t,x=l;switch(h=e,p=n,x.tag){case 1:if(m=x.payload,typeof m=="function"){f=m.call(p,f,h);break e}f=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=x.payload,h=typeof m=="function"?m.call(p,f,h):m,h==null)break e;f=ii({},f,h);break e;case 2:yf=!0}}l.callback!==null&&l.lane!==0&&(t.flags|=64,h=i.effects,h===null?i.effects=[l]:h.push(l))}else p={eventTime:p,lane:h,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=p,c=f):d=d.next=p,a|=h;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;h=l,l=h.next,h.next=null,i.lastBaseUpdate=h,i.shared.pending=null}}while(!0);if(d===null&&(c=f),i.baseState=c,i.firstBaseUpdate=u,i.lastBaseUpdate=d,e=i.shared.interleaved,e!==null){i=e;do a|=i.lane,i=i.next;while(i!==e)}else s===null&&(i.shared.lanes=0);Dm|=a,t.lanes=a,t.memoizedState=f}}function FV(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var r=t[e],i=r.callback;if(i!==null){if(r.callback=null,r=n,typeof i!="function")throw Error(Je(191,i));i.call(r)}}}var bS={},Gc=Wh(bS),k1=Wh(bS),E1=Wh(bS);function qp(t){if(t===bS)throw Error(Je(174));return t}function PU(t,e){switch(Mr(E1,e),Mr(k1,t),Mr(Gc,bS),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:SD(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=SD(e,t)}Hr(Gc),Mr(Gc,e)}function iv(){Hr(Gc),Hr(k1),Hr(E1)}function hre(t){qp(E1.current);var e=qp(Gc.current),n=SD(e,t.type);e!==n&&(Mr(k1,t),Mr(Gc,n))}function OU(t){k1.current===t&&(Hr(Gc),Hr(k1))}var ti=Wh(0);function Dk(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var BO=[];function RU(){for(var t=0;t<BO.length;t++)BO[t]._workInProgressVersionPrimary=null;BO.length=0}var RC=Ld.ReactCurrentDispatcher,VO=Ld.ReactCurrentBatchConfig,Im=0,ri=null,Wi=null,ds=null,Lk=!1,Pw=!1,A1=0,fSe=0;function Fs(){throw Error(Je(321))}function IU(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!cc(t[n],e[n]))return!1;return!0}function DU(t,e,n,r,i,s){if(Im=s,ri=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,RC.current=t===null||t.memoizedState===null?gSe:xSe,t=n(r,i),Pw){s=0;do{if(Pw=!1,A1=0,25<=s)throw Error(Je(301));s+=1,ds=Wi=null,e.updateQueue=null,RC.current=ySe,t=n(r,i)}while(Pw)}if(RC.current=$k,e=Wi!==null&&Wi.next!==null,Im=0,ds=Wi=ri=null,Lk=!1,e)throw Error(Je(300));return t}function LU(){var t=A1!==0;return A1=0,t}function Cc(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ds===null?ri.memoizedState=ds=t:ds=ds.next=t,ds}function gl(){if(Wi===null){var t=ri.alternate;t=t!==null?t.memoizedState:null}else t=Wi.next;var e=ds===null?ri.memoizedState:ds.next;if(e!==null)ds=e,Wi=t;else{if(t===null)throw Error(Je(310));Wi=t,t={memoizedState:Wi.memoizedState,baseState:Wi.baseState,baseQueue:Wi.baseQueue,queue:Wi.queue,next:null},ds===null?ri.memoizedState=ds=t:ds=ds.next=t}return ds}function T1(t,e){return typeof e=="function"?e(t):e}function HO(t){var e=gl(),n=e.queue;if(n===null)throw Error(Je(311));n.lastRenderedReducer=t;var r=Wi,i=r.baseQueue,s=n.pending;if(s!==null){if(i!==null){var a=i.next;i.next=s.next,s.next=a}r.baseQueue=i=s,n.pending=null}if(i!==null){s=i.next,r=r.baseState;var l=a=null,c=null,u=s;do{var d=u.lane;if((Im&d)===d)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:t(r,u.action);else{var f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(l=c=f,a=r):c=c.next=f,ri.lanes|=d,Dm|=d}u=u.next}while(u!==null&&u!==s);c===null?a=r:c.next=l,cc(r,e.memoizedState)||(Fa=!0),e.memoizedState=r,e.baseState=a,e.baseQueue=c,n.lastRenderedState=r}if(t=n.interleaved,t!==null){i=t;do s=i.lane,ri.lanes|=s,Dm|=s,i=i.next;while(i!==t)}else i===null&&(n.lanes=0);return[e.memoizedState,n.dispatch]}function WO(t){var e=gl(),n=e.queue;if(n===null)throw Error(Je(311));n.lastRenderedReducer=t;var r=n.dispatch,i=n.pending,s=e.memoizedState;if(i!==null){n.pending=null;var a=i=i.next;do s=t(s,a.action),a=a.next;while(a!==i);cc(s,e.memoizedState)||(Fa=!0),e.memoizedState=s,e.baseQueue===null&&(e.baseState=s),n.lastRenderedState=s}return[s,r]}function pre(){}function mre(t,e){var n=ri,r=gl(),i=e(),s=!cc(r.memoizedState,i);if(s&&(r.memoizedState=i,Fa=!0),r=r.queue,$U(yre.bind(null,n,r,t),[t]),r.getSnapshot!==e||s||ds!==null&&ds.memoizedState.tag&1){if(n.flags|=2048,M1(9,xre.bind(null,n,r,i,e),void 0,null),xs===null)throw Error(Je(349));Im&30||gre(n,e,i)}return i}function gre(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=ri.updateQueue,e===null?(e={lastEffect:null,stores:null},ri.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function xre(t,e,n,r){e.value=n,e.getSnapshot=r,vre(e)&&bre(t)}function yre(t,e,n){return n(function(){vre(e)&&bre(t)})}function vre(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!cc(t,n)}catch{return!0}}function bre(t){var e=vd(t,1);e!==null&&ac(e,t,1,-1)}function UV(t){var e=Cc();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:T1,lastRenderedState:t},e.queue=t,t=t.dispatch=mSe.bind(null,ri,t),[e.memoizedState,t]}function M1(t,e,n,r){return t={tag:t,create:e,destroy:n,deps:r,next:null},e=ri.updateQueue,e===null?(e={lastEffect:null,stores:null},ri.updateQueue=e,e.lastEffect=t.next=t):(n=e.lastEffect,n===null?e.lastEffect=t.next=t:(r=n.next,n.next=t,t.next=r,e.lastEffect=t)),t}function wre(){return gl().memoizedState}function IC(t,e,n,r){var i=Cc();ri.flags|=t,i.memoizedState=M1(1|e,n,void 0,r===void 0?null:r)}function nT(t,e,n,r){var i=gl();r=r===void 0?null:r;var s=void 0;if(Wi!==null){var a=Wi.memoizedState;if(s=a.destroy,r!==null&&IU(r,a.deps)){i.memoizedState=M1(e,n,s,r);return}}ri.flags|=t,i.memoizedState=M1(1|e,n,s,r)}function zV(t,e){return IC(8390656,8,t,e)}function $U(t,e){return nT(2048,8,t,e)}function _re(t,e){return nT(4,2,t,e)}function Sre(t,e){return nT(4,4,t,e)}function Nre(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function jre(t,e,n){return n=n!=null?n.concat([t]):null,nT(4,4,Nre.bind(null,e,t),n)}function FU(){}function Cre(t,e){var n=gl();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&IU(e,r[1])?r[0]:(n.memoizedState=[t,e],t)}function kre(t,e){var n=gl();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&IU(e,r[1])?r[0]:(t=t(),n.memoizedState=[t,e],t)}function Ere(t,e,n){return Im&21?(cc(n,e)||(n=One(),ri.lanes|=n,Dm|=n,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,Fa=!0),t.memoizedState=n)}function hSe(t,e){var n=rr;rr=n!==0&&4>n?n:4,t(!0);var r=VO.transition;VO.transition={};try{t(!1),e()}finally{rr=n,VO.transition=r}}function Are(){return gl().memoizedState}function pSe(t,e,n){var r=lh(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Tre(t))Mre(e,n);else if(n=dre(t,e,n,r),n!==null){var i=ma();ac(n,t,r,i),Pre(n,e,r)}}function mSe(t,e,n){var r=lh(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Tre(t))Mre(e,i);else{var s=t.alternate;if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var a=e.lastRenderedState,l=s(a,n);if(i.hasEagerState=!0,i.eagerState=l,cc(l,a)){var c=e.interleaved;c===null?(i.next=i,TU(e)):(i.next=c.next,c.next=i),e.interleaved=i;return}}catch{}finally{}n=dre(t,e,i,r),n!==null&&(i=ma(),ac(n,t,r,i),Pre(n,e,r))}}function Tre(t){var e=t.alternate;return t===ri||e!==null&&e===ri}function Mre(t,e){Pw=Lk=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function Pre(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,gU(t,n)}}var $k={readContext:ml,useCallback:Fs,useContext:Fs,useEffect:Fs,useImperativeHandle:Fs,useInsertionEffect:Fs,useLayoutEffect:Fs,useMemo:Fs,useReducer:Fs,useRef:Fs,useState:Fs,useDebugValue:Fs,useDeferredValue:Fs,useTransition:Fs,useMutableSource:Fs,useSyncExternalStore:Fs,useId:Fs,unstable_isNewReconciler:!1},gSe={readContext:ml,useCallback:function(t,e){return Cc().memoizedState=[t,e===void 0?null:e],t},useContext:ml,useEffect:zV,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,IC(4194308,4,Nre.bind(null,e,t),n)},useLayoutEffect:function(t,e){return IC(4194308,4,t,e)},useInsertionEffect:function(t,e){return IC(4,2,t,e)},useMemo:function(t,e){var n=Cc();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=Cc();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=pSe.bind(null,ri,t),[r.memoizedState,t]},useRef:function(t){var e=Cc();return t={current:t},e.memoizedState=t},useState:UV,useDebugValue:FU,useDeferredValue:function(t){return Cc().memoizedState=t},useTransition:function(){var t=UV(!1),e=t[0];return t=hSe.bind(null,t[1]),Cc().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=ri,i=Cc();if(Kr){if(n===void 0)throw Error(Je(407));n=n()}else{if(n=e(),xs===null)throw Error(Je(349));Im&30||gre(r,e,n)}i.memoizedState=n;var s={value:n,getSnapshot:e};return i.queue=s,zV(yre.bind(null,r,s,t),[t]),r.flags|=2048,M1(9,xre.bind(null,r,s,n,e),void 0,null),n},useId:function(){var t=Cc(),e=xs.identifierPrefix;if(Kr){var n=Qu,r=Xu;n=(r&~(1<<32-sc(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=A1++,0<n&&(e+="H"+n.toString(32)),e+=":"}else n=fSe++,e=":"+e+"r"+n.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},xSe={readContext:ml,useCallback:Cre,useContext:ml,useEffect:$U,useImperativeHandle:jre,useInsertionEffect:_re,useLayoutEffect:Sre,useMemo:kre,useReducer:HO,useRef:wre,useState:function(){return HO(T1)},useDebugValue:FU,useDeferredValue:function(t){var e=gl();return Ere(e,Wi.memoizedState,t)},useTransition:function(){var t=HO(T1)[0],e=gl().memoizedState;return[t,e]},useMutableSource:pre,useSyncExternalStore:mre,useId:Are,unstable_isNewReconciler:!1},ySe={readContext:ml,useCallback:Cre,useContext:ml,useEffect:$U,useImperativeHandle:jre,useInsertionEffect:_re,useLayoutEffect:Sre,useMemo:kre,useReducer:WO,useRef:wre,useState:function(){return WO(T1)},useDebugValue:FU,useDeferredValue:function(t){var e=gl();return Wi===null?e.memoizedState=t:Ere(e,Wi.memoizedState,t)},useTransition:function(){var t=WO(T1)[0],e=gl().memoizedState;return[t,e]},useMutableSource:pre,useSyncExternalStore:mre,useId:Are,unstable_isNewReconciler:!1};function Il(t,e){if(t&&t.defaultProps){e=ii({},e),t=t.defaultProps;for(var n in t)e[n]===void 0&&(e[n]=t[n]);return e}return e}function HD(t,e,n,r){e=t.memoizedState,n=n(r,e),n=n==null?e:ii({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var rT={isMounted:function(t){return(t=t._reactInternals)?vg(t)===t:!1},enqueueSetState:function(t,e,n){t=t._reactInternals;var r=ma(),i=lh(t),s=od(r,i);s.payload=e,n!=null&&(s.callback=n),e=ah(t,s,i),e!==null&&(ac(e,t,i,r),OC(e,t,i))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var r=ma(),i=lh(t),s=od(r,i);s.tag=1,s.payload=e,n!=null&&(s.callback=n),e=ah(t,s,i),e!==null&&(ac(e,t,i,r),OC(e,t,i))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=ma(),r=lh(t),i=od(n,r);i.tag=2,e!=null&&(i.callback=e),e=ah(t,i,r),e!==null&&(ac(e,t,r,n),OC(e,t,r))}};function BV(t,e,n,r,i,s,a){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(r,s,a):e.prototype&&e.prototype.isPureReactComponent?!S1(n,r)||!S1(i,s):!0}function Ore(t,e,n){var r=!1,i=kh,s=e.contextType;return typeof s=="object"&&s!==null?s=ml(s):(i=za(e)?Om:Qs.current,r=e.contextTypes,s=(r=r!=null)?tv(t,i):kh),e=new e(n,s),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=rT,t.stateNode=e,e._reactInternals=t,r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=i,t.__reactInternalMemoizedMaskedChildContext=s),e}function VV(t,e,n,r){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(n,r),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(n,r),e.state!==t&&rT.enqueueReplaceState(e,e.state,null)}function WD(t,e,n,r){var i=t.stateNode;i.props=n,i.state=t.memoizedState,i.refs={},MU(t);var s=e.contextType;typeof s=="object"&&s!==null?i.context=ml(s):(s=za(e)?Om:Qs.current,i.context=tv(t,s)),i.state=t.memoizedState,s=e.getDerivedStateFromProps,typeof s=="function"&&(HD(t,e,s,n),i.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(e=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),e!==i.state&&rT.enqueueReplaceState(i,i.state,null),Ik(t,n,i,r),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308)}function sv(t,e){try{var n="",r=e;do n+=G1e(r),r=r.return;while(r);var i=n}catch(s){i=`
39Error generating stack: `+s.message+`
40`+s.stack}return{value:t,source:e,stack:i,digest:null}}function GO(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function GD(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var vSe=typeof WeakMap=="function"?WeakMap:Map;function Rre(t,e,n){n=od(-1,n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){Uk||(Uk=!0,n4=r),GD(t,e)},n}function Ire(t,e,n){n=od(-1,n),n.tag=3;var r=t.type.getDerivedStateFromError;if(typeof r=="function"){var i=e.value;n.payload=function(){return r(i)},n.callback=function(){GD(t,e)}}var s=t.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){GD(t,e),typeof r!="function"&&(oh===null?oh=new Set([this]):oh.add(this));var a=e.stack;this.componentDidCatch(e.value,{componentStack:a!==null?a:""})}),n}function HV(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new vSe;var i=new Set;r.set(e,i)}else i=r.get(e),i===void 0&&(i=new Set,r.set(e,i));i.has(n)||(i.add(n),t=OSe.bind(null,t,e,n),e.then(t,t))}function WV(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function GV(t,e,n,r,i){return t.mode&1?(t.flags|=65536,t.lanes=i,t):(t===e?t.flags|=65536:(t.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(e=od(-1,1),e.tag=2,a
vendor: 6,274 bytes, line 40
40h(n,e,1))),n.lanes|=1),t)}var bSe=Ld.ReactCurrentOwner,Fa=!1;function oa(t,e,n,r){e.child=t===null?ure(e,null,n,r):rv(e,t.child,n,r)}function qV(t,e,n,r,i){n=n.render;var s=e.ref;return wy(e,i),r=DU(t,e,n,r,s,i),n=LU(),t!==null&&!Fa?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,bd(t,e,i)):(Kr&&n&&NU(e),e.flags|=1,oa(t,e,r,i),e.child)}function KV(t,e,n,r,i){if(t===null){var s=n.type;return typeof s=="function"&&!qU(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=s,Dre(t,e,s,r,i)):(t=FC(n.type,null,r,e,e.mode,i),t.ref=e.ref,t.return=e,e.child=t)}if(s=t.child,!(t.lanes&i)){var a=s.memoizedProps;if(n=n.compare,n=n!==null?n:S1,n(a,r)&&t.ref===e.ref)return bd(t,e,i)}return e.flags|=1,t=ch(s,r),t.ref=e.ref,t.return=e,e.child=t}function Dre(t,e,n,r,i){if(t!==null){var s=t.memoizedProps;if(S1(s,r)&&t.ref===e.ref)if(Fa=!1,e.pendingProps=r=s,(t.lanes&i)!==0)t.flags&131072&&(Fa=!0);else return e.lanes=t.lanes,bd(t,e,i)}return qD(t,e,n,r,i)}function Lre(t,e,n){var r=e.pendingProps,i=r.children,s=t!==null?t.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},Mr(iy,oo),oo|=n;else{if(!(n&1073741824))return t=s!==null?s.baseLanes|n:n,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,Mr(iy,oo),oo|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:n,Mr(iy,oo),oo|=r}else s!==null?(r=s.baseLanes|n,e.memoizedState=null):r=n,Mr(iy,oo),oo|=r;return oa(t,e,i,n),e.child}function $re(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function qD(t,e,n,r,i){var s=za(n)?Om:Qs.current;return s=tv(e,s),wy(e,i),n=DU(t,e,n,r,s,i),r=LU(),t!==null&&!Fa?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,bd(t,e,i)):(Kr&&r&&NU(e),e.flags|=1,oa(t,e,n,i),e.child)}function YV(t,e,n,r,i){if(za(n)){var s=!0;Tk(e)}else s=!1;if(wy(e,i),e.stateNode===null)DC(t,e),Ore(e,n,r),WD(e,n,r,i),r=!0;else if(t===null){var a=e.stateNode,l=e.memoizedProps;a.props=l;var c=a.context,u=n.contextType;typeof u=="object"&&u!==null?u=ml(u):(u=za(n)?Om:Qs.current,u=tv(e,u));var d=n.getDerivedStateFromProps,f=typeof d=="function"||typeof a.getSnapshotBeforeUpdate=="function";f||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==r||c!==u)&&VV(e,a,r,u),yf=!1;var h=e.memoizedState;a.state=h,Ik(e,r,a,i),c=e.memoizedState,l!==r||h!==c||Ua.current||yf?(typeof d=="function"&&(HD(e,n,d,r),c=e.memoizedState),(l=yf||BV(e,n,l,r,h,c,u))?(f||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=c),a.props=r,a.state=c,a.context=u,r=l):(typeof a.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{a=e.stateNode,fre(t,e),l=e.memoizedProps,u=e.type===e.elementType?l:Il(e.type,l),a.props=u,f=e.pendingProps,h=a.context,c=n.contextType,typeof c=="object"&&c!==null?c=ml(c):(c=za(n)?Om:Qs.current,c=tv(e,c));var p=n.getDerivedStateFromProps;(d=typeof p=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==f||h!==c)&&VV(e,a,r,c),yf=!1,h=e.memoizedState,a.state=h,Ik(e,r,a,i);var m=e.memoizedState;l!==f||h!==m||Ua.current||yf?(typeof p=="function"&&(HD(e,n,p,r),m=e.memoizedState),(u=yf||BV(e,n,u,r,h,m,c)||!1)?(d||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,m,c),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,m,c)),typeof a.componentDidUpdate=="function"&&(e.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof a.componentDidUpdate!="function"||l===t.memoizedProps&&h===t.memoizedState||(e.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&h===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=m),a.props=r,a.state=m,a.context=c,r=u):(typeof a.componentDidUpdate!="function"||l===t.memoizedProps&&h===t.memoizedState||(e.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&h===t.memoizedState||(e.flags|=1024),r=!1)}return KD(t,e,n,r,s,i)}function KD(t,e,n,r,i,s){$re(t,e);var a=(e.flags&128)!==0;if(!r&&!a)return i&&RV(e,n,!1),bd(t,e,s);r=e.stateNode,bSe.current=e;var l=a&&typeof n.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&a?(e.child=rv(e,t.child,null,s),e.child=rv(e,null,l,s)):oa(t,e,l,s),e.memoizedState=r.state,i&&RV(e,n,!0),e.child}function Fre(t){var e=t.stateNode;e.pendingContext?OV(t,e.pendingContext,e.pendingContext!==e.context):e.context&&OV(t,e.context,!1),PU(t,e.containerInfo)}function XV(t,e,n,r,i){return nv(),CU(i),e.flags|=256,oa(t,e,n,r),e.child}var YD={dehydrated:null,treeContext:null,retryLane:0};function XD(t){return{baseLanes:t,cachePool:null,transitions:null}}function Ure(t,e,n){var r=e.pendingProps,i=ti.current,s=!1,a=(e.flags&128)!==0,l;if((l=a)||(l=t!==null&&t.memoizedState===null?!1:(i&2)!==0),l?(s=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(i|=1),Mr(ti,i&1),t===null)return BD(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(a=r.children,t=r.fallback,s?(r=e.mode,s=e.child,a={mode:"hidden",children:a},!(r&1)&&s!==null?(s.childLanes=0,s.pendingProps=a):s=aT(a,r,0,null),t=bm(t,r,n,null),s.return=e,t.return=e,s.sibling=t,e.child=s,e.child.memoizedState=XD(n),e.memoizedState=YD,t):UU(e,a));if(i=t.memoizedState,i!==null&&(l=i.dehydrated,l!==null))return wSe(t,e,a,r,l,i,n);if(s){s=r.fallback,a=e.mode,i=t.child,l=i.sibling;var c={mode:"hidden",children:r.children};return!(a&1)&&e.child!==i?(r=e.child,r.childLanes=0,r.pendingProps=c,e.deletions=null):(r=ch(i,c),r.subtreeFlags=i.subtreeFlags&14680064),l!==null?s=ch(l,s
vendor: 9,077 bytes, line 40
40):(s=bm(s,a,n,null),s.flags|=2),s.return=e,r.return=e,r.sibling=s,e.child=r,r=s,s=e.child,a=t.child.memoizedState,a=a===null?XD(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},s.memoizedState=a,s.childLanes=t.childLanes&~n,e.memoizedState=YD,r}return s=t.child,t=s.sibling,r=ch(s,{mode:"visible",children:r.children}),!(e.mode&1)&&(r.lanes=n),r.return=e,r.sibling=null,t!==null&&(n=e.deletions,n===null?(e.deletions=[t],e.flags|=16):n.push(t)),e.child=r,e.memoizedState=null,r}function UU(t,e){return e=aT({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function $N(t,e,n,r){return r!==null&&CU(r),rv(e,t.child,null,n),t=UU(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function wSe(t,e,n,r,i,s,a){if(n)return e.flags&256?(e.flags&=-257,r=GO(Error(Je(422))),$N(t,e,a,r)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(s=r.fallback,i=e.mode,r=aT({mode:"visible",children:r.children},i,0,null),s=bm(s,i,a,null),s.flags|=2,r.return=e,s.return=e,r.sibling=s,e.child=r,e.mode&1&&rv(e,t.child,null,a),e.child.memoizedState=XD(a),e.memoizedState=YD,s);if(!(e.mode&1))return $N(t,e,a,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var l=r.dgst;return r=l,s=Error(Je(419)),r=GO(s,r,void 0),$N(t,e,a,r)}if(l=(a&t.childLanes)!==0,Fa||l){if(r=xs,r!==null){switch(a&-a){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|a)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,vd(t,i),ac(r,t,i,-1))}return GU(),r=GO(Error(Je(421))),$N(t,e,a,r)}return i.data==="$?"?(e.flags|=128,e.child=t.child,e=RSe.bind(null,t),i._reactRetry=e,null):(t=s.treeContext,yo=sh(i.nextSibling),vo=e,Kr=!0,Wl=null,t!==null&&(Xo[Qo++]=Xu,Xo[Qo++]=Qu,Xo[Qo++]=Rm,Xu=t.id,Qu=t.overflow,Rm=e),e=UU(e,r.children),e.flags|=4096,e)}function QV(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),VD(t.return,e,n)}function qO(t,e,n,r,i){var s=t.memoizedState;s===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(s.isBackwards=e,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=i)}function zre(t,e,n){var r=e.pendingProps,i=r.revealOrder,s=r.tail;if(oa(t,e,r.children,n),r=ti.current,r&2)r=r&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&QV(t,n,e);else if(t.tag===19)QV(t,n,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}r&=1}if(Mr(ti,r),!(e.mode&1))e.memoizedState=null;else switch(i){case"forwards":for(n=e.child,i=null;n!==null;)t=n.alternate,t!==null&&Dk(t)===null&&(i=n),n=n.sibling;n=i,n===null?(i=e.child,e.child=null):(i=n.sibling,n.sibling=null),qO(e,!1,i,n,s);break;case"backwards":for(n=null,i=e.child,e.child=null;i!==null;){if(t=i.alternate,t!==null&&Dk(t)===null){e.child=i;break}t=i.sibling,i.sibling=n,n=i,i=t}qO(e,!0,n,null,s);break;case"together":qO(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function DC(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function bd(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),Dm|=e.lanes,!(n&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(Je(153));if(e.child!==null){for(t=e.child,n=ch(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=ch(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function _Se(t,e,n){switch(e.tag){case 3:Fre(e),nv();break;case 5:hre(e);break;case 1:za(e.type)&&Tk(e);break;case 4:PU(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,i=e.memoizedProps.value;Mr(Ok,r._currentValue),r._currentValue=i;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(Mr(ti,ti.current&1),e.flags|=128,null):n&e.child.childLanes?Ure(t,e,n):(Mr(ti,ti.current&1),t=bd(t,e,n),t!==null?t.sibling:null);Mr(ti,ti.current&1);break;case 19:if(r=(n&e.childLanes)!==0,t.flags&128){if(r)return zre(t,e,n);e.flags|=128}if(i=e.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Mr(ti,ti.current),r)break;return null;case 22:case 23:return e.lanes=0,Lre(t,e,n)}return bd(t,e,n)}var Bre,QD,Vre,Hre;Bre=function(t,e){for(var n=e.child;n!==null;){if(n.tag===5||n.tag===6)t.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};QD=function(){};Vre=function(t,e,n,r){var i=t.memoizedProps;if(i!==r){t=e.stateNode,qp(Gc.current);var s=null;switch(n){case"input":i=vD(t,i),r=vD(t,r),s=[];break;case"select":i=ii({},i,{value:void 0}),r=ii({},r,{value:void 0}),s=[];break;case"textarea":i=_D(t,i),r=_D(t,r),s=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=Ek)}ND(n,r);var a;n=null;for(u in i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null)if(u==="style"){var l=i[u];for(a in l)l.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(g1.hasOwnProperty(u)?s||(s=[]):(s=s||[]).push(u,null));for(u in r){var c=r[u];if(l=i!=null?i[u]:void 0,r.hasOwnProperty(u)&&c!==l&&(c!=null||l!=null))if(u==="style")if(l){for(a in l)!l.hasOwnProperty(a)||c&&c.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in c)c.hasOwnProperty(a)&&l[a]!==c[a]&&(n||(n={}),n[a]=c[a])}else n||(s||(s=[]),s.push(u,n)),n=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(s=s||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(s=s||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(g1.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&$r("scroll",t),s||l===c||(s=[])):(s=s||[]).push(u,c))}n&&(s=s||[]).push("style",n);var u=s;(e.updateQueue=u)&&(e.flags|=4)}};Hre=function(t,e,n,r){n!==r&&(e.flags|=4)};function cb(t,e){if(!Kr)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:r.sibling=null}}function Us(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,r=0;if(e)for(var i=t.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=t,i=i.sibling;else for(i=t.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=t,i=i.sibling;return t.subtreeFlags|=r,t.childLanes=n,e}function SSe(t,e,n){var r=e.pendingProps;switch(jU(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Us(e),null;case 1:return za(e.type)&&Ak(),Us(e),null;case 3:return r=e.stateNode,iv(),Hr(Ua),Hr(Qs),RU(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(DN(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Wl!==null&&(s4(Wl),Wl=null))),QD(t,e),Us(e),null;case 5:OU(e);var i=qp(E1.current);if(n=e.type,t!==null&&e.stateNode!=null)Vre(t,e,n,r,i),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(Je(166));return Us(e),null}if(t=qp(Gc.current),DN(e)){r=e.stateNode,n=e.type;var s=e.memoizedProps;switch(r[$c]=e,r[C1]=s,t=(e.mode&1)!==0,n){case"dialog":$r("cancel",r),$r("close",r);break;case"iframe":case"object":case"embed":$r("load",r);break;case"video":case"audio":for(i=0;i<lw.length;i++)$r(lw[i],r);break;case"source":$r("error",r);break;case"img":case"image":case"link":$r("error",r),$r("load",r);break;case"details":$r("toggle",r);break;case"input":aV(r,s),$r("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!s.multiple},$r("invalid",r);break;case"textarea":lV(r,s),$r("invalid",r)}ND(n,s),i=null;for(var a in s)if(s.hasOwnProperty(a)){var l=s[a];a==="children"?typeof l=="string"?r.textContent!==l&&(s.suppressHydrationWarning!==!0&&IN(r.textContent,l,t),i=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(s.suppressHydrationWarning!==!0&&IN(r.textContent,l,t),i=["children",""+l]):g1.hasOwnProperty(a)&&l!=null&&a==="onScroll"&&$r("scroll",r)}switch(n){case"input":kN(r),oV(r,s,!0);break;case"textarea":kN(r),cV(r);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(r.onclick=Ek)}r=i,e.updateQueue=r,r!==null&&(e.flags|=4)}else{a=i.nodeType===9?i:i.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=yne(n)),t==="http://www.w3.org/1999/xhtml"?n==="script"?(t=a.createElement("div"),t.innerHTML="<script><\/script>
40",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=a.createElement(n,{is:r.is}):(t=a.createElement(n),n==="select"&&(a=t,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):t=a.createElementNS(t,n),t[$c]=e,t[C1]=r,Bre(t,e,!1,!1),e.stateNode=t;e:{switch(a=jD(n,r),n){case"dialog":$r("cancel",t),$r("close",t),i=r;break;case"iframe":case"object":case"embed":$r("load",t),i=r;break;case"video":case"audio":for(i=0;i<lw.length;i++)$r(lw[i],t);i=r;break;case"source":$r("error",t),i=r;break;case"img":case"image":case"link":$r("error",t),$r("load",t),i=r;break;case"details":$r("toggle",t),i=r;break;case"input":aV(t,r),i=vD(t,r),$r("invalid",t);break;case"option":i=r;break;case"select":t._wrapperState={wasMultiple:!!r.multiple},i=ii({},r,{value:void 0}),$r("invalid",t);break;case"textarea":lV(t,r),i=_D(t,r),$r("invalid",t);break;default:i=r}ND(n,i),l=i;for(s in l)if(l.hasOwnProperty(s)){var c=l[s];s==="style"?wne(t,c):s==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&vne(t,c)):s==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&x1(t,c):typeof c=="number"&&x1(t,""+c):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(g1.hasOwnProperty(s)?c!=null&&s==="onScroll"&&$r("scroll",t):c!=null&&uU(t,s,c,a))}switch(n){case"input":kN(t),oV(t,r,!1);break;case"textarea":kN(t),cV(t);break;case"option":r.value!=null&&t.setAttribute("value",""+Ch(r.value));break;case"select":t.multiple=!!r.multiple,s=r.value,s!=null?xy(t,!!r.multiple,s,!1):r.defaultValue!=null&&xy(t,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(t.onclick=Ek)}switch(n){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 Us(e),null;case 6:if(t&&e.stateNode!=null)Hre(t,e,t.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error(Je(166));if(n=qp(E1.current),qp(Gc.current),DN(e)){if(r=e.stateNode,n=e.memoizedProps,r[$c]=e,(s=r.nodeValue!==n)&&(t=vo,t!==null))switch(t.tag){case 3:IN(r.nodeValue,n,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&IN(r.nodeValue,n,(t.mode&1)!==0)}s&&(e.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[$c]=e,e.stateNode=r}return Us(e),null;case 13:if(Hr(ti),r=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(Kr&&yo!==null&&e.mode&1&&!(e.flags&128))lre(),nv(),e.flags|=98560,s=!1;else if(s=DN(e),r!==null&&r.dehydrated!==null){if(t===null){if(!s)throw Error(Je(318));if(s=e.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(Je(317));s[$c]=e}else nv(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Us(e),s=!1}else Wl!==null&&(s4(Wl),Wl=null),s=!0;if(!s)return e.flags&65536?e:null}return e.flags&128?(e.lanes=n,e):(r=r!==null,r!==(t!==null&&t.memoizedState!==null)&&r&&(e.child.flags|=8192,e.mode&1&&(t===null||ti.current&1?Ki===0&&(Ki=3):GU())),e.updateQueue!==null&&(e.flags|=4),Us(e),null);case 4:return iv(),QD(t,e),t===null&&N1(e.stateNode.containerInfo),Us(e),null;case 10:return AU(e.type._context),Us(e),null;case 17:return za(e.type)&&Ak(),Us(e),null;case 19:if(Hr(ti),s=e.memoizedState,s===null)return Us(e),null;if(r=(e.flags&128)!==0,a=s.rendering,a===null)if(r)cb(s,!1);else{if(Ki!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(a=Dk(t),a!==null){for(e.flags|=128,cb(s,!1),r=a.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),e.subtreeFlags=0,r=n,n=e.child;n!==null;)s=n,t=r,s.flags&=14680066,a=s.alternate,a===null?(s.childLanes=0,s.lanes=t,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=a.childLanes,s.lanes=a.lanes,s.child=a.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=a.memoizedProps,s.memoizedState=a.memoizedState,s.updateQueue=a.updateQueue,s.type=a.type,t=a.dependencies,s.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),n=n.sibling;return Mr(ti,ti.current&1|2),e.child}t=t.sibling}s.tail!==null&&mi()>av&&(e.flags|=128,r=!0,cb(s,!1),e.lanes=4194304)}else{if(!r)if(t=Dk(a),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),cb(s,!0),s.tail===null&&s.tailMode==="hidden"&&!a.alternate&&!Kr)return Us(e),null}else 2*mi()-s.renderingStartTime>av&&n!==1073741824&&(e.flags|=128,r=!0,cb(s,!1),e.lanes=4194304);s.isBackwards?(a.sibling=e.child,e.child=a):(n=s.last,n!==null?n.sibling=a:e.child=a,s.last=a)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=mi(),e.sibling=null,n=ti.current,Mr(ti,r?n&1|2:n&1),e):(Us(e),null);case 22:case 23:return WU(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?oo&1073741824&&(Us(e),e.subtreeFlags&6&&(e.flags|=8192)):Us(e),null;case 24:return null;case 25:return null}throw Error(Je(156,e.tag))}function NSe(t,e){switch(jU(e),e.tag){case 1:return za(e.type)&&Ak(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;
vendor: 25,536 bytes, line 40
40case 3:return iv(),Hr(Ua),Hr(Qs),RU(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return OU(e),null;case 13:if(Hr(ti),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(Je(340));nv()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Hr(ti),null;case 4:return iv(),null;case 10:return AU(e.type._context),null;case 22:case 23:return WU(),null;case 24:return null;default:return null}}var FN=!1,Gs=!1,jSe=typeof WeakSet=="function"?WeakSet:Set,mt=null;function ry(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ui(t,e,r)}else n.current=null}function JD(t,e,n){try{n()}catch(r){ui(t,e,r)}}var JV=!1;function CSe(t,e){if(ID=jk,t=Yne(),SU(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var a=0,l=-1,c=-1,u=0,d=0,f=t,h=null;t:for(;;){for(var p;f!==n||i!==0&&f.nodeType!==3||(l=a+i),f!==s||r!==0&&f.nodeType!==3||(c=a+r),f.nodeType===3&&(a+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===t)break t;if(h===n&&++u===i&&(l=a),h===s&&++d===r&&(c=a),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(DD={focusedElem:t,selectionRange:n},jk=!1,mt=e;mt!==null;)if(e=mt,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,mt=t;else for(;mt!==null;){e=mt;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 x=m.memoizedProps,y=m.memoizedState,g=e.stateNode,w=g.getSnapshotBeforeUpdate(e.elementType===e.type?x:Il(e.type,x),y);g.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var v=e.stateNode.containerInfo;v.nodeType===1?v.textContent="":v.nodeType===9&&v.documentElement&&v.removeChild(v.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Je(163))}}catch(N){ui(e,e.return,N)}if(t=e.sibling,t!==null){t.return=e.return,mt=t;break}mt=e.return}return m=JV,JV=!1,m}function Ow(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&t)===t){var s=i.destroy;i.destroy=void 0,s!==void 0&&JD(e,n,s)}i=i.next}while(i!==r)}}function iT(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function ZD(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function Wre(t){var e=t.alternate;e!==null&&(t.alternate=null,Wre(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[$c],delete e[C1],delete e[FD],delete e[lSe],delete e[cSe])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function Gre(t){return t.tag===5||t.tag===3||t.tag===4}function ZV(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Gre(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function e4(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=Ek));else if(r!==4&&(t=t.child,t!==null))for(e4(t,e,n),t=t.sibling;t!==null;)e4(t,e,n),t=t.sibling}function t4(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(t4(t,e,n),t=t.sibling;t!==null;)t4(t,e,n),t=t.sibling}var Ts=null,Fl=!1;function Xd(t,e,n){for(n=n.child;n!==null;)qre(t,e,n),n=n.sibling}function qre(t,e,n){if(Wc&&typeof Wc.onCommitFiberUnmount=="function")try{Wc.onCommitFiberUnmount(XA,n)}catch{}switch(n.tag){case 5:Gs||ry(n,e);case 6:var r=Ts,i=Fl;Ts=null,Xd(t,e,n),Ts=r,Fl=i,Ts!==null&&(Fl?(t=Ts,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):Ts.removeChild(n.stateNode));break;case 18:Ts!==null&&(Fl?(t=Ts,n=n.stateNode,t.nodeType===8?UO(t.parentNode,n):t.nodeType===1&&UO(t,n),w1(t)):UO(Ts,n.stateNode));break;case 4:r=Ts,i=Fl,Ts=n.stateNode.containerInfo,Fl=!0,Xd(t,e,n),Ts=r,Fl=i;break;case 0:case 11:case 14:case 15:if(!Gs&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,a=s.destroy;s=s.tag,a!==void 0&&(s&2||s&4)&&JD(n,e,a),i=i.next}while(i!==r)}Xd(t,e,n);break;case 1:if(!Gs&&(ry(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){ui(n,e,l)}Xd(t,e,n);break;case 21:Xd(t,e,n);break;case 22:n.mode&1?(Gs=(r=Gs)||n.memoizedState!==null,Xd(t,e,n),Gs=r):Xd(t,e,n);break;default:Xd(t,e,n)}}function e7(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new jSe),e.forEach(function(r){var i=ISe.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Cl(t,e){var n=e.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];try{var s=t,a=e,l=a;e:for(;l!==null;){switch(l.tag){case 5:Ts=l.stateNode,Fl=!1;break e;case 3:Ts=l.stateNode.containerInfo,Fl=!0;break e;case 4:Ts=l.stateNode.containerInfo,Fl=!0;break e}l=l.return}if(Ts===null)throw Error(Je(160));qre(s,a,i),Ts=null,Fl=!1;var c=i.alternate;c!==null&&(c.return=null),i.return=null}catch(u){ui(i,e,u)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)Kre(e,t),e=e.sibling}function Kre(t,e){var n=t.alternate,r=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(Cl(e,t),jc(t),r&4){try{Ow(3,t,t.return),iT(3,t)}catch(x){ui(t,t.return,x)}try{Ow(5,t,t.return)}catch(x){ui(t,t.return,x)}}break;case 1:Cl(e,t),jc(t),r&512&&n!==null&&ry(n,n.return);break;case 5:if(Cl(e,t),jc(t),r&512&&n!==null&&ry(n,n.return),t.flags&32){var i=t.stateNode;try{x1(i,"")}catch(x){ui(t,t.return,x)}}if(r&4&&(i=t.stateNode,i!=null)){var s=t.memoizedProps,a=n!==null?n.memoizedProps:s,l=t.type,c=t.updateQueue;if(t.updateQueue=null,c!==null)try{l==="input"&&s.type==="radio"&&s.name!=null&&gne(i,s),jD(l,a);var u=jD(l,s);for(a=0;a<c.length;a+=2){var d=c[a],f=c[a+1];d==="style"?wne(i,f):d==="dangerouslySetInnerHTML"?vne(i,f):d==="children"?x1(i,f):uU(i,d,f,u)}switch(l){case"input":bD(i,s);break;case"textarea":xne(i,s);break;case"select":var h=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!s.multiple;var p=s.value;p!=null?xy(i,!!s.multiple,p,!1):h!==!!s.multiple&&(s.defaultValue!=null?xy(i,!!s.multiple,s.defaultValue,!0):xy(i,!!s.multiple,s.multiple?[]:"",!1))}i[C1]=s}catch(x){ui(t,t.return,x)}}break;case 6:if(Cl(e,t),jc(t),r&4){if(t.stateNode===null)throw Error(Je(162));i=t.stateNode,s=t.memoizedProps;try{i.nodeValue=s}catch(x){ui(t,t.return,x)}}break;case 3:if(Cl(e,t),jc(t),r&4&&n!==null&&n.memoizedState.isDehydrated)try{w1(e.containerInfo)}catch(x){ui(t,t.return,x)}break;case 4:Cl(e,t),jc(t);break;case 13:Cl(e,t),jc(t),i=t.child,i.flags&8192&&(s=i.memoizedState!==null,i.stateNode.isHidden=s,!s||i.alternate!==null&&i.alternate.memoizedState!==null||(VU=mi())),r&4&&e7(t);break;case 22:if(d=n!==null&&n.memoizedState!==null,t.mode&1?(Gs=(u=Gs)||d,Cl(e,t),Gs=u):Cl(e,t),jc(t),r&8192){if(u=t.memoizedState!==null,(t.stateNode.isHidden=u)&&!d&&t.mode&1)for(mt=t,d=t.child;d!==null;){for(f=mt=d;mt!==null;){switch(h=mt,p=h.child,h.tag){case 0:case 11:case 14:case 15:Ow(4,h,h.return);break;case 1:ry(h,h.return);var m=h.stateNode;if(typeof m.componentWillUnmount=="function"){r=h,n=h.return;try{e=r,m.props=e.memoizedProps,m.state=e.memoizedState,m.componentWillUnmount()}catch(x){ui(r,n,x)}}break;case 5:ry(h,h.return);break;case 22:if(h.memoizedState!==null){n7(f);continue}}p!==null?(p.return=h,mt=p):n7(f)}d=d.sibling}e:for(d=null,f=t;;){if(f.tag===5){if(d===null){d=f;try{i=f.stateNode,u?(s=i.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(l=f.stateNode,c=f.memoizedProps.style,a=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=bne("display",a))}catch(x){ui(t,t.return,x)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(x){ui(t,t.return,x)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===t)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===t)break e;for(;f.sibling===null;){if(f.return===null||f.return===t)break e;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Cl(e,t),jc(t),r&4&&e7(t);break;case 21:break;default:Cl(e,t),jc(t)}}function jc(t){var e=t.flags;if(e&2){try{e:{for(var n=t.return;n!==null;){if(Gre(n)){var r=n;break e}n=n.return}throw Error(Je(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(x1(i,""),r.flags&=-33);var s=ZV(t);t4(t,s,i);break;case 3:case 4:var a=r.stateNode.containerInfo,l=ZV(t);e4(t,l,a);break;default:throw Error(Je(161))}}catch(c){ui(t,t.return,c)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function kSe(t,e,n){mt=t,Yre(t)}function Yre(t,e,n){for(var r=(t.mode&1)!==0;mt!==null;){var i=mt,s=i.child;if(i.tag===22&&r){var a=i.memoizedState!==null||FN;if(!a){var l=i.alternate,c=l!==null&&l.memoizedState!==null||Gs;l=FN;var u=Gs;if(FN=a,(Gs=c)&&!u)for(mt=i;mt!==null;)a=mt,c=a.child,a.tag===22&&a.memoizedState!==null?r7(i):c!==null?(c.return=a,mt=c):r7(i);for(;s!==null;)mt=s,Yre(s),s=s.sibling;mt=i,FN=l,Gs=u}t7(t)}else i.subtreeFlags&8772&&s!==null?(s.return=i,mt=s):t7(t)}}function t7(t){for(;mt!==null;){var e=mt;if(e.flags&8772){var n=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:Gs||iT(5,e);break;case 1:var r=e.stateNode;if(e.flags&4&&!Gs)if(n===null)r.componentDidMount();else{var i=e.elementType===e.type?n.memoizedProps:Il(e.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var s=e.updateQueue;s!==null&&FV(e,s,r);break;case 3:var a=e.updateQueue;if(a!==null){if(n=null,e.child!==null)switch(e.child.tag){case 5:n=e.child.stateNode;break;case 1:n=e.child.stateNode}FV(e,a,n)}break;case 5:var l=e.stateNode;if(n===null&&e.flags&4){n=l;var c=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var u=e.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&w1(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Je(163))}Gs||e.flags&512&&ZD(e)}catch(h){ui(e,e.return,h)}}if(e===t){mt=null;break}if(n=e.sibling,n!==null){n.return=e.return,mt=n;break}mt=e.return}}function n7(t){for(;mt!==null;){var e=mt;if(e===t){mt=null;break}var n=e.sibling;if(n!==null){n.return=e.return,mt=n;break}mt=e.return}}function r7(t){for(;mt!==null;){var e=mt;try{switch(e.tag){case 0:case 11:case 15:var n=e.return;try{iT(4,e)}catch(c){ui(e,n,c)}break;case 1:var r=e.stateNode;if(typeof r.componentDidMount=="function"){var i=e.return;try{r.componentDidMount()}catch(c){ui(e,i,c)}}var s=e.return;try{ZD(e)}catch(c){ui(e,s,c)}break;case 5:var a=e.return;try{ZD(e)}catch(c){ui(e,a,c)}}}catch(c){ui(e,e.return,c)}if(e===t){mt=null;break}var l=e.sibling;if(l!==null){l.return=e.return,mt=l;break}mt=e.return}}var ESe=Math.ceil,Fk=Ld.ReactCurrentDispatcher,zU=Ld.ReactCurrentOwner,ol=Ld.ReactCurrentBatchConfig,Ln=0,xs=null,Ei=null,Is=0,oo=0,iy=Wh(0),Ki=0,P1=null,Dm=0,sT=0,BU=0,Rw=null,Da=null,VU=0,av=1/0,Fu=null,Uk=!1,n4=null,oh=null,UN=!1,Wf=null,zk=0,Iw=0,r4=null,LC=-1,$C=0;function ma(){return Ln&6?mi():LC!==-1?LC:LC=mi()}function lh(t){return t.mode&1?Ln&2&&Is!==0?Is&-Is:dSe.transition!==null?($C===0&&($C=One()),$C):(t=rr,t!==0||(t=window.event,t=t===void 0?16:Une(t.type)),t):1}function ac(t,e,n,r){if(50<Iw)throw Iw=0,r4=null,Error(Je(185));xS(t,n,r),(!(Ln&2)||t!==xs)&&(t===xs&&(!(Ln&2)&&(sT|=n),Ki===4&&Cf(t,Is)),Ba(t,r),n===1&&Ln===0&&!(e.mode&1)&&(av=mi()+500,tT&&Gh()))}function Ba(t,e){var n=t.callbackNode;d_e(t,e);var r=Nk(t,t===xs?Is:0);if(r===0)n!==null&&fV(n),t.callbackNode=null,t.callbackPriority=0;else if(e=r&-r,t.callbackPriority!==e){if(n!=null&&fV(n),e===1)t.tag===0?uSe(i7.bind(null,t)):sre(i7.bind(null,t)),aSe(function(){!(Ln&6)&&Gh()}),n=null;else{switch(Rne(r)){case 1:n=mU;break;case 4:n=Mne;break;case 16:n=Sk;break;case 536870912:n=Pne;break;default:n=Sk}n=rie(n,Xre.bind(null,t))}t.callbackPriority=e,t.callbackNode=n}}function Xre(t,e){if(LC=-1,$C=0,Ln&6)throw Error(Je(327));var n=t.callbackNode;if(_y()&&t.callbackNode!==n)return null;var r=Nk(t,t===xs?Is:0);if(r===0)return null;if(r&30||r&t.expiredLanes||e)e=Bk(t,r);else{e=r;var i=Ln;Ln|=2;var s=Jre();(xs!==t||Is!==e)&&(Fu=null,av=mi()+500,vm(t,e));do try{MSe();break}catch(l){Qre(t,l)}while(!0);EU(),Fk.current=s,Ln=i,Ei!==null?e=0:(xs=null,Is=0,e=Ki)}if(e!==0){if(e===2&&(i=TD(t),i!==0&&(r=i,e=i4(t,i))),e===1)throw n=P1,vm(t,0),Cf(t,r),Ba(t,mi()),n;if(e===6)Cf(t,r);else{if(i=t.current.alternate,!(r&30)&&!ASe(i)&&(e=Bk(t,r),e===2&&(s=TD(t),s!==0&&(r=s,e=i4(t,s))),e===1))throw n=P1,vm(t,0),Cf(t,r),Ba(t,mi()),n;switch(t.finishedWork=i,t.finishedLanes=r,e){case 0:case 1:throw Error(Je(345));case 2:Ap(t,Da,Fu);break;case 3:if(Cf(t,r),(r&130023424)===r&&(e=VU+500-mi(),10<e)){if(Nk(t,0)!==0)break;if(i=t.suspendedLanes,(i&r)!==r){ma(),t.pingedLanes|=t.suspendedLanes&i;break}t.timeoutHandle=$D(Ap.bind(null,t,Da,Fu),e);break}Ap(t,Da,Fu);break;case 4:if(Cf(t,r),(r&4194240)===r)break;for(e=t.eventTimes,i=-1;0<r;){var a=31-sc(r);s=1<<a,a=e[a],a>i&&(i=a),r&=~s}if(r=i,r=mi()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*ESe(r/1960))-r,10<r){t.timeoutHandle=$D(Ap.bind(null,t,Da,Fu),r);break}Ap(t,Da,Fu);break;case 5:Ap(t,Da,Fu);break;default:throw Error(Je(329))}}}return Ba(t,mi()),t.callbackNode===n?Xre.bind(null,t):null}function i4(t,e){var n=Rw;return t.current.memoizedState.isDehydrated&&(vm(t,e).flags|=256),t=Bk(t,e),t!==2&&(e=Da,Da=n,e!==null&&s4(e)),t}function s4(t){Da===null?Da=t:Da.push.apply(Da,t)}function ASe(t){for(var e=t;;){if(e.flags&16384){var n=e.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],s=i.getSnapshot;i=i.value;try{if(!cc(s(),i))return!1}catch{return!1}}}if(n=e.child,e.subtreeFlags&16384&&n!==null)n.return=e,e=n;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function Cf(t,e){for(e&=~BU,e&=~sT,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-sc(e),r=1<<n;t[n]=-1,e&=~r}}function i7(t){if(Ln&6)throw Error(Je(327));_y();var e=Nk(t,0);if(!(e&1))return Ba(t,mi()),null;var n=Bk(t,e);if(t.tag!==0&&n===2){var r=TD(t);r!==0&&(e=r,n=i4(t,r))}if(n===1)throw n=P1,vm(t,0),Cf(t,e),Ba(t,mi()),n;if(n===6)throw Error(Je(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,Ap(t,Da,Fu),Ba(t,mi()),null}function HU(t,e){var n=Ln;Ln|=1;try{return t(e)}finally{Ln=n,Ln===0&&(av=mi()+500,tT&&Gh())}}function Lm(t){Wf!==null&&Wf.tag===0&&!(Ln&6)&&_y();var e=Ln;Ln|=1;var n=ol.transition,r=rr;try{if(ol.transition=null,rr=1,t)return t()}finally{rr=r,ol.transition=n,Ln=e,!(Ln&6)&&Gh()}}function WU(){oo=iy.current,Hr(iy)}function vm(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(n!==-1&&(t.timeoutHandle=-1,sSe(n)),Ei!==null)for(n=Ei.return;n!==null;){var r=n;switch(jU(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Ak();break;case 3:iv(),Hr(Ua),Hr(Qs),RU();break;case 5:OU(r);break;case 4:iv();break;case 13:Hr(ti);break;case 19:Hr(ti);break;case 10:AU(r.type._context);break;case 22:case 23:WU()}n=n.return}if(xs=t,Ei=t=ch(t.current,null),Is=oo=e,Ki=0,P1=null,BU=sT=Dm=0,Da=Rw=null,Gp!==null){for(e=0;e<Gp.length;e++)if(n=Gp[e],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,s=n.pending;if(s!==null){var a=s.next;s.next=i,r.next=a}n.pending=r}Gp=null}return t}function Qre(t,e){do{var n=Ei;try{if(EU(),RC.current=$k,Lk){for(var r=ri.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}Lk=!1}if(Im=0,ds=Wi=ri=null,Pw=!1,A1=0,zU.current=null,n===null||n.return===null){Ki=1,P1=e,Ei=null;break}e:{var s=t,a=n.return,l=n,c=e;if(e=Is,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,d=l,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var h=d.alternate;h?(d.updateQueue=h.updateQueue,d.memoizedState=h.memoizedState,d.lanes=h.lanes):(d.updateQueue=null,d.memoizedState=null)}var p=WV(a);if(p!==null){p.flags&=-257,GV(p,a,l,s,e),p.mode&1&&HV(s,u,e),e=p,c=u;var m=e.updateQueue;if(m===null){var x=new Set;x.add(c),e.updateQueue=x}else m.add(c);break e}else{if(!(e&1)){HV(s,u,e),GU();break e}c=Error(Je(426))}}else if(Kr&&l.mode&1){var y=WV(a);if(y!==null){!(y.flags&65536)&&(y.flags|=256),GV(y,a,l,s,e),CU(sv(c,l));break e}}s=c=sv(c,l),Ki!==4&&(Ki=2),Rw===null?Rw=[s]:Rw.push(s),s=a;do{switch(s.tag){case 3:s.flags|=65536,e&=-e,s.lanes|=e;var g=Rre(s,c,e);$V(s,g);break e;case 1:l=c;var w=s.type,v=s.stateNode;if(!(s.flags&128)&&(typeof w.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(oh===null||!oh.has(v)))){s.flags|=65536,e&=-e,s.lanes|=e;var N=Ire(s,l,e);$V(s,N);break e}}s=s.return}while(s!==null)}eie(n)}catch(S){e=S,Ei===n&&n!==null&&(Ei=n=n.return);continue}break}while(!0)}function Jre(){var t=Fk.current;return Fk.current=$k,t===null?$k:t}function GU(){(Ki===0||Ki===3||Ki===2)&&(Ki=4),xs===null||!(Dm&268435455)&&!(sT&268435455)||Cf(xs,Is)}function Bk(t,e){var n=Ln;Ln|=2;var r=Jre();(xs!==t||Is!==e)&&(Fu=null,vm(t,e));do try{TSe();break}catch(i){Qre(t,i)}while(!0);if(EU(),Ln=n,Fk.current=r,Ei!==null)throw Error(Je(261));return xs=null,Is=0,Ki}function TSe(){for(;Ei!==null;)Zre(Ei)}function MSe(){for(;Ei!==null&&!n_e();)Zre(Ei)}function Zre(t){var e=nie(t.alternate,t,oo);t.memoizedProps=t.pendingProps,e===null?eie(t):Ei=e,zU.current=null}function eie(t){var e=t;do{var n=e.alternate;if(t=e.return,e.flags&32768){if(n=NSe(n,e),n!==null){n.flags&=32767,Ei=n;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Ki=6,Ei=null;return}}else if(n=SSe(n,e,oo),n!==null){Ei=n;return}if(e=e.sibling,e!==null){Ei=e;return}Ei=e=t}while(e!==null);Ki===0&&(Ki=5)}function Ap(t,e,n){var r=rr,i=ol.transition;try{ol.transition=null,rr=1,PSe(t,e,n,r)}finally{ol.transition=i,rr=r}return null}function PSe(t,e,n,r){do _y();while(Wf!==null);if(Ln&6)throw Error(Je(327));n=t.finishedWork;var i=t.finishedLanes;if(n===null)return null;if(t.finishedWork=null,t.finishedLanes=0,n===t.current)throw Error(Je(177));t.callbackNode=null,t.callbackPriority=0;var s=n.lanes|n.childLanes;if(f_e(t,s),t===xs&&(Ei=xs=null,Is=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||UN||(UN=!0,rie(Sk,function(){return _y(),null})),s=(n.flags&15990)!==0,n.subtreeFlags&15990||s){s=ol.transition,ol.transition=null;var a=rr;rr=1;var l=Ln;Ln|=4,zU.current=null,CSe(t,n),Kre(n,t),J_e(DD),jk=!!ID,DD=ID=null,t.current=n,kSe(n),r_e(),Ln=l,rr=a,ol.transition=s}else t.current=n;if(UN&&(UN=!1,Wf=t,zk=i),s=t.pendingLanes,s===0&&(oh=null),a_e(n.stateNode),Ba(t,mi()),e!==null)for(r=t.onRecoverableError,n=0;n<e.length;n++)i=e[n],r(i.value,{componentStack:i.stack,digest:i.digest});if(Uk)throw Uk=!1,t=n4,n4=null,t;return zk&1&&t.tag!==0&&_y(),s=t.pendingLanes,s&1?t===r4?Iw++:(Iw=0,r4=t):Iw=0,Gh(),null}function _y(){if(Wf!==null){var t=Rne(zk),e=ol.transition,n=rr;try{if(ol.transition=null,rr=16>t?16:t,Wf===null)var r=!1;else{if(t=Wf,Wf=null,zk=0,Ln&6)throw Error(Je(331));var i=Ln;for(Ln|=4,mt=t.current;mt!==null;){var s=mt,a=s.child;if(mt.flags&16){var l=s.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(mt=u;mt!==null;){var d=mt;switch(d.tag){case 0:case 11:case 15:Ow(8,d,s)}var f=d.child;if(f!==null)f.return=d,mt=f;else for(;mt!==null;){d=mt;var h=d.sibling,p=d.return;if(Wre(d),d===u){mt=null;break}if(h!==null){h.return=p,mt=h;break}mt=p}}}var m=s.alternate;if(m!==null){var x=m.child;if(x!==null){m.child=null;do{var y=x.sibling;x.sibling=null,x=y}while(x!==null)}}mt=s}}if(s.subtreeFlags&2064&&a!==null)a.return=s,mt=a;else e:for(;mt!==null;){if(s=mt,s.flags&2048)switch(s.tag){case 0:case 11:case 15:Ow(9,s,s.return)}var g=s.sibling;if(g!==null){g.return=s.return,mt=g;break e}mt=s.return}}var w=t.current;for(mt=w;mt!==null;){a=mt;var v=a.child;if(a.subtreeFlags&2064&&v!==null)v.return=a,mt=v;else e:for(a=w;mt!==null;){if(l=mt,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:iT(9,l)}}catch(S){ui(l,l.return,S)}if(l===a){mt=null;break e}var N=l.sibling;if(N!==null){N.return=l.return,mt=N;break e}mt=l.return}}if(Ln=i,Gh(),Wc&&typeof Wc.onPostCommitFiberRoot=="function")try{Wc.onPostCommitFiberRoot(XA,t)}catch{}r=!0}return r}finally{rr=n,ol.transition=e}}return!1}function s7(t,e,n){e=sv(n,e),e=Rre(t,e,1),t=ah(t,e,1),e=ma(),t!==null&&(xS(t,1,e),Ba(t,e))}function ui(t,e,n){if(t.tag===3)s7(t,t,n);else for(;e!==null;){if(e.tag===3){s7(e,t,n);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(oh===null||!oh.has(r))){t=sv(n,t),t=Ire(e,t,1),e=ah(e,t,1),t=ma(),e!==null&&(xS(e,1,t),Ba(e,t));break}}e=e.return}}function OSe(t,e,n){var r=t.pingCache;r!==null&&r.delete(e),e=ma(),t.pingedLanes|=t.suspendedLanes&n,xs===t&&(Is&n)===n&&(Ki===4||Ki===3&&(Is&130023424)===Is&&500>mi()-VU?vm(t,0):BU|=n),Ba(t,e)}function tie(t,e){e===0&&(t.mode&1?(e=TN,TN<<=1,!(TN&130023424)&&(TN=4194304)):e=1);var n=ma();t=vd(t,e),t!==null&&(xS(t,e,n),Ba(t,n))}function RSe(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),tie(t,n)}function ISe(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(Je(314))}r!==null&&r.delete(e),tie(t,n)}var nie;nie=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||Ua.current)Fa=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return Fa=!1,_Se(t,e,n);Fa=!!(t.flags&131072)}else Fa=!1,Kr&&e.flags&1048576&&are(e,Pk,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;DC(t,e),t=e.pendingProps;var i=tv(e,Qs.current);wy(e,n),i=DU(null,e,r,t,i,n);var s=LU();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,za(r)?(s=!0,Tk(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,MU(e),i.updater=rT,e.stateNode=i,i._reactInternals=e,WD(e,r,t,n),e=KD(null,e,r,!0,s,n)):(e.tag=0,Kr&&s&&NU(e),oa(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(DC(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=LSe(r),t=Il(r,t),i){case 0:e=qD(null,e,r,t,n);break e;case 1:e=YV(null,e,r,t,n);break e;case 11:e=qV(null,e,r,t,n);break e;case 14:e=KV(null,e,r,Il(r.type,t),n);break e}throw Error(Je(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Il(r,i),qD(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Il(r,i),YV(t,e,r,i,n);case 3:e:{if(Fre(e),t===null)throw Error(Je(387));r=e.pendingProps,s=e.memoizedState,i=s.element,fre(t,e),Ik(e,r,null,n);var a=e.memoizedState;if(r=a.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=sv(Error(Je(423)),e),e=XV(t,e,r,n,i);break e}else if(r!==i){i=sv(Error(Je(424)),e),e=XV(t,e,r,n,i);break e}else for(yo=sh(e.stateNode.containerInfo.firstChild),vo=e,Kr=!0,Wl=null,n=ure(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(nv(),r===i){e=bd(t,e,n);break e}oa(t,e,r,n)}e=e.child}return e;case 5:return hre(e),t===null&&BD(e),r=e.type,i=e.pendingProps,s=t!==null?t.memoizedProps:null,a=i.children,LD(r,i)?a=null:s!==null&&LD(r,s)&&(e.flags|=32),$re(t,e),oa(t,e,a,n),e.child;case 6:return t===null&&BD(e),null;case 13:return Ure(t,e,n);case 4:return PU(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=rv(e,null,r,n):oa(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Il(r,i),qV(t,e,r,i,n);case 7:return oa(t,e,e.pendingProps,n),e.child;case 8:return oa(t,e,e.pendingProps.children,n),e.child;case 12:return oa(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,s=e.memoizedProps,a=i.value,Mr(Ok,r._currentValue),r._currentValue=a,s!==null)if(cc(s.value,a)){if(s.children===i.children&&!Ua.current){e=bd(t,e,n);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var l=s.dependencies;if(l!==null){a=s.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(s.tag===1){c=od(-1,n&-n),c.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),VD(s.return,n,e),l.lanes|=n;break}c=c.next}}else if(s.tag===10)a=s.type===e.type?null:s.child;else if(s.tag===18){if(a=s.return,a===null)throw Error(Je(341));a.lanes|=n,l=a.alternate,l!==null&&(l.lanes|=n),VD(a,n,e),a=s.sibling}else a=s.child;if(a!==null)a.return=s;else for(a=s;a!==null;){if(a===e){a=null;break}if(s=a.sibling,s!==null){s.return=a.return,a=s;break}a=a.return}s=a}oa(t,e,i.children,n),e=e.child}return e;
vendor: 6,266 bytes, line 40
40case 9:return i=e.type,r=e.pendingProps.children,wy(e,n),i=ml(i),r=r(i),e.flags|=1,oa(t,e,r,n),e.child;case 14:return r=e.type,i=Il(r,e.pendingProps),i=Il(r.type,i),KV(t,e,r,i,n);case 15:return Dre(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Il(r,i),DC(t,e),e.tag=1,za(r)?(t=!0,Tk(e)):t=!1,wy(e,n),Ore(e,r,i),WD(e,r,i,n),KD(null,e,r,!0,t,n);case 19:return zre(t,e,n);case 22:return Lre(t,e,n)}throw Error(Je(156,e.tag))};function rie(t,e){return Tne(t,e)}function DSe(t,e,n,r){this.tag=t,this.key=n,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 rl(t,e,n,r){return new DSe(t,e,n,r)}function qU(t){return t=t.prototype,!(!t||!t.isReactComponent)}function LSe(t){if(typeof t=="function")return qU(t)?1:0;if(t!=null){if(t=t.$$typeof,t===fU)return 11;if(t===hU)return 14}return 2}function ch(t,e){var n=t.alternate;return n===null?(n=rl(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function FC(t,e,n,r,i,s){var a=2;if(r=t,typeof t=="function")qU(t)&&(a=1);else if(typeof t=="string")a=5;else e:switch(t){case Kx:return bm(n.children,i,s,e);case dU:a=8,i|=8;break;case mD:return t=rl(12,n,e,i|2),t.elementType=mD,t.lanes=s,t;case gD:return t=rl(13,n,e,i),t.elementType=gD,t.lanes=s,t;case xD:return t=rl(19,n,e,i),t.elementType=xD,t.lanes=s,t;case hne:return aT(n,i,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case dne:a=10;break e;case fne:a=9;break e;case fU:a=11;break e;case hU:a=14;break e;case xf:a=16,r=null;break e}throw Error(Je(130,t==null?t:typeof t,""))}return e=rl(a,n,e,i),e.elementType=t,e.type=r,e.lanes=s,e}function bm(t,e,n,r){return t=rl(7,t,r,e),t.lanes=n,t}function aT(t,e,n,r){return t=rl(22,t,r,e),t.elementType=hne,t.lanes=n,t.stateNode={isHidden:!1},t}function KO(t,e,n){return t=rl(6,t,null,e),t.lanes=n,t}function YO(t,e,n){return e=rl(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function $Se(t,e,n,r,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=AO(0),this.expirationTimes=AO(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=AO(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function KU(t,e,n,r,i,s,a,l,c){return t=new $Se(t,e,n,l,c),e===1?(e=1,s===!0&&(e|=8)):e=0,s=rl(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},MU(s),t}function FSe(t,e,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:qx,key:r==null?null:""+r,children:t,containerInfo:e,implementation:n}}function iie(t){if(!t)return kh;t=t._reactInternals;e:{if(vg(t)!==t||t.tag!==1)throw Error(Je(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(za(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(Je(171))}if(t.tag===1){var n=t.type;if(za(n))return ire(t,n,e)}return e}function sie(t,e,n,r,i,s,a,l,c){return t=KU(n,r,!0,t,i,s,a,l,c),t.context=iie(null),n=t.current,r=ma(),i=lh(n),s=od(r,i),s.callback=e??null,ah(n,s,i),t.current.lanes=i,xS(t,i,r),Ba(t,r),t}function oT(t,e,n,r){var i=e.current,s=ma(),a=lh(i);return n=iie(n),e.context===null?e.context=n:e.pendingContext=n,e=od(s,a),e.payload={element:t},r=r===void 0?null:r,r!==null&&(e.callback=r),t=ah(i,e,a),t!==null&&(ac(t,i,a,s),OC(t,i,a)),a}function Vk(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function a7(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function YU(t,e){a7(t,e),(t=t.alternate)&&a7(t,e)}function USe(){return null}var aie=typeof reportError=="function"?reportError:function(t){console.error(t)};function XU(t){this._internalRoot=t}lT.prototype.render=XU.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(Je(409));oT(t,e,null,null)};lT.prototype.unmount=XU.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;Lm(function(){oT(null,t,null,null)}),e[yd]=null}};function lT(t){this._internalRoot=t}lT.prototype.unstable_scheduleHydration=function(t){if(t){var e=Lne();t={blockedOn:null,target:t,priority:e};for(var n=0;n<jf.length&&e!==0&&e<jf[n].priority;n++);jf.splice(n,0,t),n===0&&Fne(t)}};function QU(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function cT(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function o7(){}function zSe(t,e,n,r,i){if(i){if(typeof r=="function"){var s=r;r=function(){var u=Vk(a);s.call(u)}}var a=sie(e,r,t,0,null,!1,!1,"",o7);return t._reactRootContainer=a,t[yd]=a.current,N1(t.nodeType===8?t.parentNode:t),Lm(),a}for(;i=t.lastChild;)t.removeChild(i);if(typeof r=="function"){var l=r;r=function(){var u=Vk(c);l.call(u)}}var c=KU(t,0,!1,null,null,!1,!1,"",o7);return t._reactRootContainer=c,t[yd]=c.current,N1(t.nodeType===8?t.parentNode:t),Lm(function(){oT(e,c,n,r)}),c}function uT(t,e,n,r,i){var s=n._reactRootContainer;if(s){var a=s;if(typeof i=="function"){var l=i;
40i=function(){var c=Vk(a);l.call(c)}}oT(e,a,t,i)}else a=zSe(n,e,t,i,r);return Vk(a)}Ine=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var n=ow(e.pendingLanes);n!==0&&(gU(e,n|1),Ba(e,mi()),!(Ln&6)&&(av=mi()+500,Gh()))}break;case 13:Lm(function(){var r=vd(t,1);if(r!==null){var i=ma();ac(r,t,1,i)}}),YU(t,1)}};xU=function(t){if(t.tag===13){var e=vd(t,134217728);if(e!==null){var n=ma();ac(e,t,134217728,n)}YU(t,134217728)}};Dne=function(t){if(t.tag===13){var e=lh(t),n=vd(t,e);if(n!==null){var r=ma();ac(n,t,e,r)}YU(t,e)}};Lne=function(){return rr};$ne=function(t,e){var n=rr;try{return rr=t,e()}finally{rr=n}};kD=function(t,e,n){switch(e){case"input":if(bD(t,n),e=n.name,n.type==="radio"&&e!=null){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<n.length;e++){var r=n[e];if(r!==t&&r.form===t.form){var i=eT(r);if(!i)throw Error(Je(90));mne(r),bD(r,i)}}}break;case"textarea":xne(t,n);break;case"select":e=n.value,e!=null&&xy(t,!!n.multiple,e,!1)}};Nne=HU;jne=Lm;var BSe={usingClientEntryPoint:!1,Events:[vS,Jx,eT,_ne,Sne,HU]},ub={findFiberByHostInstance:Wp,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},VSe={bundleType:ub.bundleType,version:ub.version,rendererPackageName:ub.rendererPackageName,rendererConfig:ub.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Ld.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=Ene(t),t===null?null:t.stateNode},findFiberByHostInstance:ub.findFiberByHostInstance||USe,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 zN=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!zN.isDisabled&&zN.supportsFiber)try{XA=zN.inject(VSe),Wc=zN}catch{}}Io.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=BSe;Io.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!QU(e))throw Error(Je(200));return FSe(t,e,null,n)};Io.createRoot=function(t,e){if(!QU(t))throw Error(Je(299));var n=!1,r="",i=aie;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onRecoverableError!==void 0&&(i=e.onRecoverableError)),e=KU(t,1,!1,null,null,n,!1,r,i),t[yd]=e.current,N1(t.nodeType===8?t.parentNode:t),new XU(e)};Io.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(Je(188)):(t=Object.keys(t).join(","),Error(Je(268,t)));return t=Ene(e),t=t===null?null:t.stateNode,t};Io.flushSync=function(t){return Lm(t)};Io.hydrate=function(t,e,n){if(!cT(e))throw Error(Je(200));return uT(null,t,e,!0,n)};Io.hydrateRoot=function(t,e,n){if(!QU(t))throw Error(Je(405));var r=n!=null&&n.hydratedSources||null,i=!1,s="",a=aie;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),e=sie(e,null,t,1,n??null,i,!1,s,a),t[yd]=e.current,N1(t),r)for(t=0;t<r.length;t++)n=r[t],i=n._getVersion,i=i(n._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[n,i]:e.mutableSourceEagerHydrationData.push(n,i);return new lT(e)};Io.render=function(t,e,n){if(!cT(e))throw Error(Je(200));return uT(null,t,e,!1,n)};Io.unmountComponentAtNode=function(t){if(!cT(t))throw Error(Je(40));return t._reactRootContainer?(Lm(function(){uT(null,null,t,!1,function(){t._reactRootContainer=null,t[yd]=null})}),!0):!1};Io.unstable_batchedUpdates=HU;Io.unstable_renderSubtreeIntoContainer=function(t,e,n,r){if(!cT(n))throw Error(Je(200));if(t==null||t._reactInternals===void 0)throw Error(Je(38));return uT(t,e,n,!1,r)};Io.version="18.3.1-next-f1338f8080-20240426";function oie(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(oie)}catch(t){console.error(t)}}oie(),one.exports=Io;var wl=one.exports;const JU=An(wl);var l7=wl;hD.createRoot=l7.createRoot,hD.hydrateRoot=l7.hydrateRoot;var w0=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},HSe={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},Rf,rU,Fte,WSe=(Fte=class{constructor(){Rt(this,Rf,HSe);Rt(this,rU,!1)}setTimeoutProvider(t){ut(this,Rf,t)}setTimeout(t,e){return be(this,Rf).setTimeout(t,e)}clearTimeout(t){be(this,Rf).clearTimeout(t)}setInterval(t,e){return be(this,Rf).setInterval(t,e)}clearInterval(t){be(this,Rf).clearInterval(t)}},Rf=new WeakMap,rU=new WeakMap,Fte),Kp=new WSe;function GSe(t){setTimeout(t,0)}var $m=typeof window>"u"||"Deno"in globalThis;function la(){}function qSe(t,e){return typeof t=="function"?t(e):t}function a4(t){return typeof t=="number"&&t>=0&&t!==1/0}function lie(t,e){return Math.max(t+(e||0)-Date.now(),0)}function uh(t,e){return typeof t=="function"?t(e):t}function Ko(t,e){return typeof t=="function"?t(e):t}function c7(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:a,stale:l}=t;if(a){if(r){if(e.queryHash!==ZU(a,e.options))return!1}else if(!O1(e.queryKey,a))return!1}if(n!=="all"){const c=e.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof l=="boolean"&&e.isStale()!==l||i&&i!==e.state.fetchStatus||s&&!s(e))}function u7(t,e){const{exact:n,status:r,predicate:i,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(n){if(Fm(e.options.mutationKey)!==Fm(s))return!1}else if(!O1(e.options.mutationKey,s))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function ZU(t,e){return((e==null?void 0:e.queryKeyHashFn)||Fm)(t)}function Fm(t){return JSON.stringify(t,(e,n)=>o4(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function O1(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>O1(t[n],e[n])):!1}var KSe=Object.prototype.hasOwnProperty;function cie(t,e){if(t===e)return t;const n=d7(t)&&d7(e);if(!n&&!(o4(t)&&o4(e)))return e;const i=(n?t:Object.keys(t)).length,s=n?e:Object.keys(e),a=s.length,l=n?new Array(a):{};let c=0;for(let u=0;u<a;u++){const d=n?u:s[u],f=t[d],h=e[d];if(f===h){l[d]=f,(n?u<i:KSe.call(t,d))&&c++;continue}if(f===null||h===null||typeof f!="object"||typeof h!="object"){l[d]=h;continue}const p=cie(f,h);l[d]=p,p===f&&c++}return i===a&&c===i?t:l}function Hk(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in t)if(t[n]!==e[n])return!1;return!0}function d7(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function o4(t){if(!f7(t))return!1;const e=t.constructor;if(e===void 0)return!0;const n=e.prototype;return!(!f7(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function f7(t){return Object.prototype.toString.call(t)==="[object Object]"}function YSe(t){return new Promise(e=>{Kp.setTimeout(e,t)})}function l4(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?cie(t,e):e}function XSe(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function QSe(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var ez=Symbol();function uie(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===ez?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function tz(t,e){return typeof t=="function"?t(...e):!!t}function JSe(t,e,n){let r=!1,i;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(i??(i=e()),r||(r=!0,i.aborted?n():i.addEventListener("abort",n,{once:!0})),i)}),t}var um,If,By,Ute,ZSe=(Ute=class extends w0{constructor(){super();Rt(this,um);Rt(this,If);Rt(this,By);ut(this,By,e=>{if(!$m&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){be(this,If)||this.setEventListener(be(this,By))}onUnsubscribe(){var e;this.hasListeners()||((e=be(this,If))==null||e.call(this),ut(this,If,void 0))}setEventListener(e){var n;ut(this,By,e),(n=be(this,If))==null||n.call(this),ut(this,If,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){be(this,um)!==e&&(ut(this,um,e),this.onFocus())}onFocus(){const e=this.isFocused();
vendor: 5,050 bytes, line 40
40this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof be(this,um)=="boolean"?be(this,um):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},um=new WeakMap,If=new WeakMap,By=new WeakMap,Ute),nz=new ZSe;function c4(){let t,e;const n=new Promise((i,s)=>{t=i,e=s});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),t(i)},n.reject=i=>{r({status:"rejected",reason:i}),e(i)},n}var eNe=GSe;function tNe(){let t=[],e=0,n=l=>{l()},r=l=>{l()},i=eNe;const s=l=>{e?t.push(l):i(()=>{n(l)})},a=()=>{const l=t;t=[],l.length&&i(()=>{r(()=>{l.forEach(c=>{n(c)})})})};return{batch:l=>{let c;e++;try{c=l()}finally{e--,e||a()}return c},batchCalls:l=>(...c)=>{s(()=>{l(...c)})},schedule:s,setNotifyFunction:l=>{n=l},setBatchNotifyFunction:l=>{r=l},setScheduler:l=>{i=l}}}var Gi=tNe(),Vy,Df,Hy,zte,nNe=(zte=class extends w0{constructor(){super();Rt(this,Vy,!0);Rt(this,Df);Rt(this,Hy);ut(this,Hy,e=>{if(!$m&&window.addEventListener){const n=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){be(this,Df)||this.setEventListener(be(this,Hy))}onUnsubscribe(){var e;this.hasListeners()||((e=be(this,Df))==null||e.call(this),ut(this,Df,void 0))}setEventListener(e){var n;ut(this,Hy,e),(n=be(this,Df))==null||n.call(this),ut(this,Df,e(this.setOnline.bind(this)))}setOnline(e){be(this,Vy)!==e&&(ut(this,Vy,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return be(this,Vy)}},Vy=new WeakMap,Df=new WeakMap,Hy=new WeakMap,zte),Wk=new nNe;function rNe(t){return Math.min(1e3*2**t,3e4)}function die(t){return(t??"online")==="online"?Wk.isOnline():!0}var u4=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function fie(t){let e=!1,n=0,r;const i=c4(),s=()=>i.status!=="pending",a=x=>{var y;if(!s()){const g=new u4(x);h(g),(y=t.onCancel)==null||y.call(t,g)}},l=()=>{e=!0},c=()=>{e=!1},u=()=>nz.isFocused()&&(t.networkMode==="always"||Wk.isOnline())&&t.canRun(),d=()=>die(t.networkMode)&&t.canRun(),f=x=>{s()||(r==null||r(),i.resolve(x))},h=x=>{s()||(r==null||r(),i.reject(x))},p=()=>new Promise(x=>{var y;r=g=>{(s()||u())&&x(g)},(y=t.onPause)==null||y.call(t)}).then(()=>{var x;r=void 0,s()||(x=t.onContinue)==null||x.call(t)}),m=()=>{if(s())return;let x;const y=n===0?t.initialPromise:void 0;try{x=y??t.fn()}catch(g){x=Promise.reject(g)}Promise.resolve(x).then(f).catch(g=>{var _;if(s())return;const w=t.retry??($m?0:3),v=t.retryDelay??rNe,N=typeof v=="function"?v(n,g):v,S=w===!0||typeof w=="number"&&n<w||typeof w=="function"&&w(n,g);if(e||!S){h(g);return}n++,(_=t.onFail)==null||_.call(t,n,g),YSe(N).then(()=>u()?void 0:p()).then(()=>{e?h(g):m()})})};return{promise:i,status:()=>i.status,cancel:a,continue:()=>(r==null||r(),i),cancelRetry:l,continueRetry:c,canStart:d,start:()=>(d()?m():p().then(m),i)}}var dm,Bte,hie=(Bte=class{constructor(){Rt(this,dm)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),a4(this.gcTime)&&ut(this,dm,Kp.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??($m?1/0:5*60*1e3))}clearGcTimeout(){be(this,dm)&&(Kp.clearTimeout(be(this,dm)),ut(this,dm,void 0))}},dm=new WeakMap,Bte),fm,Wy,qo,hm,cs,dS,pm,Ll,Du,Vte,iNe=(Vte=class extends hie{constructor(e){super();Rt(this,Ll);Rt(this,fm);Rt(this,Wy);Rt(this,qo);Rt(this,hm);Rt(this,cs);Rt(this,dS);Rt(this,pm);ut(this,pm,!1),ut(this,dS,e.defaultOptions),this.setOptions(e.options),this.observers=[],ut(this,hm,e.client),ut(this,qo,be(this,hm).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,ut(this,fm,p7(this.options)),this.state=e.state??be(this,fm),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=be(this,cs))==null?void 0:e.promise}setOptions(e){if(this.options={...be(this,dS),...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=p7(this.options);n.data!==void 0&&(this.setState(h7(n.data,n.dataUpdatedAt)),ut(this,fm,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&be(this,qo).remove(this)}setData(e,n){const r=l4(this.state.data,e,this.options);return yn(this,Ll,Du).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e,n){yn(this,Ll,Du).call(this,{type:"setState",state:e,setStateOptions:n})}cancel(e){var r,i;const n=(r=be(this,cs))==null?void 0:r.promise;return(i=be(this,cs))==null||i.cancel(e),n?n.then(la).catch(la):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(be(this,fm))}isActive(){return this.observers.some(e=>Ko(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ez||this.state.dataUpdateCount+this.state.errorUpdate
40Count===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>uh(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:!lie(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=be(this,cs))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=be(this,cs))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),be(this,qo).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(be(this,cs)&&(be(this,pm)?be(this,cs).cancel({revert:!0}):be(this,cs).cancelRetry()),this.scheduleGc()),be(this,qo).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||yn(this,Ll,Du).call(this,{type:"invalidate"})}async fetch(e,n){var c,u,d,f,h,p,m,x,y,g,w,v;if(this.state.fetchStatus!=="idle"&&((c=be(this,cs))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(be(this,cs))return be(this,cs).continueRetry(),be(this,cs).promise}if(e&&this.setOptions(e),!this.options.queryFn){const N=this.observers.find(S=>S.options.queryFn);N&&this.setOptions(N.options)}const r=new AbortController,i=N=>{Object.defineProperty(N,"signal",{enumerable:!0,get:()=>(ut(this,pm,!0),r.signal)})},s=()=>{const N=uie(this.options,n),_=(()=>{const j={client:be(this,hm),queryKey:this.queryKey,meta:this.meta};return i(j),j})();return ut(this,pm,!1),this.options.persister?this.options.persister(N,_,this):N(_)},l=(()=>{const N={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:be(this,hm),state:this.state,fetchFn:s};return i(N),N})();(u=this.options.behavior)==null||u.onFetch(l,this),ut(this,Wy,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=l.fetchOptions)==null?void 0:d.meta))&&yn(this,Ll,Du).call(this,{type:"fetch",meta:(f=l.fetchOptions)==null?void 0:f.meta}),ut(this,cs,fie({initialPromise:n==null?void 0:n.initialPromise,fn:l.fetchFn,onCancel:N=>{N instanceof u4&&N.revert&&this.setState({...be(this,Wy),fetchStatus:"idle"}),r.abort()},onFail:(N,S)=>{yn(this,Ll,Du).call(this,{type:"failed",failureCount:N,error:S})},onPause:()=>{yn(this,Ll,Du).call(this,{type:"pause"})},onContinue:()=>{yn(this,Ll,Du).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0}));try{const N=await be(this,cs).start();if(N===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(N),(p=(h=be(this,qo).config).onSuccess)==null||p.call(h,N,this),(x=(m=be(this,qo).config).onSettled)==null||x.call(m,N,this.state.error,this),N}catch(N){if(N instanceof u4){if(N.silent)return be(this,cs).promise;if(N.revert){if(this.state.data===void 0)throw N;return this.state.data}}throw yn(this,Ll,Du).call(this,{type:"error",error:N}),(g=(y=be(this,qo).config).onError)==null||g.call(y,N,this),(v=(w=be(this,qo).config).onSettled)==null||v.call(w,this.state.data,N,this),N}finally{this.scheduleGc()}}},fm=new WeakMap,Wy=new WeakMap,qo=new WeakMap,hm=new WeakMap,cs=new WeakMap,dS=new WeakMap,pm=new WeakMap,Ll=new WeakSet,Du=function(e){const n=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,...pie(r.data,this.options),fetchMeta:e.meta??null};case"success":const i={...r,...h7(e.data,e.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return ut(this,Wy,e.manual?i:void 0),i;case"error":const s=e.error;
vendor: 8,535 bytes, line 40
40return{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=n(this.state),Gi.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),be(this,qo).notify({query:this,type:"updated",action:e})})},Vte);function pie(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:die(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function h7(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function p7(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,r=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Ma,Rn,fS,ia,mm,Gy,Wu,Lf,hS,qy,Ky,gm,xm,$f,Yy,Qn,cw,d4,f4,h4,p4,m4,g4,x4,gie,Hte,mie=(Hte=class extends w0{constructor(e,n){super();Rt(this,Qn);Rt(this,Ma);Rt(this,Rn);Rt(this,fS);Rt(this,ia);Rt(this,mm);Rt(this,Gy);Rt(this,Wu);Rt(this,Lf);Rt(this,hS);Rt(this,qy);Rt(this,Ky);Rt(this,gm);Rt(this,xm);Rt(this,$f);Rt(this,Yy,new Set);this.options=n,ut(this,Ma,e),ut(this,Lf,null),ut(this,Wu,c4()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(be(this,Rn).addObserver(this),m7(be(this,Rn),this.options)?yn(this,Qn,cw).call(this):this.updateResult(),yn(this,Qn,p4).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return y4(be(this,Rn),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return y4(be(this,Rn),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,yn(this,Qn,m4).call(this),yn(this,Qn,g4).call(this),be(this,Rn).removeObserver(this)}setOptions(e){const n=this.options,r=be(this,Rn);if(this.options=be(this,Ma).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ko(this.options.enabled,be(this,Rn))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");yn(this,Qn,x4).call(this),be(this,Rn).setOptions(this.options),n._defaulted&&!Hk(this.options,n)&&be(this,Ma).getQueryCache().notify({type:"observerOptionsUpdated",query:be(this,Rn),observer:this});const i=this.hasListeners();i&&g7(be(this,Rn),r,this.options,n)&&yn(this,Qn,cw).call(this),this.updateResult(),i&&(be(this,Rn)!==r||Ko(this.options.enabled,be(this,Rn))!==Ko(n.enabled,be(this,Rn))||uh(this.options.staleTime,be(this,Rn))!==uh(n.staleTime,be(this,Rn)))&&yn(this,Qn,d4).call(this);const s=yn(this,Qn,f4).call(this);i&&(be(this,Rn)!==r||Ko(this.options.enabled,be(this,Rn))!==Ko(n.enabled,be(this,Rn))||s!==be(this,$f))&&yn(this,Qn,h4).call(this,s)}getOptimisticResult(e){const n=be(this,Ma).getQueryCache().build(be(this,Ma),e),r=this.createResult(n,e);return aNe(this,r)&&(ut(this,ia,r),ut(this,Gy,this.options),ut(this,mm,be(this,Rn).state)),r}getCurrentResult(){return be(this,ia)}trackResult(e,n){return new Proxy(e,{get:(r,i)=>(this.trackProp(i),n==null||n(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&be(this,Wu).status==="pending"&&be(this,Wu).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(e){be(this,Yy).add(e)}getCurrentQuery(){return be(this,Rn)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=be(this,Ma).defaultQueryOptions(e),r=be(this,Ma).getQueryCache().build(be(this,Ma),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(e){return yn(this,Qn,cw).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),be(this,ia)))}createResult(e,n){var C;const r=be(this,Rn),i=this.options,s=be(this,ia),a=be(this,mm),l=be(this,Gy),u=e!==r?e.state:be(this,fS),{state:d}=e;let f={...d},h=!1,p;if(n._optimisticResults){const k=this.hasListeners(),M=!k&&m7(e,n),I=k&&g7(e,r,n,i);(M||I)&&(f={...f,...pie(d.data,e.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:m,errorUpdatedAt:x,status:y}=f;p=f.data;let g=!1;if(n.placeholderData!==void 0&&p===void 0&&y==="pending"){let k;s!=null&&s.isPlaceholderData&&n.placeholderData===(l==null?void 0:l.placeholderData)?(k=s.data,g=!0):k=typeof n.placeholderData=="function"?n.placeholderData((C=be(this,Ky))==null?void 0:C.state.data,be(this,Ky)):n.placeholderData,k!==void 0&&(y="success",p=l4(s==null?void 0:s.data,k,n),h=!0)}if(n.select&&p!==void 0&&!g)if(s&&p===(a==null?void 0:a.data)&&n.select===be(this,hS))p=be(this,qy);else try{ut(this,hS,n.select),p=n.select(p),p=l4(s==null?void 0:s.data,p,n),ut(this,qy,p),ut(this,Lf,null)}catch(k){ut(this,Lf,k)}be(this,Lf)&&(m=be(this,Lf),p=be(this,qy),x=Date.now(),y="error");const w=f.fetchStatus==="fetching",v=y==="pending",N=y==="error",S=v&&w,_=p!==void 0,A={status:y,fetchStatus:f.fetchStatus,isPending:v,isSuccess:y==="success",isError:N,isInitialLoading:S,isLoading:S,data:p,dataUpdatedAt:f.dataUpdatedAt,error:m,errorUpdatedAt:x,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:f.dataUpdateCount>0||f.errorUpdateCount>0,isFetchedAfterMount:f.dataUpdateCount>u.dataUpdateCount||f.errorUpdateCount>u.errorUpdateCount,isFetching:w,isRefetching:w&&!v,isLoadingError:N&&!_,isPaused:f.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:N&&_,isStale:rz(e,n),refetch:this.refetch,promise:be(this,Wu),isEnabled:Ko(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const k=R=>{A.status==="error"?R.reject(A.error):A.data!==void 0&&R.resolve(A.data)},M=()=>{const R=ut(this,Wu,A.promise=c4());k(R)},I=be(this,Wu);switch(I.status){case"pending":e.queryHash===r.queryHash&&k(I);break;case"fulfilled":(A.status==="error"||A.data!==I.value)&&M();break;case"rejected":(A.status!=="error"||A.error!==I.reason)&&M();break}}return A}updateResult(){const e=be(this,ia),n=this.createResult(be(this,Rn),this.options);if(ut(this,mm,be(this,Rn).state),ut(this,Gy,this.options),be(this,mm).data!==void 0&&ut(this,Ky,be(this,Rn)),Hk(n,e))return;ut(this,ia,n);const r=()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,s=typeof i=="function"?i():i;if(s==="all"||!s&&!be(this,Yy).size)return!0;const a=new Set(s??be(this,Yy));return this.options.throwOnError&&a.add("error"),Object.keys(be(this,ia)).some(l=>{const c=l;return be(this,ia)[c]!==e[c]&&a.has(c)})};yn(this,Qn,gie).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&yn(this,Qn,p4).call(this)}},Ma=new WeakMap,Rn=new WeakMap,fS=new WeakMap,ia=new WeakMap,mm=new WeakMap,Gy=new WeakMap,Wu=new WeakMap,Lf=new WeakMap,hS=new WeakMap,qy=new WeakMap,Ky=new WeakMap,gm=new WeakMap,xm=new WeakMap,$f=new WeakMap,Yy=new WeakMap,Qn=new WeakSet,cw=function(e){yn(this,Qn,x4).call(this);let n=be(this,Rn).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(la)),n},d4=function(){yn(this,Qn,m4).call(this);const e=uh(this.options.staleTime,be(this,Rn));if($m||be(this,ia).isStale||!a4(e))return;const r=lie(be(this,ia).dataUpdatedAt,e)+1;ut(this,gm,Kp.setTimeout(()=>{be(this,ia).isStale||this.updateResult()},r))},f4=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(be(this,Rn)):this.options.refetchInterval)??!1},h4=function(e){yn(this,Qn,g4).call(this),ut(this,$f,e),!($m||Ko(this.options.enabled,be(this,Rn))===!1||!a4(be(this,$f))||be(this,$f)===0)&&ut(this,xm,Kp.setInterval(()=>{(this.options.refetchIntervalInBackground||nz.isFocused())&&yn(this,Qn,cw).call(this)},be(this,$f)))},p4=function(){yn(this,Qn,d4).call(this),yn(this,Qn,h4).call(this,yn(this,Qn,f4).call(this))},m4=function(){be(this,gm)&&(Kp.clearTimeout(be(this,gm)),ut(this,gm,void 0))},g4=function(){be(this,xm)&&(Kp.clearInterval(be(this,xm)),ut(this,xm,void 0))},x4=function(){const e=be(this,Ma).getQueryCache().build(be(this,Ma),this.options);if(e===be(this,Rn))return;const n=be(this,Rn);ut(this,Rn,e),ut(this,fS,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},gie=function(e){Gi.batch(()=>
40{e.listeners&&this.listeners.forEach(n=>{n(be(this,ia))}),be(this,Ma).getQueryCache().notify({query:be(this,Rn),type:"observerResultsUpdated"})})},Hte);function sNe(t,e){return Ko(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function m7(t,e){return sNe(t,e)||t.state.data!==void 0&&y4(t,e,e.refetchOnMount)}function y4(t,e,n){if(Ko(e.enabled,t)!==!1&&uh(e.staleTime,t)!=="static"){const r=typeof n=="function"?n(t):n;return r==="always"||r!==!1&&rz(t,e)}return!1}function g7(t,e,n,r){return(t!==e||Ko(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&rz(t,n)}function rz(t,e){return Ko(e.enabled,t)!==!1&&t.isStaleByTime(uh(e.staleTime,t))}function aNe(t,e){return!Hk(t.getCurrentResult(),e)}function Gk(t){return{onFetch:(e,n)=>{var d,f,h,p,m;const r=e.options,i=(h=(f=(d=e.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:h.direction,s=((p=e.state.data)==null?void 0:p.pages)||[],a=((m=e.state.data)==null?void 0:m.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const u=async()=>{let x=!1;const y=v=>{JSe(v,()=>e.signal,()=>x=!0)},g=uie(e.options,e.fetchOptions),w=async(v,N,S)=>{if(x)return Promise.reject();if(N==null&&v.pages.length)return Promise.resolve(v);const j=(()=>{const M={client:e.client,queryKey:e.queryKey,pageParam:N,direction:S?"backward":"forward",meta:e.options.meta};return y(M),M})(),A=await g(j),{maxPages:C}=e.options,k=S?QSe:XSe;return{pages:k(v.pages,A,C),pageParams:k(v.pageParams,N,C)}};if(i&&s.length){const v=i==="backward",N=v?xie:v4,S={pages:s,pageParams:a},_=N(r,S);l=await w(S,_,v)}else{const v=t??s.length;do{const N=c===0?a[0]??r.initialPageParam:v4(r,l);if(c>0&&N==null)break;l=await w(l,N),c++}while(c<v)}return l};e.options.persister?e.fetchFn=()=>{var x,y;return(y=(x=e.options).persister)==null?void 0:y.call(x,u,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=u}}}function v4(t,{pages:e,pageParams:n}){const r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,n[r],n):void 0}function xie(t,{pages:e,pageParams:n}){var r;return e.length>0?(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,n[0],n):void 0}function oNe(t,e){return e?v4(t,e)!=null:!1}function lNe(t,e){return!e||!t.getPreviousPageParam?!1:xie(t,e)!=null}var cNe=class extends mie{constructor(t,e){super(t,e)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(t){super.setOptions({...t,behavior:Gk()})}getOptimisticResult(t){return t.behavior=Gk(),super.getOptimisticResult(t)}fetchNextPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"backward"}}})}createResult(t,e){var m,x;const{state:n}=t,r=super.createResult(t,e),{isFetching:i,isRefetching:s,isError:a,isRefetchError:l}=r,c=(x=(m=n.fetchMeta)==null?void 0:m.fetchMore)==null?void 0:x.direction,u=a&&c==="forward",d=i&&c==="forward",f=a&&c==="backward",h=i&&c==="backward";return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:oNe(e,n.data),hasPreviousPage:lNe(e,n.data),isFetchNextPageError:u,isFetchingNextPage:d,isFetchPreviousPageError:f,isFetchingPreviousPage:h,isRefetchError:l&&!u&&!f,isRefetching:s&&!d&&!h}}},pS,Rc,sa,ym,Ic,hf,Wte,uNe=(Wte=class extends hie{constructor(e){super();Rt(this,Ic);Rt(this,pS);Rt(this,Rc);Rt(this,sa);Rt(this,ym);ut(this,pS,e.client),this.mutationId=e.mutationId,ut(this,sa,e.mutationCache),ut(this,Rc,[]),this.state=e.state||yie(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){be(this,Rc).includes(e)||(be(this,Rc).push(e),this.clearGcTimeout(),be(this,sa).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){ut(this,Rc,be(this,Rc).filter(n=>n!==e)),this.scheduleGc(),be(this,sa).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){be(this,Rc).length||(this.state.status==="pending"?this.scheduleGc():be(this,sa).remove(this))}continue(){var e;return((e=be(this,ym))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var a,l,c,u,d,f,h,p,m,x,y,g,w,v,N,S,_,j,A,C;const n=()=>{yn(this,Ic,hf).call(this,{type:"continue"})},r={client:be(this,pS),meta:this.options.meta,mutationKey:this.options.mutationKey};ut(this,ym,fie({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(k,M)=>{yn(this,Ic,hf).call(this,{type:"failed",failureCount:k,error:M})},onPause:()=>{yn(this,Ic,hf).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>be(this,sa).canRun(this)}));const i=this.state.status==="pending",s=!be(this,ym).canStart();try{if(i)n();else{yn(this,Ic,hf).call(this,{type:"pending",variables:e,isPaused:s}),await((l=(a=be(this,sa).config).onMutate)==null?void 0:l.call(a,e,this,r));const M=await((u=(c=this.options).onMutate)==null?void 0:u.call(c,e,r));M!==this.state.context&&yn(this,Ic,hf).call(this,{type:"pending",context:M,variables:e,isPaused:s})}const k=await be(this,ym).start();return await((f=(d=be(this,sa).config).onSuccess)==null?void 0:f.call(d,k,e,this.state.context,this,r)),await((p=(h=this.options).onSuccess)==null?void 0:p.call(h,k,e,this.state.context,r)),await((x=(m=be(this,sa).config).onSettled)==null?void 0:x.call(m,k,null,this.state.variables,this.state.context,this,r)),await((g=(y=this.options).onSettled)==null?void 0:g.call(y,k,null,e,this.state.context,r)),yn(this,Ic,hf).call(this,{type:"success",data:k}),k}catch(k){try{await((v=(w=be(this,sa).config).onError)==null?void 0:v.call(w,k,e,this.state.context,this,r))}catch(M){Promise.reject(M)}try{await((S=(N=this.options).onError)==null?void 0:S.call(N,k,e,this.state.context,r))}catch(M){Promise.reject(M)}try{await((j=(_=be(this,sa).config).onSettled)==null?void 0:j.call(_,void 0,k,this.state.variables,this.state.context,this,r))}catch(M){Promise.reject(M)}try{await((C=(A=this.options).onSettled)==null?void 0:C.call(A,void 0,k,e,this.state.context,r))}catch(M){Promise.reject(M)}throw yn(this,Ic,hf).call(this,{type:"error",error:k}),k}finally{be(this,sa).runNext(this)}}},pS=new WeakMap,Rc=new WeakMap,sa=new WeakMap,ym=new WeakMap,Ic=new WeakSet,hf=function(e){const n=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};
40case"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=n(this.state),Gi.batch(()=>{be(this,Rc).forEach(r=>{r.onMutationUpdate(e)}),be(this,sa).notify({mutation:this,type:"updated",action:e})})},Wte);function yie(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Gu,$l,mS,Gte,dNe=(Gte=class extends w0{constructor(e={}){super();Rt(this,Gu);Rt(this,$l);Rt(this,mS);this.config=e,ut(this,Gu,new Set),ut(this,$l,new Map),ut(this,mS,0)}build(e,n,r){const i=new uNe({client:e,mutationCache:this,mutationId:++NN(this,mS)._,options:e.defaultMutationOptions(n),state:r});return this.add(i),i}add(e){be(this,Gu).add(e);const n=BN(e);if(typeof n=="string"){const r=be(this,$l).get(n);r?r.push(e):be(this,$l).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(be(this,Gu).delete(e)){const n=BN(e);if(typeof n=="string"){const r=be(this,$l).get(n);if(r)if(r.length>1){const i=r.indexOf(e);i!==-1&&r.splice(i,1)}else r[0]===e&&be(this,$l).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=BN(e);if(typeof n=="string"){const r=be(this,$l).get(n),i=r==null?void 0:r.find(s=>s.state.status==="pending");return!i||i===e}else return!0}runNext(e){var r;const n=BN(e);if(typeof n=="string"){const i=(r=be(this,$l).get(n))==null?void 0:r.find(s=>s!==e&&s.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Gi.batch(()=>{be(this,Gu).forEach(e=>{this.notify({type:"removed",mutation:e})}),be(this,Gu).clear(),be(this,$l).clear()})}getAll(){return Array.from(be(this,Gu))}find(e){const n={exact:!0,...e};return this.getAll().find(r=>u7(n,r))}findAll(e={}){return this.getAll().filter(n=>u7(e,n))}notify(e){Gi.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return Gi.batch(()=>Promise.all(e.map(n=>n.continue().catch(la))))}},Gu=new WeakMap,$l=new WeakMap,mS=new WeakMap,Gte);function BN(t){var e;return(e=t.options.scope)==null?void 0:e.id}var qu,Ff,Pa,Ku,gd,UC,b4,qte,fNe=(qte=class extends w0{constructor(n,r){super();Rt(this,gd);Rt(this,qu);Rt(this,Ff);Rt(this,Pa);Rt(this,Ku);ut(this,qu,n),this.setOptions(r),this.bindMethods(),yn(this,gd,UC).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var i;const r=this.options;this.options=be(this,qu).defaultMutationOptions(n),Hk(this.options,r)||be(this,qu).getMutationCache().notify({type:"observerOptionsUpdated",mutation:be(this,Pa),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Fm(r.mutationKey)!==Fm(this.options.mutationKey)?this.reset():((i=be(this,Pa))==null?void 0:i.state.status)==="pending"&&be(this,Pa).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=be(this,Pa))==null||n.removeObserver(this)}onMutationUpdate(n){yn(this,gd,UC).call(this),yn(this,gd,b4).call(this,n)}getCurrentResult(){return be(this,Ff)}reset(){var n;(n=be(this,Pa))==null||n.removeObserver(this),ut(this,Pa,void 0),yn(this,gd,UC).call(this),yn(this,gd,b4).call(this)}mutate(n,r){var i;return ut(this,Ku,r),(i=be(this,Pa))==null||i.removeObserver(this),ut(this,Pa,be(this,qu).getMutationCache().build(be(this,qu),this.options)),be(this,Pa).addObserver(this),be(this,Pa).execute(n)}},qu=new WeakMap,Ff=new WeakMap,Pa=new WeakMap,Ku=new WeakMap,gd=new WeakSet,UC=function(){var r;const n=((r=be(this,Pa))==null?void 0:r.state)??yie();ut(this,Ff,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},b4=function(n){Gi.batch(()=>{var r,i,s,a,l,c,u,d;if(be(this,Ku)&&this.hasListeners()){const f=be(this,Ff).variables,h=be(this,Ff).context,p={client:be(this,qu),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(i=(r=be(this,Ku)).onSuccess)==null||i.call(r,n.data,f,h,p)}catch(m){Promise.reject(m)}try{(a=(s=be(this,Ku)).onSettled)==null||a.call(s,n.data,null,f,h,p)}catch(m){Promise.reject(m)}}else if((n==null?void 0:n.type)==="error"){try{(c=(l=be(this,Ku)).onError)==null||c.call(l,n.error,f,h,p)}catch(m){Promise.reject(m)}try{(d=(u=be(this,Ku)).onSettled)==null||d.call(u,void 0,n.error,f,h,p)}catch(m){Promise.reject(m)}}}
vendor: 6,522 bytes, line 40
40this.listeners.forEach(f=>{f(be(this,Ff))})})},qte),Dc,Kte,hNe=(Kte=class extends w0{constructor(e={}){super();Rt(this,Dc);this.config=e,ut(this,Dc,new Map)}build(e,n,r){const i=n.queryKey,s=n.queryHash??ZU(i,n);let a=this.get(s);return a||(a=new iNe({client:e,queryKey:i,queryHash:s,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(a)),a}add(e){be(this,Dc).has(e.queryHash)||(be(this,Dc).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=be(this,Dc).get(e.queryHash);n&&(e.destroy(),n===e&&be(this,Dc).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Gi.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return be(this,Dc).get(e)}getAll(){return[...be(this,Dc).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>c7(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>c7(e,r)):n}notify(e){Gi.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){Gi.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Gi.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Dc=new WeakMap,Kte),li,Uf,zf,Xy,Qy,Bf,Jy,Zy,Yte,pNe=(Yte=class{constructor(t={}){Rt(this,li);Rt(this,Uf);Rt(this,zf);Rt(this,Xy);Rt(this,Qy);Rt(this,Bf);Rt(this,Jy);Rt(this,Zy);ut(this,li,t.queryCache||new hNe),ut(this,Uf,t.mutationCache||new dNe),ut(this,zf,t.defaultOptions||{}),ut(this,Xy,new Map),ut(this,Qy,new Map),ut(this,Bf,0)}mount(){NN(this,Bf)._++,be(this,Bf)===1&&(ut(this,Jy,nz.subscribe(async t=>{t&&(await this.resumePausedMutations(),be(this,li).onFocus())})),ut(this,Zy,Wk.subscribe(async t=>{t&&(await this.resumePausedMutations(),be(this,li).onOnline())})))}unmount(){var t,e;NN(this,Bf)._--,be(this,Bf)===0&&((t=be(this,Jy))==null||t.call(this),ut(this,Jy,void 0),(e=be(this,Zy))==null||e.call(this),ut(this,Zy,void 0))}isFetching(t){return be(this,li).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return be(this,Uf).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=be(this,li).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=be(this,li).build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(uh(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return be(this,li).findAll(t).map(({queryKey:e,state:n})=>{const r=n.data;return[e,r]})}setQueryData(t,e,n){const r=this.defaultQueryOptions({queryKey:t}),i=be(this,li).get(r.queryHash),s=i==null?void 0:i.state.data,a=qSe(e,s);if(a!==void 0)return be(this,li).build(this,r).setData(a,{...n,manual:!0})}setQueriesData(t,e,n){return Gi.batch(()=>be(this,li).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=be(this,li).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=be(this,li);Gi.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=be(this,li);return Gi.batch(()=>(n.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=Gi.batch(()=>be(this,li).findAll(t).map(i=>i.cancel(n)));return Promise.all(r).then(la).catch(la)}invalidateQueries(t,e={}){return Gi.batch(()=>(be(this,li).findAll(t).forEach(n=>{n.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const n={...e,cancelRefetch:e.cancelRefetch??!0},r=Gi.batch(()=>be(this,li).findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let s=i.fetch(void 0,n);return n.throwOnError||(s=s.catch(la)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(la)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=be(this,li).build(this,e);return n.isStaleByTime(uh(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(la).catch(la)}fetchInfiniteQuery(t){return t.behavior=Gk(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(la).catch(la)}ensureInfiniteQueryData(t){return t.behavior=Gk(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return Wk.isOnline()?be(this,Uf).resumePausedMutations():Promise.resolve()}getQueryCache(){return be(this,li)}getMutationCache(){return be(this,Uf)}getDefaultOptions(){return be(this,zf)}setDefaultOptions(t){ut(this,zf,t)}setQueryDefaults(t,e){be(this,Xy).set(Fm(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...be(this,Xy).values()],n={};return e.forEach(r=>{O1(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){be(this,Qy).set(Fm(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...be(this,Qy).values()],n={};return e.forEach(r=>{O1(t,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...be(this,zf).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=ZU(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===ez&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...be(this,zf).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){be(this,li).clear(),be(this,Uf).clear()}},li=new WeakMap,Uf=new WeakMap,zf=new WeakMap,Xy=new WeakMap,Qy=new WeakMap,Bf=new WeakMap,Jy=new WeakMap,Zy=new WeakMap,Yte),vie=b.createContext(void 0),Sa=t=>{const e=b.useContext(vie);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},mNe=({client:t,children:e})=>(b.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),o.jsx(vie.Provider,{value:t,children:e})),bie=b.createContext(!1),gNe=()=>b.useContext(bie);bie.Provider;function xNe(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var yNe=b.createContext(xNe()),vNe=()=>b.useContext(yNe),bNe=(t,e,n)=>{const r=n!=null&&n.state.error&&typeof t.throwOnError=="function"?tz(t.throwOnError,[n.state.error,n]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOn
40Mount=!1))},wNe=t=>{b.useEffect(()=>{t.clearReset()},[t])},_Ne=({result:t,errorResetBoundary:e,throwOnError:n,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||tz(n,[t.error,r])),SNe=t=>{if(t.suspense){const n=i=>i==="static"?i:Math.max(i??1e3,1e3),r=t.staleTime;t.staleTime=typeof r=="function"?(...i)=>n(r(...i)):n(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},NNe=(t,e)=>t.isLoading&&t.isFetching&&!e,jNe=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,x7=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function wie(t,e,n){var h,p,m,x;const r=gNe(),i=vNe(),s=Sa(),a=s.defaultQueryOptions(t);(p=(h=s.getDefaultOptions().queries)==null?void 0:h._experimental_beforeQuery)==null||p.call(h,a);const l=s.getQueryCache().get(a.queryHash);a._optimisticResults=r?"isRestoring":"optimistic",SNe(a),bNe(a,i,l),wNe(i);const c=!s.getQueryCache().get(a.queryHash),[u]=b.useState(()=>new e(s,a)),d=u.getOptimisticResult(a),f=!r&&t.subscribed!==!1;if(b.useSyncExternalStore(b.useCallback(y=>{const g=f?u.subscribe(Gi.batchCalls(y)):la;return u.updateResult(),g},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),b.useEffect(()=>{u.setOptions(a)},[a,u]),jNe(a,d))throw x7(a,u,i);if(_Ne({result:d,errorResetBoundary:i,throwOnError:a.throwOnError,query:l,suspense:a.suspense}))throw d.error;if((x=(m=s.getDefaultOptions().queries)==null?void 0:m._experimental_afterQuery)==null||x.call(m,a,d),a.experimental_prefetchInRender&&!$m&&NNe(d,r)){const y=c?x7(a,u,i):l==null?void 0:l.promise;y==null||y.catch(la).finally(()=>{u.updateResult()})}return a.notifyOnChangeProps?d:u.trackResult(d)}function En(t,e){return wie(t,mie)}function un(t,e){const n=Sa(),[r]=b.useState(()=>new fNe(n,t));b.useEffect(()=>{r.setOptions(t)},[r,t]);const i=b.useSyncExternalStore(b.useCallback(a=>r.subscribe(Gi.batchCalls(a)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),s=b.useCallback((a,l)=>{r.mutate(a,l).catch(la)},[r]);if(i.error&&tz(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:s,mutateAsync:i.mutate}}function CNe(t,e){return wie(t,cNe)}/**
41 * @remix-run/router v1.23.2
42 *
43 * Copyright (c) Remix Software Inc.
44 *
45 * This source code is licensed under the MIT license found in the
46 * LICENSE.md file in the root directory of this source tree.
47 *
48 * @license MIT
49 */function R1(){return R1=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},R1.apply(this,arguments)}var Gf;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(Gf||(Gf={}));const y7="popstate";function kNe(t){t===void 0&&(t={});function e(r,i){let{pathname:s,search:a,hash:l}=r.location;return w4("",{pathname:s,search:a,hash:l},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function n(r,i){return typeof i=="string"?i:qk(i)}return ANe(e,n,null,t)}function xi(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function iz(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function ENe(){return Math.random().toString(36).substr(2,8)}function v7(t,e){return{usr:t.state,key:t.key,idx:e}}function w4(t,e,n,r){return n===void 0&&(n=null),R1({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?_0(e):e,{state:n,key:e&&e.key||r||ENe()})}function qk(t){let{pathname:e="/",search:n="",hash:r=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function _0(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}function ANe(t,e,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:s=!1}=r,a=i.history,l=Gf.Pop,c=null,u=d();u==null&&(u=0,a.replaceState(R1({},a.state,{idx:u}),""));function d(){return(a.state||{idx:null}).idx}function f(){l=Gf.Pop;let y=d(),g=y==null?null:y-u;u=y,c&&c({action:l,location:x.location,delta:g})}function h(y,g){l=Gf.Push;let w=w4(x.location,y,g);u=d()+1;let v=v7(w,u),N=x.createHref(w);try{a.pushState(v,"",N)}catch(S){if(S instanceof DOMException&&S.name==="DataCloneError")throw S;i.location.assign(N)}s&&c&&c({action:l,location:x.location,delta:1})}function p(y,g){l=Gf.Replace;let w=w4(x.location,y,g);u=d();let v=v7(w,u),N=x.createHref(w);a.replaceState(v,"",N),s&&c&&c({action:l,location:x.location,delta:0})}function m(y){let g=i.location.origin!=="null"?i.location.origin:i.location.href,w=typeof y=="string"?y:qk(y);return w=w.replace(/ $/,"%20"),xi(g,"No window.location.(origin|href) available to create URL for href: "+w),new URL(w,g)}let x={get action(){return l},get location(){return t(i,a)},listen(y){if(c)throw new Error("A history only accepts one active listener");return i.addEventListener(y7,f),c=y,()=>{i.removeEventListener(y7,f),c=null}},createHref(y){return e(i,y)},createURL:m,encodeLocation(y){let g=m(y);return{pathname:g.pathname,search:g.search,hash:g.hash}},push:h,replace:p,go(y){return a.go(y)}};return x}var b7;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(b7||(b7={}));function TNe(t,e,n){return n===void 0&&(n="/"),MNe(t,e,n)}function MNe(t,e,n,r){let i=typeof e=="string"?_0(e):e,s=sz(i.pathname||"/",n);if(s==null)return null;let a=_ie(t);PNe(a);let l=null;for(let c=0;l==null&&c<a.length;++c){let u=HNe(s);l=zNe(a[c],u)}return l}function _ie(t,e,n,r){e===void 0&&(e=[]),n===void 0&&(n=[]),r===void 0&&(r="");let i=(s,a,l)=>{let c={relativePath:l===void 0?s.path||"":l,caseSensitive:s.caseSensitive===!0,childrenIndex:a,route:s};c.relativePath.startsWith("/")&&(xi(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not val
49id. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let u=dh([r,c.relativePath]),d=n.concat(c);s.children&&s.children.length>0&&(xi(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),_ie(s.children,e,d,u)),!(s.path==null&&!s.index)&&e.push({path:u,score:FNe(u,s.index),routesMeta:d})};return t.forEach((s,a)=>{var l;if(s.path===""||!((l=s.path)!=null&&l.includes("?")))i(s,a);else for(let c of Sie(s.path))i(s,a,c)}),e}function Sie(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,i=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return i?[s,""]:[s];let a=Sie(r.join("/")),l=[];return l.push(...a.map(c=>c===""?s:[s,c].join("/"))),i&&l.push(...a),l.map(c=>t.startsWith("/")&&c===""?"/":c)}function PNe(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:UNe(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const ONe=/^:[\w-]+$/,RNe=3,INe=2,DNe=1,LNe=10,$Ne=-2,w7=t=>t==="*";function FNe(t,e){let n=t.split("/"),r=n.length;return n.some(w7)&&(r+=$Ne),e&&(r+=INe),n.filter(i=>!w7(i)).reduce((i,s)=>i+(ONe.test(s)?RNe:s===""?DNe:LNe),r)}function UNe(t,e){return t.length===e.length&&t.slice(0,-1).every((r,i)=>r===e[i])?t[t.length-1]-e[e.length-1]:0}function zNe(t,e,n){let{routesMeta:r}=t,i={},s="/",a=[];for(let l=0;l<r.length;++l){let c=r[l],u=l===r.length-1,d=s==="/"?e:e.slice(s.length)||"/",f=BNe({path:c.relativePath,caseSensitive:c.caseSensitive,end:u},d),h=c.route;if(!f)return null;
vendor: 7,342 bytes, lines 49-58
49Object.assign(i,f.params),a.push({params:i,pathname:dh([s,f.pathname]),pathnameBase:YNe(dh([s,f.pathnameBase])),route:h}),f.pathnameBase!=="/"&&(s=dh([s,f.pathnameBase]))}return a}function BNe(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,r]=VNe(t.path,t.caseSensitive,t.end),i=e.match(n);if(!i)return null;let s=i[0],a=s.replace(/(.)\/+$/,"$1"),l=i.slice(1);return{params:r.reduce((u,d,f)=>{let{paramName:h,isOptional:p}=d;if(h==="*"){let x=l[f]||"";a=s.slice(0,s.length-x.length).replace(/(.)\/+$/,"$1")}const m=l[f];return p&&!m?u[h]=void 0:u[h]=(m||"").replace(/%2F/g,"/"),u},{}),pathname:s,pathnameBase:a,pattern:t}}function VNe(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),iz(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let r=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(a,l,c)=>(r.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(r.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),r]}function HNe(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return iz(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function sz(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}const WNe=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,GNe=t=>WNe.test(t);function qNe(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:i=""}=typeof t=="string"?_0(t):t,s;if(n)if(GNe(n))s=n;else{if(n.includes("//")){let a=n;n=n.replace(/\/\/+/g,"/"),iz(!1,"Pathnames cannot have embedded double slashes - normalizing "+(a+" -> "+n))}n.startsWith("/")?s=_7(n.substring(1),"/"):s=_7(n,e)}else s=e;return{pathname:s,search:XNe(r),hash:QNe(i)}}function _7(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function XO(t,e,n,r){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(r)+"].  Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function KNe(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function az(t,e){let n=KNe(t);return e?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function oz(t,e,n,r){r===void 0&&(r=!1);let i;typeof t=="string"?i=_0(t):(i=R1({},t),xi(!i.pathname||!i.pathname.includes("?"),XO("?","pathname","search",i)),xi(!i.pathname||!i.pathname.includes("#"),XO("#","pathname","hash",i)),xi(!i.search||!i.search.includes("#"),XO("#","search","hash",i)));let s=t===""||i.pathname==="",a=s?"/":i.pathname,l;if(a==null)l=n;else{let f=e.length-1;if(!r&&a.startsWith("..")){let h=a.split("/");for(;h[0]==="..";)h.shift(),f-=1;i.pathname=h.join("/")}l=f>=0?e[f]:"/"}let c=qNe(i,l),u=a&&a!=="/"&&a.endsWith("/"),d=(s||a===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const dh=t=>t.join("/").replace(/\/\/+/g,"/"),YNe=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),XNe=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,QNe=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function JNe(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const Nie=["post","put","patch","delete"];new Set(Nie);const ZNe=["get",...Nie];new Set(ZNe);/**
50 * React Router v6.30.3
51 *
52 * Copyright (c) Remix Software Inc.
53 *
54 * This source code is licensed under the MIT license found in the
55 * LICENSE.md file in the root directory of this source tree.
56 *
57 * @license MIT
58 */function I1(){return I1=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},I1.apply(this,arguments)}const lz=b.createContext(null),eje=b.createContext(null),qh=b.createContext(null),dT=b.createContext(null),mu=b.createContext({outlet:null,matches:[],isDataRoute:!1}),jie=b.createContext(null);function tje(t,e){let{relative:n}=e===void 0?{}:e;S0()||xi(!1);let{basename:r,navigator:i}=b.useContext(qh),{hash:s,pathname:a,search:l}=kie(t,{relative:n}),c=a;return r!=="/"&&(c=a==="/"?r:dh([r,a])),i.createHref({pathname:c,search:l,hash:s})}function S0(){return b.useContext(dT)!=null}function Ya(){return S0()||xi(!1),b.useContext(dT).location}function Cie(t){b.useContext(qh).static||b.useLayoutEffect(t)}function Nr(){let{isDataRoute:t}=b.useContext(mu);return t?gje():nje()}function nje(){S0()||xi(!1);let t=b.useContext(lz),{basename:e,future:n,navigator:r}=b.useContext(qh),{matches:i}=b.useContext(mu),{pathname:s}=Ya(),a=JSON.stringify(az(i,n.v7_relativeSplatPath)),l=b.useRef(!1);return Cie(()=>{l.current=!0}),b.useCallback(function(u,d){if(d===void 0&&(d={}),!l.current)return;if(typeof u=="number"){r.go(u);return}let f=oz(u,JSON.parse(a),s,d.relative==="path");t==null&&e!=="/"&&(f.pathname=f.pathname==="/"?e:dh([e,f.pathname])),(d.replace?r.replace:r.push)(f,d.state,d)},[e,r,a,s,t])}const rje=b.createContext(null);function ije(t){let e=b.useContext(mu).outlet;return e&&b.createElement(rje.Provider,{value:t},e)}function Gr(){let{matches:t}=b.useContext(mu),e=t[t.length-1];return e?e.params:{}}function kie(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=b.useContext(qh),{matches:i}=b.useContext(mu),{pathname:s}=Ya(),a=JSON.stringify(az(i,r.v7_relativeSplatPath));return b.useMemo(()=>oz(t,JSON.parse(a),s,n==="path"),[t,a,s,n])}function sje(t,e){return aje(t,e)}function aje(t,e,n,r){S0()||xi(!1);let{navigator:i}=b.useContext(qh),{matches:s}=b.useContext(mu),a=s[s.length-1],l=a?a.params:{};a&&a.pathname;let c=a?a.pathnameBase:"/";a&&a.route;let u=Ya(),d;if(e){var f;let y=typeof e=="string"?_0(e):e;c==="/"||(f=y.pathname)!=null&&f.startsWith(c)||xi(!1),d=y}else d=u;let h=d.pathname||"/",p=h;if(c!=="/"){let y=c.replace(/^\//,"").split("/");p="/"+h.replace(/^\//,"").split("/").slice(y.length).join("/")}let m=TNe(t,{pathname:p}),x=dje(m&&m.map(y=>Object.assign({},y,{params:Object.assign({},l,y.params),pathname:dh([c,i.encodeLocation?i.encodeLocation(y.pathname).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?c:dh([c,i.encodeLocation?i.encodeLocation(y.pathnameBase).pathname:y.pathnameBase])})),s,n,r);return e&&x?b.createElement(dT.Provider,{value:{location:I1({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:Gf.Pop}},x):x}function oje(){let t=mje(),e=JNe(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application 
58Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},e),n?b.createElement("pre",{style:i},n):null,null)}const lje=b.createElement(oje,null);class cje extends b.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,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?b.createElement(mu.Provider,{value:this.props.routeContext},b.createElement(jie.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function uje(t){let{routeContext:e,match:n,children:r}=t,i=b.useContext(lz);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),b.createElement(mu.Provider,{value:e},r)}function dje(t,e,n,r){var i;if(e===void 0&&(e=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var s;if(!n)return null;if(n.errors)t=n.matches;else if((s=r)!=null&&s.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let a=t,l=(i=n)==null?void 0:i.errors;if(l!=null){let d=a.findIndex(f=>f.route.id&&(l==null?void 0:l[f.route.id])!==void 0);d>=0||xi(!1),a=a.slice(0,Math.min(a.length,d+1))}let c=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d<a.length;d++){let f=a[d];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(u=d),f.route.id){let{loaderData:h,errors:p}=n,m=f.route.loader&&h[f.route.id]===void 0&&(!p||p[f.route.id]===void 0);if(f.route.lazy||m){c=!0,u>=0?a=a.slice(0,u+1):a=[a[0]];break}}}return a.reduceRight((d,f,h)=>{let p,m=!1,x=null,y=null;n&&(p=l&&f.route.id?l[f.route.id]:void 0,x=f.route.errorElement||lje,c&&(u<0&&h===0?(xje("route-fallback"),m=!0,y=null):u===h&&(m=!0,y=f.route.hydrateFallbackElement||null)));let g=e.concat(a.slice(0,h+1)),w=()=>{let v;return p?v=x:m?v=y:f.route.Component?v=b.createElement(f.route.Component,null):f.route.element?v=f.route.element:v=d,b.createElement(uje,{match:f,routeContext:{outlet:d,matches:g,isDataRoute:n!=null},children:v})};return n&&(f.route.ErrorBoundary||f.route.errorElement||h===0)?b.createElement(cje,{location:n.location,revalidation:n.revalidation,component:x,error:p,children:w(),routeContext:{outlet:null,matches:g,isDataRoute:!0}}):w()},null)}var Eie=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(Eie||{}),Aie=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(Aie||{});function fje(t){let e=b.useContext(lz);return e||xi(!1),e}function hje(t){let e=b.useContext(eje);return e||xi(!1),e}function pje(t){let e=b.useContext(mu);return e||xi(!1),e}function Tie(t){let e=pje(),n=e.matches[e.matches.length-1];return n.route.id||xi(!1),n.route.id}function mje(){var t;let e=b.useContext(jie),n=hje(),r=Tie();return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function gje(){let{router:t}=fje(Eie.UseNavigateStable),e=Tie(Aie.UseNavigateStable),n=b.useRef(!1);return Cie(()=>{n.current=!0}),b.useCallback(function(i,s){s===void 0&&(s={}),n.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,I1({fromRouteId:e},s)))},[t,e])}const S7={};function xje(t,e,n){S7[t]||(S7[t]=!0)}function yje(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function Ju(t){let{to:e,replace:n,state:r,relative:i}=t;S0()||xi(!1);let{future:s,static:a}=b.useContext(qh),{matches:l}=b.useContext(mu),{pathname:c}=Ya(),u=Nr(),d=oz(e,az(l,s.v7_relativeSplatPath),c,i==="path"),f=JSON.stringify(d);return b.useEffect(()=>u(JSON.parse(f),{replace:n,state:r,relative:i}),[u,f,i,n,r]),null}function fT(t){return ije(t.context)}function kt(t){xi(!1)}function vje(t){let{basename:e="/",children:n=null,location:r,navigationType:i=Gf.Pop,navigator:s,static:a=!1,future:l}=t;S0()&&xi(!1);let c=e.replace(/^\/*/,"/"),u=b.useMemo(()=>({basename:c,navigator:s,static:a,future:I1({v7_relativeSplatPath:!1},l)}),[c,l,s,a]);typeof r=="string"&&(r=_0(r));let{pathname:d="/",search:f="",hash:h="",state:p=null,key:m="default"}=r,x=b.useMemo(()=>{let y=sz(d,c);return y==null?null:{location:{pathname:y,search:f,hash:h,state:p,key:m},navigationType:i}},[c,d,f,h,p,m,i]);return x==null?null:b.createElement(qh.Provider,{value:u},b.createElement(dT.Provider,{children:n,value:x}))}function bje(t){let{children:e,location:n}=t;return sje(_4(e),n)}new Promise(()=>{});function _4(t,e){e===void 0&&(e=[]);let n=[];
58return b.Children.forEach(t,(r,i)=>{if(!b.isValidElement(r))return;let s=[...e,i];if(r.type===b.Fragment){n.push.apply(n,_4(r.props.children,s));return}r.type!==kt&&xi(!1),!r.props.index||!r.props.children||xi(!1);let a={id:r.props.id||s.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=_4(r.props.children,s)),n.push(a)}),n}/**
59 * React Router DOM v6.30.3
60 *
61 * Copyright (c) Remix Software Inc.
62 *
63 * This source code is licensed under the MIT license found in the
64 * LICENSE.md file in the root directory of this source tree.
65 *
66 * @license MIT
67 */function S4(){return S4=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},S4.apply(this,arguments)}function wje(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}function _je(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function Sje(t,e){return t.button===0&&(!e||e==="_self")&&!_je(t)}function N4(t){return t===void 0&&(t=""),new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let r=t[n];return e.concat(Array.isArray(r)?r.map(i=>[n,i]):[[n,r]])},[]))}function Nje(t,e){let n=N4(t);return e&&e.forEach((r,i)=>{n.has(i)||e.getAll(i).forEach(s=>{n.append(i,s)})}),n}const jje=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],Cje="6";try{window.__reactRouterVersion=Cje}catch{}const kje="startTransition",N7=YA[kje];function Eje(t){let{basename:e,children:n,future:r,window:i}=t,s=b.useRef();s.current==null&&(s.current=kNe({window:i,v5Compat:!0}));let a=s.current,[l,c]=b.useState({action:a.action,location:a.location}),{v7_startTransition:u}=r||{},d=b.useCallback(f=>{u&&N7?N7(()=>c(f)):c(f)},[c,u]);return b.useLayoutEffect(()=>a.listen(d),[a,d]),b.useEffect(()=>yje(r),[r]),b.createElement(vje,{basename:e,children:n,location:l.location,navigationType:l.action,navigator:a,future:r})}const Aje=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Tje=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Mt=b.forwardRef(function(e,n){let{onClick:r,relative:i,reloadDocument:s,replace:a,state:l,target:c,to:u,preventScrollReset:d,viewTransition:f}=e,h=wje(e,jje),{basename:p}=b.useContext(qh),m,x=!1;if(typeof u=="string"&&Tje.test(u)&&(m=u,Aje))try{let v=new URL(window.location.href),N=u.startsWith("//")?new URL(v.protocol+u):new URL(u),S=sz(N.pathname,p);N.origin===v.origin&&S!=null?u=S+N.search+N.hash:x=!0}catch{}let y=tje(u,{relative:i}),g=Mje(u,{replace:a,state:l,target:c,preventScrollReset:d,relative:i,viewTransition:f});function w(v){r&&r(v),v.defaultPrevented||g(v)}return b.createElement("a",S4({},h,{href:m||y,onClick:x||s?r:w,ref:n,target:c}))});var j7;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(j7||(j7={}));var C7;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(C7||(C7={}));function Mje(t,e){let{target:n,replace:r,state:i,preventScrollReset:s,relative:a,viewTransition:l}=e===void 0?{}:e,c=Nr(),u=Ya(),d=kie(t,{relative:a});return b.useCallback(f=>{if(Sje(f,n)){f.preventDefault();let h=r!==void 0?r:qk(u)===qk(d);c(t,{replace:h,state:i,preventScrollReset:s,relative:a,viewTransition:l})}},[u,c,d,r,i,n,t,s,a,l])}function N0(t){let e=b.useRef(N4(t)),n=b.useRef(!1),r=Ya(),i=b.useMemo(()=>Nje(r.search,n.current?null:e.current),[r.search]),s=Nr(),a=b.useCallback((l,c)=>{const u=N4(typeof l=="function"?l(i):l);n.current=!0,s("?"+u,c)},[s,i]);return[i,a]}var Pje=t=>{switch(t){case"success":return Ije;case"info":return Lje;case"warning":return Dje;case"error":return $je;default:return null}},Oje=Array(12).fill(0),Rje=({visible:t,className:e})=>te.createElement("div",{className:["sonner-loading-wrapper",e].filter(
67Boolean).join(" "),"data-visible":t},te.createElement("div",{className:"sonner-spinner"},Oje.map((n,r)=>te.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),Ije=te.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},te.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"})),Dje=te.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},te.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"})),Lje=te.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},te.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"})),$je=te.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},te.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"})),Fje=te.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"},te.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),te.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Uje=()=>{let[t,e]=te.useState(document.hidden);return te.useEffect(()=>{let n=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),t},j4=1,zje=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let e=this.subscribers.indexOf(t);this.subscribers.splice(e,1)}),this.publish=t=>{this.subscribers.forEach(e=>e(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var e;let{message:n,...r}=t,i=typeof(t==null?void 0:t.id)=="number"||((e=t.id)==null?void 0:e.length)>0?t.id:j4++,s=this.toasts.find(l=>l.id===i),a=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(i)&&this.dismissedToasts.delete(i),s?this.toasts=this.toasts.map(l=>l.id===i?(this.publish({...l,...t,id:i,title:n}),{...l,...t,id:i,dismissible:a,title:n}):l):this.addToast({title:n,...r,dismissible:a,id:i}),i},this.dismiss=t=>(this.dismissedToasts.add(t),t||this.toasts.forEach(e=>{this.subscribers.forEach(n=>n({id:e.id,dismiss:!0}))}),this.subscribers.forEach(e=>e({id:t,dismiss:!0})),t),this.message=(t,e)=>this.create({...e,message:t}),this.error=(t,e)=>this.create({...e,message:t,type:"error"}),this.success=(t,e)=>this.create({...e,type:"success",message:t}),this.info=(t,e)=>this.create({...e,type:"info",message:t}),this.warning=(t,e)=>this.create({...e,type:"warning",message:t}),this.loading=(t,e)=>this.create({...e,type:"loading",message:t}),this.promise=(t,e)=>{if(!e)return;let n;e.loading!==void 0&&(n=this.create({...e,promise:t,type:"loading",message:e.loading,description:typeof e.description!="function"?e.description:void 0}));let r=t instanceof Promise?t:t(),i=n!==void 0,s,a=r.then(async c=>{if(s=["resolve",c],te.isValidElement(c))i=!1,this.create({id:n,type:"default",message:c});else if(Vje(c)&&!c.ok){i=!1;let u=typeof e.error=="function"?await e.error(`HTTP error! status: ${c.status}`):e.error,d=typeof e.description=="function"?await e.description(`HTTP error! status: ${c.status}`):e.description;this.create({id:n,type:"error",message:u,description:d})}else if(e.success!==void 0){i=!1;let u=typeof e.success=="function"?await e.success(c):e.success,d=typeof e.description=="function"?await e.description(c):e.description;this.create({id:n,type:"success",message:u,description:d})}}).catch(async c=>{if(s=["reject",c],e.error!==void 0){i=!1;let u=typeof e.error=="function"?await e.error(c):e.error,d=typeof e.description=="function"?await e.description(c):e.description;this.create({id:n,type:"error",message:u,description:d})}}).finally(()=>{var c;i&&(this.dismiss(n),n=void 0),(c=e.finally)==null||c.call(e)}),l=()=>new Promise((c,u)=>a.then(()=>s[0]==="reject"?u(s[1]):c(s[1])).catch(u));
67return typeof n!="string"&&typeof n!="number"?{unwrap:l}:Object.assign(n,{unwrap:l})},this.custom=(t,e)=>{let n=(e==null?void 0:e.id)||j4++;return this.create({jsx:t(n),id:n,...e}),n},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Oa=new zje,Bje=(t,e)=>{let n=(e==null?void 0:e.id)||j4++;return Oa.addToast({title:t,...e,id:n}),n},Vje=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",Hje=Bje,Wje=()=>Oa.toasts,Gje=()=>Oa.getActiveToasts(),ge=Object.assign(Hje,{success:Oa.success,info:Oa.info,warning:Oa.warning,error:Oa.error,custom:Oa.custom,message:Oa.message,promise:Oa.promise,dismiss:Oa.dismiss,loading:Oa.loading},{getHistory:Wje,getToasts:Gje});function qje(t,{insertAt:e}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",e==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}qje(`: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;
67left: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}
67: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%);
67--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%)}
68`);function VN(t){return t.label!==void 0}var Kje=3,Yje="32px",Xje="16px",k7=4e3,Qje=356,Jje=14,Zje=20,eCe=200;function kl(...t){return t.filter(Boolean).join(" ")}function tCe(t){let[e,n]=t.split("-"),r=[];return e&&r.push(e),n&&r.push(n),r}var nCe=t=>{var e,n,r,i,s,a,l,c,u,d,f;let{invert:h,toast:p,unstyled:m,interacting:x,setHeights:y,visibleToasts:g,heights:w,index:v,toasts:N,expanded:S,removeToast:_,defaultRichColors:j,closeButton:A,style:C,cancelButtonStyle:k,actionButtonStyle:M,className:I="",descriptionClassName:R="",duration:E,position:P,gap:O,loadingIcon:L,expandByDefault:T,classNames:D,icons:F,closeButtonAriaLabel:q="Close toast",pauseWhenPageIsHidden:B}=t,[z,H]=te.useState(null),[W,G]=te.useState(null),[K,ee]=te.useState(!1),[V,J]=te.useState(!1),[Y,$]=te.useState(!1),[fe,ce]=te.useState(!1),[ve,X]=te.useState(!1),[de,Te]=te.useState(0),[Pe,se]=te.useState(0),U=te.useRef(p.duration||E||k7),Q=te.useRef(null),oe=te.useRef(null),_e=v===0,ye=v+1<=g,re=p.type,he=p.dismissible!==!1,pe=p.className||"",je=p.descriptionClassName||"",ae=te.useMemo(()=>w.findIndex(rt=>rt.toastId===p.id)||0,[w,p.id]),we=te.useMemo(()=>{var rt;return(rt=p.closeButton)!=null?rt:A},[p.closeButton,A]),Ie=te.useMemo(()=>p.duration||E||k7,[p.duration,E]),Ue=te.useRef(0),Oe=te.useRef(0),ie=te.useRef(0),De=te.useRef(null),[Ve,xe]=P.split("-"),$e=te.useMemo(()=>w.reduce((rt,vt,me)=>me>=ae?rt:rt+vt.height,0),[w,ae]),ue=Uje(),Ne=p.invert||h,Le=re==="loading";Oe.current=te.useMemo(()=>ae*O+$e,[ae,$e]),te.useEffect(()=>{U.current=Ie},[Ie]),te.useEffect(()=>{ee(!0)},[]),te.useEffect(()=>{let rt=oe.current;if(rt){let vt=rt.getBoundingClientRect().height;return se(vt),y(me=>[{toastId:p.id,height:vt,position:p.position},...me]),()=>y(me=>me.filter(Fe=>Fe.toastId!==p.id))}},[y,p.id]),te.useLayoutEffect(()=>{if(!K)return;let rt=oe.current,vt=rt.style.height;rt.style.height="auto";let me=rt.getBoundingClientRect().height;rt.style.height=vt,se(me),y(Fe=>Fe.find(He=>He.toastId===p.id)?Fe.map(He=>He.toastId===p.id?{...He,height:me}:He):[{toastId:p.id,height:me,position:p.position},...Fe])},[K,p.title,p.description,y,p.id]);let tt=te.useCallback(()=>{J(!0),Te(Oe.current),y(rt=>
68rt.filter(vt=>vt.toastId!==p.id)),setTimeout(()=>{_(p)},eCe)},[p,_,y,Oe]);te.useEffect(()=>{if(p.promise&&re==="loading"||p.duration===1/0||p.type==="loading")return;let rt;return S||x||B&&ue?(()=>{if(ie.current<Ue.current){let vt=new Date().getTime()-Ue.current;U.current=U.current-vt}ie.current=new Date().getTime()})():U.current!==1/0&&(Ue.current=new Date().getTime(),rt=setTimeout(()=>{var vt;(vt=p.onAutoClose)==null||vt.call(p,p),tt()},U.current)),()=>clearTimeout(rt)},[S,x,p,re,B,ue,tt]),te.useEffect(()=>{p.delete&&tt()},[tt,p.delete]);function St(){var rt,vt,me;return F!=null&&F.loading?te.createElement("div",{className:kl(D==null?void 0:D.loader,(rt=p==null?void 0:p.classNames)==null?void 0:rt.loader,"sonner-loader"),"data-visible":re==="loading"},F.loading):L?te.createElement("div",{className:kl(D==null?void 0:D.loader,(vt=p==null?void 0:p.classNames)==null?void 0:vt.loader,"sonner-loader"),"data-visible":re==="loading"},L):te.createElement(Rje,{className:kl(D==null?void 0:D.loader,(me=p==null?void 0:p.classNames)==null?void 0:me.loader),visible:re==="loading"})}return te.createElement("li",{tabIndex:0,ref:oe,className:kl(I,pe,D==null?void 0:D.toast,(e=p==null?void 0:p.classNames)==null?void 0:e.toast,D==null?void 0:D.default,D==null?void 0:D[re],(n=p==null?void 0:p.classNames)==null?void 0:n[re]),"data-sonner-toast":"","data-rich-colors":(r=p.richColors)!=null?r:j,"data-styled":!(p.jsx||p.unstyled||m),"data-mounted":K,"data-promise":!!p.promise,"data-swiped":ve,"data-removed":V,"data-visible":ye,"data-y-position":Ve,"data-x-position":xe,"data-index":v,"data-front":_e,"data-swiping":Y,"data-dismissible":he,"data-type":re,"data-invert":Ne,"data-swipe-out":fe,"data-swipe-direction":W,"data-expanded":!!(S||T&&K),style:{"--index":v,"--toasts-before":v,"--z-index":N.length-v,"--offset":`${V?de:Oe.current}px`,"--initial-height":T?"auto":`${Pe}px`,...C,...p.style},onDragEnd:()=>{$(!1),H(null),De.current=null},onPointerDown:rt=>{Le||!he||(Q.current=new Date,Te(Oe.current),rt.target.setPointerCapture(rt.pointerId),rt.target.tagName!=="BUTTON"&&($(!0),De.current={x:rt.clientX,y:rt.clientY}))},onPointerUp:()=>{var rt,vt,me,Fe;if(fe||!he)return;De.current=null;let He=Number(((rt=oe.current)==null?void 0:rt.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Ye=Number(((vt=oe.current)==null?void 0:vt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Nt=new Date().getTime()-((me=Q.current)==null?void 0:me.getTime()),qt=z==="x"?He:Ye,Jt=Math.abs(qt)/Nt;if(Math.abs(qt)>=Zje||Jt>.11){Te(Oe.current),(Fe=p.onDismiss)==null||Fe.call(p,p),G(z==="x"?He>0?"right":"left":Ye>0?"down":"up"),tt(),ce(!0),X(!1);return}$(!1),H(null)},onPointerMove:rt=>{var vt,me,Fe,He;if(!De.current||!he||((vt=window.getSelection())==null?void 0:vt.toString().length)>0)return;let Ye=rt.clientY-De.current.y,Nt=rt.clientX-De.current.x,qt=(me=t.swipeDirections)!=null?me:tCe(P);!z&&(Math.abs(Nt)>1||Math.abs(Ye)>1)&&H(Math.abs(Nt)>Math.abs(Ye)?"x":"y");let Jt={x:0,y:0};z==="y"?(qt.includes("top")||qt.includes("bottom"))&&(qt.includes("top")&&Ye<0||qt.includes("bottom")&&Ye>0)&&(Jt.y=Ye):z==="x"&&(qt.includes("left")||qt.includes("right"))&&(qt.includes("left")&&Nt<0||qt.includes("right")&&Nt>0)&&(Jt.x=Nt),(Math.abs(Jt.x)>0||Math.abs(Jt.y)>0)&&X(!0),(Fe=oe.current)==null||Fe.style.setProperty("--swipe-amount-x",`${Jt.x}px`),(He=oe.current)==null||He.style.setProperty("--swipe-amount-y",`${Jt.y}px`)}},we&&!p.jsx?te.createElement("button",{"aria-label":q,"data-disabled":Le,"data-close-button":!0,onClick:Le||!he?()=>{}:()=>{var rt;tt(),(rt=p.onDismiss)==null||rt.call(p,p)},className:kl(D==null?void 0:D.closeButton,(i=p==null?void 0:p.classNames)==null?void 0:i.closeButton)},(s=F==null?void 0:F.close)!=null?s:Fje):null,p.jsx||b.isValidElement(p.title)?p.jsx?p.jsx:typeof p.title=="function"?p.title():p.title:te.createElement(te.Fragment,null,re||p.icon||p.promise?te.createElement("div",{"data-icon":"",className:kl(D==null?void 0:D.icon,(a=p==null?void 0:p.classNames)==null?void 0:a.icon)},p.promise||p.type==="loading"&&!p.icon?p.icon||St():null,p.type!=="loading"?p.icon||(F==null?void 0:F[re])||Pje(re):null):null,te.createElement("div",{"data-content":"",className:kl(D==null?void 0:D.content,(l=p==null?void 0:p.classNames)==null?void 0:l.content)},te.createElement("div",{"data-title":"",className:kl(D==null?void 0:D.title,(c=p==null?void 0:p.classNames)==null?void 0:c.title)},typeof p.title=="function"?p.title():p.title),p.description?te.createElement("div",{"data-description":"",className:kl(R,je,D==null?void 0:D.description,(u=p==null?void 0:p.classNames)==null?void 0:u.description)},typeof p.description=="function"?p.description():p.description):null),b.isValidElement(p.cancel)?p.cancel:p.cancel&&VN(p.cancel)?te.createElement("button",{"data-button":!0,"data-cancel":!0,style:p.cancelButtonStyle||k,onClick:rt=>{var vt,me;VN(p.cancel)&&he&&((me=(vt=p.cancel).onClick)==null||me.call(vt,rt),tt())},className:kl(D==null?void 0:D.cancelButton,(d=p==null?void 0:p.classNames)==null?void 0:d.cancelButton)},p.cancel.label):null,b.isValidElement(p.action)?p.action:p.action&&VN(p.action)?te.createElement("button",{"data-button":!0,"data-action":!0,style:p.actionButtonStyle||M,onClick:rt=>{var vt,me;VN(p.action)&&((me=(vt=p.action).onClick)==null||me.call(vt,rt),!rt.defaultPrevented&&tt())},className:kl(D==null?void 0:D.actionButton,(f=p==null?void 0:p.classNames)==null?void 0:f.actionButton)},p.action.label):null))};function E7(){if(typeof window>"u"||typeof document>"u")return"ltr";let t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function rCe(t,e){let n={};return[t,e].forEach((r,i)=>{let s=i===1,a=s?"--mobile-offset":"--offset",l=s?Xje:Yje;function c(u){["top","right","bottom","left"].forEach(d=>{n[`${a}-${d}`]=typeof u=="number"?`${u}px`:u})}typeof r=="number"||typeof r=="string"?c(r):typeof r=="object"?["top","right","bottom","left"].forEach(u=>{r[u]===void 0?n[`${a}-${u}`]=l:n[`${a}-${u}`]=typeof r[u]=="number"?`${r[u]}px`:r[u]}):c(l)}),n}var iCe=b.forwardRef(function(t,e){let{invert:n,position:r="bottom-right",hotkey:i=["altKey","KeyT"],expand:s,closeButton:a,className:l,offset:c,mobileOffset:u,theme:d="light",richColors:f,duration:h,style:p,visibleToasts:m=Kje,toastOptions:x,dir:y=E7(),gap:g=Jje,loadingIcon:w,icons:v,containerAriaLabel:N="Notifications",pauseWhenPageIsHidden:S}=t,[_,j]=te.useState([]),A=te.useMemo(()=>Array.from(new Set([r].concat(_.filter(B=>B.position).map(B=>B.position)))),[_,r]),[C,k]=te.useState([]),[M,I]=te.useState(!1),[R,E]=te.useState(!1),[P,O]=te.useState(d!=="system"?d:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dar
68k":"light"),L=te.useRef(null),T=i.join("+").replace(/Key/g,"").replace(/Digit/g,""),D=te.useRef(null),F=te.useRef(!1),q=te.useCallback(B=>{j(z=>{var H;return(H=z.find(W=>W.id===B.id))!=null&&H.delete||Oa.dismiss(B.id),z.filter(({id:W})=>W!==B.id)})},[]);return te.useEffect(()=>Oa.subscribe(B=>{if(B.dismiss){j(z=>z.map(H=>H.id===B.id?{...H,delete:!0}:H));return}setTimeout(()=>{JU.flushSync(()=>{j(z=>{let H=z.findIndex(W=>W.id===B.id);return H!==-1?[...z.slice(0,H),{...z[H],...B},...z.slice(H+1)]:[B,...z]})})})}),[]),te.useEffect(()=>{if(d!=="system"){O(d);return}if(d==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?O("dark"):O("light")),typeof window>"u")return;let B=window.matchMedia("(prefers-color-scheme: dark)");try{B.addEventListener("change",({matches:z})=>{O(z?"dark":"light")})}catch{B.addListener(({matches:H})=>{try{O(H?"dark":"light")}catch(W){console.error(W)}})}},[d]),te.useEffect(()=>{_.length<=1&&I(!1)},[_]),te.useEffect(()=>{let B=z=>{var H,W;i.every(G=>z[G]||z.code===G)&&(I(!0),(H=L.current)==null||H.focus()),z.code==="Escape"&&(document.activeElement===L.current||(W=L.current)!=null&&W.contains(document.activeElement))&&I(!1)};return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[i]),te.useEffect(()=>{if(L.current)return()=>{D.current&&(D.current.focus({preventScroll:!0}),D.current=null,F.current=!1)}},[L.current]),te.createElement("section",{ref:e,"aria-label":`${N} ${T}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},A.map((B,z)=>{var H;let[W,G]=B.split("-");return _.length?te.createElement("ol",{key:B,dir:y==="auto"?E7():y,tabIndex:-1,ref:L,className:l,"data-sonner-toaster":!0,"data-theme":P,"data-y-position":W,"data-lifted":M&&_.length>1&&!s,"data-x-position":G,style:{"--front-toast-height":`${((H=C[0])==null?void 0:H.height)||0}px`,"--width":`${Qje}px`,"--gap":`${g}px`,...p,...rCe(c,u)},onBlur:K=>{F.current&&!K.currentTarget.contains(K.relatedTarget)&&(F.current=!1,D.current&&(D.current.focus({preventScroll:!0}),D.current=null))},onFocus:K=>{K.target instanceof HTMLElement&&K.target.dataset.dismissible==="false"||F.current||(F.current=!0,D.current=K.relatedTarget)},onMouseEnter:()=>I(!0),onMouseMove:()=>I(!0),onMouseLeave:()=>{R||I(!1)},onDragEnd:()=>I(!1),onPointerDown:K=>{K.target instanceof HTMLElement&&K.target.dataset.dismissible==="false"||E(!0)},onPointerUp:()=>E(!1)},_.filter(K=>!K.position&&z===0||K.position===B).map((K,ee)=>{var V,J;return te.createElement(nCe,{key:K.id,icons:v,index:ee,toast:K,defaultRichColors:f,duration:(V=x==null?void 0:x.duration)!=null?V:h,className:x==null?void 0:x.className,descriptionClassName:x==null?void 0:x.descriptionClassName,invert:n,visibleToasts:m,closeButton:(J=x==null?void 0:x.closeButton)!=null?J:a,interacting:R,position:B,style:x==null?void 0:x.style,unstyled:x==null?void 0:x.unstyled,classNames:x==null?void 0:x.classNames,cancelButtonStyle:x==null?void 0:x.cancelButtonStyle,actionButtonStyle:x==null?void 0:x.actionButtonStyle,removeToast:q,toasts:_.filter(Y=>Y.position==K.position),heights:C.filter(Y=>Y.position==K.position),setHeights:k,expandByDefault:s,gap:g,loadingIcon:w,expanded:M,pauseWhenPageIsHidden:S,swipeDirections:t.swipeDirections})})):null}))});const sCe={},A7=t=>{let e;const n=new Set,r=(d,f)=>{const h=typeof d=="function"?d(e):d;if(!Object.is(h,e)){const p=e;e=f??(typeof h!="object"||h===null)?h:Object.assign({},e,h),n.forEach(m=>m(e,p))}},i=()=>e,c={setState:r,getState:i,getInitialState:()=>u,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(sCe?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},u=e=t(r,i,c);return c},Mie=t=>t?A7(t):A7;var Pie={exports:{}},Oie={},Rie={exports:{}},Iie={};/**
69 * @license React
70 * use-sync-external-store-shim.production.js
71 *
72 * Copyright (c) Meta Platforms, Inc. and affiliates.
73 *
74 * This source code is licensed under the MIT license found in the
75 * LICENSE file in the root directory of this source tree.
76 */var ov=b;function aCe(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var oCe=typeof Object.is=="function"?Object.is:aCe,lCe=ov.useState,cCe=ov.useEffect,uCe=ov.useLayoutEffect,dCe=ov.useDebugValue;function fCe(t,e){var n=e(),r=lCe({inst:{value:n,getSnapshot:e}}),i=r[0].inst,s=r[1];return uCe(function(){i.value=n,i.getSnapshot=e,QO(i)&&s({inst:i})},[t,n,e]),cCe(function(){return QO(i)&&s({inst:i}),t(function(){QO(i)&&s({inst:i})})},[t]),dCe(n),n}function QO(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!oCe(t,n)}catch{return!0}}function hCe(t,e){return e()}var pCe=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?hCe:fCe;Iie.useSyncExternalStore=ov.useSyncExternalStore!==void 0?ov.useSyncExternalStore:pCe;Rie.exports=Iie;var hT=Rie.exports;/**
77 * @license React
78 * use-sync-external-store-shim/with-selector.production.js
79 *
80 * Copyright (c) Meta Platforms, Inc. and affiliates.
81 *
82 * This source code is licensed under the MIT license found in the
83 * LICENSE file in the root directory of this source tree.
84 */var pT=b,mCe=hT;function gCe(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}
84var xCe=typeof Object.is=="function"?Object.is:gCe,yCe=mCe.useSyncExternalStore,vCe=pT.useRef,bCe=pT.useEffect,wCe=pT.useMemo,_Ce=pT.useDebugValue;Oie.useSyncExternalStoreWithSelector=function(t,e,n,r,i){var s=vCe(null);if(s.current===null){var a={hasValue:!1,value:null};s.current=a}else a=s.current;s=wCe(function(){function c(p){if(!u){if(u=!0,d=p,p=r(p),i!==void 0&&a.hasValue){var m=a.value;if(i(m,p))return f=m}return f=p}if(m=f,xCe(d,p))return m;var x=r(p);return i!==void 0&&i(m,x)?(d=p,m):(d=p,f=x)}var u=!1,d,f,h=n===void 0?null:n;return[function(){return c(e())},h===null?void 0:function(){return c(h())}]},[e,n,r,i]);var l=yCe(t,s[0],s[1]);return bCe(function(){a.hasValue=!0,a.value=l},[l]),_Ce(l),l};Pie.exports=Oie;var Die=Pie.exports;const Lie=An(Die),$ie={},{useDebugValue:SCe}=te,{useSyncExternalStoreWithSelector:NCe}=Lie;let T7=!1;const jCe=t=>t;function CCe(t,e=jCe,n){($ie?"production":void 0)!=="production"&&n&&!T7&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),T7=!0);const r=NCe(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return SCe(r),r}const M7=t=>{($ie?"production":void 0)!=="production"&&typeof t!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const e=typeof t=="function"?Mie(t):t,n=(r,i)=>CCe(e,r,i);return Object.assign(n,e),n},$d=t=>t?M7(t):M7;var Fc=function(){return Fc=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Fc.apply(this,arguments)};function j0(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}function kCe(t,e,n,r){function i(s){return s instanceof n?s:new n(function(a){a(s)})}return new(n||(n=Promise))(function(s,a){function l(d){try{u(r.next(d))}catch(f){a(f)}}function c(d){try{u(r.throw(d))}catch(f){a(f)}}function u(d){d.done?s(d.value):i(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})}function ECe(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return t.concat(s||Array.prototype.slice.call(e))}const ACe=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);class cz extends Error{constructor(e,n="FunctionsError",r){super(e),this.name=n,this.context=r}}class TCe extends cz{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class P7 extends cz{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class O7 extends cz{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var C4;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(C4||(C4={}));class MCe{constructor(e,{headers:n={},customFetch:r,region:i=C4.Any}={}){this.url=e,this.headers=n,this.region=i,this.fetch=ACe(r)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return kCe(this,arguments,void 0,function*(n,r={}){var i;let s,a;try{const{headers:l,method:c,body:u,signal:d,timeout:f}=r;let h={},{region:p}=r;p||(p=this.region);const m=new URL(`${this.url}/${n}`);p&&p!=="any"&&(h["x-region"]=p,m.searchParams.set("forceFunctionRegion",p));let x;u&&(l&&!Object.prototype.hasOwnProperty.call(l,"Content-Type")||!l)?typeof Blob<"u"&&u instanceof Blob||u instanceof ArrayBuffer?(h["Content-Type"]="application/octet-stream",x=u):typeof u=="string"?(h["Content-Type"]="text/plain",x=u):typeof FormData<"u"&&u instanceof FormData?x=u:(h["Content-Type"]="application/json",x=JSON.stringify(u)):u&&typeof u!="string"&&!(typeof Blob<"u"&&u instanceof Blob)&&!(u instanceof ArrayBuffer)&&!(typeof FormData<"u"&&u instanceof FormData)?x=JSON.stringify(u):x=u;let y=d;f&&(a=new AbortController,s=setTimeout(()=>a.abort(),f),d?(y=a.signal,d.addEventListener("abort",()=>a.abort())):y=a.signal);const g=yield this.fetch(m.toString(),{method:c||"POST",headers:Object.assign(Object.assign(Object.assign({},h),this.headers),l),body:x,signal:y}
84).catch(S=>{throw new TCe(S)}),w=g.headers.get("x-relay-error");if(w&&w==="true")throw new P7(g);if(!g.ok)throw new O7(g);let v=((i=g.headers.get("Content-Type"))!==null&&i!==void 0?i:"text/plain").split(";")[0].trim(),N;return v==="application/json"?N=yield g.json():v==="application/octet-stream"||v==="application/pdf"?N=yield g.blob():v==="text/event-stream"?N=g:v==="multipart/form-data"?N=yield g.formData():N=yield g.text(),{data:N,error:null,response:g}}catch(l){return{data:null,error:l,response:l instanceof O7||l instanceof P7?l.context:void 0}}finally{s&&clearTimeout(s)}})}}var PCe=class extends Error{constructor(t){super(t.message),this.name="PostgrestError",this.details=t.details,this.hint=t.hint,this.code=t.code}},OCe=class{constructor(t){var e,n;this.shouldThrowOnError=!1,this.method=t.method,this.url=t.url,this.headers=new Headers(t.headers),this.schema=t.schema,this.body=t.body,this.shouldThrowOnError=(e=t.shouldThrowOnError)!==null&&e!==void 0?e:!1,this.signal=t.signal,this.isMaybeSingle=(n=t.isMaybeSingle)!==null&&n!==void 0?n:!1,t.fetch?this.fetch=t.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,e){return this.headers=new Headers(this.headers),this.headers.set(t,e),this}then(t,e){var n=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 i=r(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async s=>{let a=null,l=null,c=null,u=s.status,d=s.statusText;if(s.ok){var f,h;if(n.method!=="HEAD"){var p;const g=await s.text();g===""||(n.headers.get("Accept")==="text/csv"||n.headers.get("Accept")&&(!((p=n.headers.get("Accept"))===null||p===void 0)&&p.includes("application/vnd.pgrst.plan+text"))?l=g:l=JSON.parse(g))}const x=(f=n.headers.get("Prefer"))===null||f===void 0?void 0:f.match(/count=(exact|planned|estimated)/),y=(h=s.headers.get("content-range"))===null||h===void 0?void 0:h.split("/");x&&y&&y.length>1&&(c=parseInt(y[1])),n.isMaybeSingle&&n.method==="GET"&&Array.isArray(l)&&(l.length>1?(a={code:"PGRST116",details:`Results contain ${l.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},l=null,c=null,u=406,d="Not Acceptable"):l.length===1?l=l[0]:l=null)}else{var m;const x=await s.text();try{a=JSON.parse(x),Array.isArray(a)&&s.status===404&&(l=[],a=null,u=200,d="OK")}catch{s.status===404&&x===""?(u=204,d="No Content"):a={message:x}}if(a&&n.isMaybeSingle&&(!(a==null||(m=a.details)===null||m===void 0)&&m.includes("0 rows"))&&(a=null,u=200,d="OK"),a&&n.shouldThrowOnError)throw new PCe(a)}return{error:a,data:l,count:c,status:u,statusText:d}});return this.shouldThrowOnError||(i=i.catch(s=>{var a;let l="";const c=s==null?void 0:s.cause;if(c){var u,d,f,h;const m=(u=c==null?void 0:c.message)!==null&&u!==void 0?u:"",x=(d=c==null?void 0:c.code)!==null&&d!==void 0?d:"";l=`${(f=s==null?void 0:s.name)!==null&&f!==void 0?f:"FetchError"}: ${s==null?void 0:s.message}`,l+=`
85
86Caused by: ${(h=c==null?void 0:c.name)!==null&&h!==void 0?h:"Error"}: ${m}`,x&&(l+=` (${x})`),c!=null&&c.stack&&(l+=`
87${c.stack}`)}else{var p;l=(p=s==null?void 0:s.stack)!==null&&p!==void 0?p:""}return{error:{message:`${(a=s==null?void 0:s.name)!==null&&a!==void 0?a:"FetchError"}: ${s==null?void 0:s.message}`,details:l,hint:"",code:""},data:null,count:null,status:0,statusText:""}})),i.then(t,e)}returns(){return this}overrideTypes(){return this}},RCe=class extends OCe{select(t){let e=!1;const n=(t??"*").split("").map(r=>/\s/.test(r)&&!e?"":(r==='"'&&(e=!e),r)).join("");return this.url.searchParams.set("select",n),this.headers.append("Prefer","return=representation"),this}order(t,{ascending:e=!0,nullsFirst:n,foreignTable:r,referencedTable:i=r}={}){const s=i?`${i}.order`:"order",a=this.url.searchParams.get(s);return this.url.searchParams.set(s,`${a?`${a},`:""}${t}.${e?"asc":"desc"}${n===void 0?"":n?".nullsfirst":".nullslast"}`),this}limit(t,{foreignTable:e,referencedTable:n=e}={}){const r=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(r,`${t}`),this}range(t,e,{foreignTable:n,referencedTable:r=n}={}){const i=typeof r>"u"?"offset":`${r}.offset`,s=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(i,`${t}`),this.url.searchParams.set(s,`${e-t+1}`),this}abortSignal(t){return this.signal=t,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}
87explain({analyze:t=!1,verbose:e=!1,settings:n=!1,buffers:r=!1,wal:i=!1,format:s="text"}={}){var a;const l=[t?"analyze":null,e?"verbose":null,n?"settings":null,r?"buffers":null,i?"wal":null].filter(Boolean).join("|"),c=(a=this.headers.get("Accept"))!==null&&a!==void 0?a:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${s}; for="${c}"; options=${l};`),s==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(t){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${t}`),this}};const R7=new RegExp("[,()]");var Rx=class extends RCe{eq(t,e){return this.url.searchParams.append(t,`eq.${e}`),this}neq(t,e){return this.url.searchParams.append(t,`neq.${e}`),this}gt(t,e){return this.url.searchParams.append(t,`gt.${e}`),this}gte(t,e){return this.url.searchParams.append(t,`gte.${e}`),this}lt(t,e){return this.url.searchParams.append(t,`lt.${e}`),this}lte(t,e){return this.url.searchParams.append(t,`lte.${e}`),this}like(t,e){return this.url.searchParams.append(t,`like.${e}`),this}likeAllOf(t,e){return this.url.searchParams.append(t,`like(all).{${e.join(",")}}`),this}likeAnyOf(t,e){return this.url.searchParams.append(t,`like(any).{${e.join(",")}}`),this}ilike(t,e){return this.url.searchParams.append(t,`ilike.${e}`),this}ilikeAllOf(t,e){return this.url.searchParams.append(t,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(t,e){return this.url.searchParams.append(t,`ilike(any).{${e.join(",")}}`),this}regexMatch(t,e){return this.url.searchParams.append(t,`match.${e}`),this}regexIMatch(t,e){return this.url.searchParams.append(t,`imatch.${e}`),this}is(t,e){return this.url.searchParams.append(t,`is.${e}`),this}isDistinct(t,e){return this.url.searchParams.append(t,`isdistinct.${e}`),this}in(t,e){const n=Array.from(new Set(e)).map(r=>typeof r=="string"&&R7.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(t,`in.(${n})`),this}notIn(t,e){const n=Array.from(new Set(e)).map(r=>typeof r=="string"&&R7.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(t,`not.in.(${n})`),this}contains(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cs.{${e.join(",")}}`):this.url.searchParams.append(t,`cs.${JSON.stringify(e)}`),this}containedBy(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cd.{${e.join(",")}}`):this.url.searchParams.append(t,`cd.${JSON.stringify(e)}`),this}rangeGt(t,e){return this.url.searchParams.append(t,`sr.${e}`),this}rangeGte(t,e){return this.url.searchParams.append(t,`nxl.${e}`),this}rangeLt(t,e){return this.url.searchParams.append(t,`sl.${e}`),this}rangeLte(t,e){return this.url.searchParams.append(t,`nxr.${e}`),this}rangeAdjacent(t,e){return this.url.searchParams.append(t,`adj.${e}`),this}overlaps(t,e){return typeof e=="string"?this.url.searchParams.append(t,`ov.${e}`):this.url.searchParams.append(t,`ov.{${e.join(",")}}`),this}textSearch(t,e,{config:n,type:r}={}){let i="";r==="plain"?i="pl":r==="phrase"?i="ph":r==="websearch"&&(i="w");const s=n===void 0?"":`(${n})`;return this.url.searchParams.append(t,`${i}fts${s}.${e}`),this}match(t){return Object.entries(t).forEach(([e,n])=>{this.url.searchParams.append(e,`eq.${n}`)}),this}not(t,e,n){return this.url.searchParams.append(t,`not.${e}.${n}`),this}or(t,{foreignTable:e,referencedTable:n=e}={}){const r=n?`${n}.or`:"or";return this.url.searchParams.append(r,`(${t})`),this}filter(t,e,n){return this.url.searchParams.append(t,`${e}.${n}`),this}},ICe=class{constructor(t,{headers:e={},schema:n,fetch:r}){this.url=t,this.headers=new Headers(e),this.schema=n,this.fetch=r}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(t,e){const{head:n=!1,count:r}=e??{},i=n?"HEAD":"GET";let s=!1;const a=(t??"*").split("").map(u=>/\s/.test(u)&&!s?"":(u==='"'&&(s=!s),u)).join(""),{url:l,headers:c}=this.cloneRequestState();return l.searchParams.set("select",a),r&&c.append("Prefer",`count=${r}`),new Rx({method:i,url:l,headers:c,schema:this.schema,fetch:this.fetch})}insert(t,{count:e,defaultToNull:n=!0}={}){var r;const i="POST",{url:s,headers:a}=this.cloneRequestState();if(e&&a.append("Prefer",`count=${e}`),n||a.append("Prefer","missing=default"),Array.isArray(t)){const l=t.reduce((c,u)=>c.concat(Object.keys(u)),[]);if(l.length>0){const c=[...new Set(l)].map(u=>`"${u}"`);s.searchParams.set("columns",c.join(","))}}return new Rx({method:i,url:s,headers:a,schema:this.schema,body:t,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}upsert(t,{onConflict:e,ignoreDuplicates:n=!1,count:r,defaultToNull:i=!0}={}){var s;const a="POST",{url:l,headers:c}=this.cloneRequestState();if(c.append("Prefer",`resolution=${n?"ignore":"merge"}-duplicates`),e!==void 0&&l.searchParams.set("on_conflict",e),r&&c.append("Prefer",`count=${r}`),i||c.append("Prefer","missing=default"),Array.isArray(t)){const u=t.reduce((d,f)=>d.concat(Object.keys(f)),[]);if(u.length>0){const d=[...new Set(u)].map(f=>`"${f}"`);l.searchParams.set("columns",d.join(","))}}return new Rx({method:a,url:l,headers:c,schema:this.schema,body:t,fetch:(s=this.fetch)!==null&&s!==void 0?s:fetch})}update(t,{count:e}={}){var n;const r="PATCH",{url:i,headers:s}=this.cloneRequestState();return e&&s.append("Prefer",`count=${e}`),new Rx({method:r,url:i,headers:s,schema:this.schema,body:t,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}delete({count:t}={}){var e;const n="DELETE",{url:r,headers:i}=this.cloneRequestState();return t&&i.append("Prefer",`count=${t}`),new Rx({method:n,url:r,headers:i,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch})}},DCe=class Fie{constructor(e,{headers:n={},schema:r,fetch:i}={}){this.url=e,this.headers=new Headers(n),this.schemaName=r,this.fetch=i}from(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new ICe(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new Fie(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,n={},{head:r=!1,get:i=!1,count:s}={}){var a;let l;const c=new URL(`${this.url}/rpc/${e}`);let u;const d=p=>p!==null&&typeof p=="object"&&(!Array.isArray(p)||p.some(d)),f=r&&Object.values(n).some(d);f?(l="POST",u=n):r||i?(l=r?"HEAD":"GET",Object.entries(n).filter(([p,m])=>m!==void 0).map(([p,m])=>[p,Array.isArray(m)?`{${m.join(",")}}`:`${m}
87`]).forEach(([p,m])=>{c.searchParams.append(p,m)})):(l="POST",u=n);const h=new Headers(this.headers);return f?h.set("Prefer",s?`count=${s},return=minimal`:"return=minimal"):s&&h.set("Prefer",`count=${s}`),new Rx({method:l,url:c,headers:h,schema:this.schemaName,body:u,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}};class LCe{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."};const n=globalThis.process;if(n){const r=n.versions;if(r&&r.node){const i=r.node,s=parseInt(i.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:
88import ws from "ws"
89new 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 n=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(n+=`
90
91Suggested solution: ${e.workaround}`),new Error(n)}static createWebSocket(e,n){const r=this.getWebSocketConstructor();return new r(e,n)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const $Ce="2.90.1",FCe=`realtime-js/${$Ce}`,Uie="1.0.0",UCe="2.0.0",I7=Uie,k4=1e4,zCe=1e3,BCe=100;var vf;(function(t){t[t.connecting=0]="connecting",t[t.open=1]="open",t[t.closing=2]="closing",t[t.closed=3]="closed"})(vf||(vf={}));var Vi;(function(t){t.closed="closed",t.errored="errored",t.joined="joined",t.joining="joining",t.leaving="leaving"})(Vi||(Vi={}));var Ul;(function(t){t.close="phx_close",t.error="phx_error",t.join="phx_join",t.reply="phx_reply",t.leave="phx_leave",t.access_token="access_token"})(Ul||(Ul={}));var E4;(function(t){t.websocket="websocket"})(E4||(E4={}));var $p;(function(t){t.Connecting="connecting",t.Open="open",t.Closing="closing",t.Closed="closed"})($p||($p={}));class VCe{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,n){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&typeof e.payload.event=="string")return n(this._binaryEncodeUserBroadcastPush(e));let r=[e.join_ref,e.ref,e.topic,e.event,e.payload];return n(JSON.stringify(r))}_binaryEncodeUserBroadcastPush(e){var n;return this._isArrayBuffer((n=e.payload)===null||n===void 0?void 0:n.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var n,r;const i=(r=(n=e.payload)===null||n===void 0?void 0:n.payload)!==null&&r!==void 0?r:new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,i)}_encodeJsonUserBroadcastPush(e){var n,r;const i=(r=(n=e.payload)===null||n===void 0?void 0:n.payload)!==null&&r!==void 0?r:{},a=new TextEncoder().encode(JSON.stringify(i)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,a)}_encodeUserBroadcastPush(e,n,r){var i,s;const a=e.topic,l=(i=e.ref)!==null&&i!==void 0?i:"",c=(s=e.join_ref)!==null&&s!==void 0?s:"",u=e.payload.event,d=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},f=Object.keys(d).length===0?"":JSON.stringify(d);if(c.length>255)throw new Error(`joinRef length ${c.length} exceeds maximum of 255`);if(l.length>255)throw new Error(`ref length ${l.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(f.length>255)throw new Error(`metadata length ${f.length} exceeds maximum of 255`);const h=this.USER_BROADCAST_PUSH_META_LENGTH+c.length+l.length+a.length+u.length+f.length,p=new ArrayBuffer(this.HEADER_LENGTH+h);let m=new DataView(p),x=0;m.setUint8(x++,this.KINDS.userBroadcastPush),m.setUint8(x++,c.length),m.setUint8(x++,l.length),m.setUint8(x++,a.length),m.setUint8(x++,u.length),m.setUint8(x++,f.length),m.setUint8(x++,n),Array.from(c,g=>m.setUint8(x++,g.charCodeAt(0))),Array.from(l,g=>m.setUint8(x++,g.charCodeAt(0))),Array.from(a,g=>m.setUint8(x++,g.charCodeAt(0))),Array.from(u,g=>m.setUint8(x++,g.charCodeAt(0))),Array.from(f,g=>m.setUint8(x++,g.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,n){if(this._isArrayBuffer(e)){let r=this._binaryDecode(e);return n(r)}if(typeof e=="string"){const r=JSON.parse(e),[i,s,a,l,c]=r;
91return n({join_ref:i,ref:s,topic:a,event:l,payload:c})}return n({})}_binaryDecode(e){const n=new DataView(e),r=n.getUint8(0),i=new TextDecoder;switch(r){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(e,n,i)}}_decodeUserBroadcast(e,n,r){const i=n.getUint8(1),s=n.getUint8(2),a=n.getUint8(3),l=n.getUint8(4);let c=this.HEADER_LENGTH+4;const u=r.decode(e.slice(c,c+i));c=c+i;const d=r.decode(e.slice(c,c+s));c=c+s;const f=r.decode(e.slice(c,c+a));c=c+a;const h=e.slice(c,e.byteLength),p=l===this.JSON_ENCODING?JSON.parse(r.decode(h)):h,m={type:this.BROADCAST_EVENT,event:d,payload:p};return a>0&&(m.meta=JSON.parse(f)),{join_ref:null,ref:null,topic:u,event:this.BROADCAST_EVENT,payload:m}}_isArrayBuffer(e){var n;return e instanceof ArrayBuffer||((n=e==null?void 0:e.constructor)===null||n===void 0?void 0:n.name)==="ArrayBuffer"}_pick(e,n){return!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([r])=>n.includes(r)))}}let zie=class{constructor(e,n){this.callback=e,this.timerCalc=n,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=n}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 Cr;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(Cr||(Cr={}));const D7=(t,e,n={})=>{var r;const i=(r=n.skipTypes)!==null&&r!==void 0?r:[];return e?Object.keys(e).reduce((s,a)=>(s[a]=HCe(a,t,e,i),s),{}):{}},HCe=(t,e,n,r)=>{const i=e.find(l=>
91l.name===t),s=i==null?void 0:i.type,a=n[t];return s&&!r.includes(s)?Bie(s,a):A4(a)},Bie=(t,e)=>{if(t.charAt(0)==="_"){const n=t.slice(1,t.length);return KCe(e,n)}switch(t){case Cr.bool:return WCe(e);case Cr.float4:case Cr.float8:case Cr.int2:case Cr.int4:case Cr.int8:case Cr.numeric:case Cr.oid:return GCe(e);case Cr.json:case Cr.jsonb:return qCe(e);case Cr.timestamp:return YCe(e);case Cr.abstime:case Cr.date:case Cr.daterange:case Cr.int4range:case Cr.int8range:case Cr.money:case Cr.reltime:case Cr.text:case Cr.time:case Cr.timestamptz:case Cr.timetz:case Cr.tsrange:case Cr.tstzrange:return A4(e);default:return A4(e)}},A4=t=>t,WCe=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},GCe=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},qCe=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t},KCe=(t,e)=>{if(typeof t!="string")return t;const n=t.length-1,r=t[n];if(t[0]==="{"&&r==="}"){let s;const a=t.slice(1,n);try{s=JSON.parse("["+a+"]")}catch{s=a?a.split(","):[]}return s.map(l=>Bie(e,l))}return t},YCe=t=>typeof t=="string"?t.replace(" ","T"):t,Vie=t=>{const e=new URL(t);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 JO{constructor(e,n,r={},i=k4){this.channel=e,this.event=n,this.payload=r,this.timeout=i,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,n){var r;return this._hasReceived(e)&&n((r=this.receivedResp)===null||r===void 0?void 0:r.response),this.recHooks.push({status:e,callback:n}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const e=n=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=n,this._matchReceive(n)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,n){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:n})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:n}){this.recHooks.filter(r=>r.status===e).forEach(r=>r.callback(n))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}var L7;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(L7||(L7={}));class Dw{constructor(e,n){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const r=(n==null?void 0:n.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(r.state,{},i=>{const{onJoin:s,onLeave:a,onSync:l}=this.caller;this.joinRef=this.channel._joinRef(),this.state=Dw.syncState(this.state,i,s,a),this.pendingDiffs.forEach(c=>{this.state=Dw.syncDiff(this.state,c,s,a)}),this.pendingDiffs=[],l()}),this.channel._on(r.diff,{},i=>{const{onJoin:s,onLeave:a,onSync:l}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(i):(this.state=Dw.syncDiff(this.state,i,s,a),l())}),this.onJoin((i,s,a)=>{this.channel._trigger("presence",{event:"join",key:i,currentPresences:s,newPresences:a})}),this.onLeave((i,s,a)=>{this.channel._trigger("presence",{event:"leave",key:i,currentPresences:s,leftPresences:a})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,n,r,i){const s=this.cloneDeep(e),a=this.transformState(n),l={},c={};return this.map(s,(u,d)=>{a[u]||(c[u]=d)}),this.map(a,(u,d)=>{const f=s[u];if(f){const h=d.map(y=>y.presence_ref),p=f.map(y=>y.presence_ref),m=d.filter(y=>p.indexOf(y.presence_ref)<0),x=f.filter(y=>h.indexOf(y.presence_ref)<0);m.length>0&&(l[u]=m),x.length>0&&(c[u]=x)}else l[u]=d}),this.syncDiff(s,{joins:l,leaves:c},r,i)}static syncDiff(e,n,r,i){const{joins:s,leaves:a}={joins:this.transformState(n.joins),leaves:this.transformState(n.leaves)};return r||(r=()=>{}),i||(i=()=>{}),this.map(s,(l,c)=>{var u;
91const d=(u=e[l])!==null&&u!==void 0?u:[];if(e[l]=this.cloneDeep(c),d.length>0){const f=e[l].map(p=>p.presence_ref),h=d.filter(p=>f.indexOf(p.presence_ref)<0);e[l].unshift(...h)}r(l,d,c)}),this.map(a,(l,c)=>{let u=e[l];if(!u)return;const d=c.map(f=>f.presence_ref);u=u.filter(f=>d.indexOf(f.presence_ref)<0),e[l]=u,i(l,u,c),u.length===0&&delete e[l]}),e}static map(e,n){return Object.getOwnPropertyNames(e).map(r=>n(r,e[r]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((n,r)=>{const i=e[r];return"metas"in i?n[r]=i.metas.map(s=>(s.presence_ref=s.phx_ref,delete s.phx_ref,delete s.phx_ref_prev,s)):n[r]=i,n},{})}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 $7;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})($7||($7={}));var Lw;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(Lw||(Lw={}));var Uu;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(Uu||(Uu={}));class sy{constructor(e,n={config:{}},r){var i,s;if(this.topic=e,this.params=n,this.socket=r,this.bindings={},this.state=Vi.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},n.config),this.timeout=this.socket.timeout,this.joinPush=new JO(this,Ul.join,this.params,this.timeout),this.rejoinTimer=new zie(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=Vi.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=Vi.closed,this.socket._remove(this)}),this._onError(a=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,a),this.state=Vi.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=Vi.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",a=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,a),this.state=Vi.errored,this.rejoinTimer.scheduleTimeout())}),this._on(Ul.reply,{},(a,l)=>{this._trigger(this._replyEventName(l),a)}),this.presence=new Dw(this),this.broadcastEndpointURL=Vie(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((s=(i=this.params.config)===null||i===void 0?void 0:i.broadcast)===null||s===void 0)&&s.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(e,n=this.timeout){var r,i,s;if(this.socket.isConnected()||this.socket.connect(),this.state==Vi.closed){const{config:{broadcast:a,presence:l,private:c}}=this.params,u=(i=(r=this.bindings.postgres_changes)===null||r===void 0?void 0:r.map(p=>p.filter))!==null&&i!==void 0?i:[],d=!!this.bindings[Lw.PRESENCE]&&this.bindings[Lw.PRESENCE].length>0||((s=this.params.config.presence)===null||s===void 0?void 0:s.enabled)===!0,f={},h={broadcast:a,presence:Object.assign(Object.assign({},l),{enabled:d}),postgres_changes:u,private:c};this.socket.accessTokenValue&&(f.access_token=this.socket.accessTokenValue),this._onError(p=>e==null?void 0:e(Uu.CHANNEL_ERROR,p)),this._onClose(()=>e==null?void 0:e(Uu.CLOSED)),this.updateJoinPayload(Object.assign({config:h},f)),this.joinedOnce=!0,this._rejoin(n),this.joinPush.receive("ok",async({postgres_changes:p})=>{var m;if(this.socket._isManualToken()||this.socket.setAuth(),p===void 0){e==null||e(Uu.SUBSCRIBED);return}else{const x=this.bindings.postgres_changes,y=(m=x==null?void 0:x.length)!==null&&m!==void 0?m:0,g=[];for(let w=0;w<y;
91w++){const v=x[w],{filter:{event:N,schema:S,table:_,filter:j}}=v,A=p&&p[w];if(A&&A.event===N&&sy.isFilterValueEqual(A.schema,S)&&sy.isFilterValueEqual(A.table,_)&&sy.isFilterValueEqual(A.filter,j))g.push(Object.assign(Object.assign({},v),{id:A.id}));else{this.unsubscribe(),this.state=Vi.errored,e==null||e(Uu.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=g,e&&e(Uu.SUBSCRIBED);return}}).receive("error",p=>{this.state=Vi.errored,e==null||e(Uu.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(p).join(", ")||"error")))}).receive("timeout",()=>{e==null||e(Uu.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,n={}){return await this.send({type:"presence",event:"track",payload:e},n.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,n,r){return this.state===Vi.joined&&e===Lw.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,n,r)}async httpSend(e,n,r={}){var i;if(n==null)return Promise.reject("Payload is required for httpSend()");const s={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(s.Authorization=`Bearer ${this.socket.accessTokenValue}`);const a={method:"POST",headers:s,body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:n,private:this.private}]})},l=await this._fetchWithTimeout(this.broadcastEndpointURL,a,(i=r.timeout)!==null&&i!==void 0?i:this.timeout);if(l.status===202)return{success:!0};let c=l.statusText;try{const u=await l.json();c=u.error||u.message||c}catch{}return Promise.reject(new Error(c))}async send(e,n={}){var r,i;if(!this._canPush()&&e.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated 
91in the future. Please use httpSend() explicitly for REST delivery.");const{event:s,payload:a}=e,l={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(l.Authorization=`Bearer ${this.socket.accessTokenValue}`);const c={method:"POST",headers:l,body:JSON.stringify({messages:[{topic:this.subTopic,event:s,payload:a,private:this.private}]})};try{const u=await this._fetchWithTimeout(this.broadcastEndpointURL,c,(r=n.timeout)!==null&&r!==void 0?r:this.timeout);return await((i=u.body)===null||i===void 0?void 0:i.cancel()),u.ok?"ok":"error"}catch(u){return u.name==="AbortError"?"timed out":"error"}}else return new Promise(s=>{var a,l,c;const u=this._push(e.type,e,n.timeout||this.timeout);e.type==="broadcast"&&!(!((c=(l=(a=this.params)===null||a===void 0?void 0:a.config)===null||l===void 0?void 0:l.broadcast)===null||c===void 0)&&c.ack)&&s("ok"),u.receive("ok",()=>s("ok")),u.receive("error",()=>s("error")),u.receive("timeout",()=>s("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=Vi.leaving;const n=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(Ul.close,"leave",this._joinRef())};this.joinPush.destroy();let r=null;return new Promise(i=>{r=new JO(this,Ul.leave,{},e),r.receive("ok",()=>{n(),i("ok")}).receive("timeout",()=>{n(),i("timed out")}).receive("error",()=>{i("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=Vi.closed,this.bindings={}}async _fetchWithTimeout(e,n,r){const i=new AbortController,s=setTimeout(()=>i.abort(),r),a=await this.socket.fetch(e,Object.assign(Object.assign({},n),{signal:i.signal}));return clearTimeout(s),a}_push(e,n,r=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let i=new JO(this,e,n,r);return this._canPush()?i.send():this._addToPushBuffer(i),i}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>BCe){const n=this.pushBuffer.shift();n&&(n.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${n.event}`,n.payload))}}_onMessage(e,n,r){return n}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,n,r){var i,s;const a=e.toLocaleLowerCase(),{close:l,error:c,leave:u,join:d}=Ul;if(r&&[l,c,u,d].indexOf(a)>=0&&r!==this._joinRef())return;let h=this._onMessage(a,n,r);if(n&&!h)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(a)?(i=this.bindings.postgres_changes)===null||i===void 0||i.filter(p=>{var m,x,y;return((m=p.filter)===null||m===void 0?void 0:m.event)==="*"||((y=(x=p.filter)===null||x===void 0?void 0:x.event)===null||y===void 0?void 0:y.toLocaleLowerCase())===a}).map(p=>p.callback(h,r)):(s=this.bindings[a])===null||s===void 0||s.filter(p=>{var m,x,y,g,w,v,N,S;if(["broadcast","presence","postgres_changes"].includes(a))if("id"in p){const _=p.id,j=(m=p.filter)===null||m===void 0?void 0:m.event;return _&&((x=n.ids)===null||x===void 0?void 0:x.includes(_))&&(j==="*"||(j==null?void 0:j.toLocaleLowerCase())===((y=n.data)===null||y===void 0?void 0:y.type.toLocaleLowerCase()))&&(!(!((g=p.filter)===null||g===void 0)&&g.table)||p.filter.table===((w=n.data)===null||w===void 0?void 0:w.table))}else{const _=(N=(v=p==null?void 0:p.filter)===null||v===void 0?void 0:v.event)===null||N===void 0?void 0:N.toLocaleLowerCase();return _==="*"||_===((S=n==null?void 0:n.event)===null||S===void 0?void 0:S.toLocaleLowerCase())}else return p.type.toLocaleLowerCase()===a}).map(p=>{if(typeof h=="object"&&"ids"in h){const m=h.data,{schema:x,table:y,commit_timestamp:g,type:w,errors:v}=m;h=Object.assign(Object.assign({},{schema:x,table:y,commit_timestamp:g,eventType:w,new:{},old:{},errors:v}),this._getPayloadRecords(m))}p.callback(h,r)})}_isClosed(){return this.state===Vi.closed}_isJoined(){return this.state===Vi.joined}_isJoining(){return this.state===Vi.joining}
91_isLeaving(){return this.state===Vi.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,n,r){const i=e.toLocaleLowerCase(),s={type:i,filter:n,callback:r};return this.bindings[i]?this.bindings[i].push(s):this.bindings[i]=[s],this}_off(e,n){const r=e.toLocaleLowerCase();return this.bindings[r]&&(this.bindings[r]=this.bindings[r].filter(i=>{var s;return!(((s=i.type)===null||s===void 0?void 0:s.toLocaleLowerCase())===r&&sy.isEqual(i.filter,n))})),this}static isEqual(e,n){if(Object.keys(e).length!==Object.keys(n).length)return!1;for(const r in e)if(e[r]!==n[r])return!1;return!0}static isFilterValueEqual(e,n){return(e??void 0)===(n??void 0)}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(Ul.close,{},e)}_onError(e){this._on(Ul.error,{},n=>e(n))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=Vi.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const n={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(n.new=D7(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(n.old=D7(e.columns,e.old_record)),n}}const ZO=()=>{},HN={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},XCe=[1e3,2e3,5e3,1e4],QCe=1e4,JCe=`
92  addEventListener("message", (e) => {
93    if (e.data.event === "start") {
94      setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
95    }
96  });`;class ZCe{constructor(e,n){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=k4,this.transport=null,this.heartbeatIntervalMs=HN.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=ZO,this.ref=0,this.reconnectTimer=null,this.vsn=I7,this.logger=ZO,this.conn=null,this.sendBuffer=[],this.serializer=new VCe,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._heartbeatSentAt=null,this._resolveFetch=i=>i?(...s)=>i(...s):(...s)=>fetch(...s),!(!((r=n==null?void 0:n.params)===null||r===void 0)&&r.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=n.params.apikey,this.endPoint=`${e}/${E4.websocket}`,this.httpEndpoint=Vie(e),this._initializeOptions(n),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(n==null?void 0:n.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=LCe.createWebSocket(this.endpointURL())}catch(e){this._setConnectionState("disconnected");const n=e.message;throw n.includes("Node.js")?new Error(`${n}
97
98To use Realtime in Node.js, you need to provide a WebSocket implementation:
99
100Option 1: Use Node.js 22+ which has native WebSocket support
101Option 2: Install and provide the "ws" package:
102
103  npm install ws
104
105  import ws from "ws"
106  const client = new RealtimeClient(url, {
107    ...options,
108    transport: ws
109  })`):new Error(`WebSocket not available: ${n}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:this.vsn}))}disconnect(e,n){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,n??""):this.conn.close()),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){const n=await e.unsubscribe();return this.channels.length===0&&this.disconnect(),n}async removeAllChannels(){const e=await Promise.all(this.channels.map(n=>n.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,n,r){this.logger(e,n,r)}connectionState(){switch(this.conn&&this.conn.readyState){case vf.connecting:return $p.Connecting;case vf.open:return $p.Open;case vf.closing:return $p.Closing;default:return $p.Closed}}isConnected(){return this.connectionState()===$p.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}
109channel(e,n={config:{}}){const r=`realtime:${e}`,i=this.getChannels().find(s=>s.topic===r);if(i)return i;{const s=new sy(`realtime:${e}`,n,this);return this.channels.push(s),s}}push(e){const{topic:n,event:r,payload:i,ref:s}=e,a=()=>{this.encode(e,l=>{var c;(c=this.conn)===null||c===void 0||c.send(l)})};this.log("push",`${n} ${r} (${s})`,i),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(n){this.log("error","error in heartbeat callback",n)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this._heartbeatSentAt=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(n){this.log("error","error in heartbeat callback",n)}this._wasManualDisconnect=!1,(e=this.conn)===null||e===void 0||e.close(zCe,"heartbeat timeout"),setTimeout(()=>{var n;this.isConnected()||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout()},HN.HEARTBEAT_TIMEOUT_FALLBACK);return}this._heartbeatSentAt=Date.now(),this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(n){this.log("error","error in heartbeat callback",n)}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 n=this.channels.find(r=>r.topic===e&&(r._isJoined()||r._isJoining()));n&&(this.log("transport",`leaving duplicate topic "${e}"`),n.unsubscribe())}_remove(e){this.channels=this.channels.filter(n=>n.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,n=>{if(n.topic==="phoenix"&&n.event==="phx_reply"&&n.ref&&n.ref===this.pendingHeartbeatRef){const u=this._heartbeatSentAt?Date.now()-this._heartbeatSentAt:void 0;try{this.heartbeatCallback(n.payload.status==="ok"?"ok":"error",u)}catch(d){this.log("error","error in heartbeat callback",d)}this._heartbeatSentAt=null,this.pendingHeartbeatRef=null}const{topic:r,event:i,payload:s,ref:a}=n,l=a?`(${a})`:"",c=s.status||"";this.log("receive",`${c} ${r} ${i} ${l}`.trim(),s),this.channels.filter(u=>u._isMember(r)).forEach(u=>u._trigger(i,s,a)),this._triggerStateCallbacks("message",n)})}_clearTimer(e){var n;e==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):e==="reconnect"&&((n=this.reconnectTimer)===null||n===void 0||n.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===vf.open&&this._onConnOpen())}_teardownConnection(){if(this.conn){if(this.conn.readyState===vf.open||this.conn.readyState===vf.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(n=>{this.log("error","error waiting for auth on connect",n),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=n=>{this.log("worker","worker error",n.message),this._terminateWorker()},this.workerRef.onmessage=n=>{n.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 n;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout(),this._triggerStateCallbacks("close",e)}_onConnError(e){this._setConnectionState("disconnected"),this.log("transport",`${e}`),this._triggerChanError(),this._triggerStateCallbacks("error",e)}
109_triggerChanError(){this.channels.forEach(e=>e._trigger(Ul.error))}_appendParams(e,n){if(Object.keys(n).length===0)return e;const r=e.match(/\?/)?"&":"?",i=new URLSearchParams(n);return`${e}${r}${i}`}_workerObjectUrl(e){let n;if(e)n=e;else{const r=new Blob([JCe],{type:"application/javascript"});n=URL.createObjectURL(r)}return n}_setConnectionState(e,n=!1){this._connectionState=e,e==="connecting"?this._wasManualDisconnect=!1:e==="disconnecting"&&(this._wasManualDisconnect=n)}async _performAuth(e=null){let n,r=!1;if(e)n=e,r=!0;else if(this.accessToken)try{n=await this.accessToken()}catch(i){this.log("error","Error fetching access token from callback",i),n=this.accessTokenValue}else n=this.accessTokenValue;r?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=n&&(this.accessTokenValue=n,this.channels.forEach(i=>{const s={access_token:n,version:FCe};n&&i.updateJoinPayload(s),i.joinedOnce&&i._isJoined()&&i._push(Ul.access_token,{access_token:n})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(n=>{this.log("error",`Error setting auth in ${e}`,n)})}_triggerStateCallbacks(e,n){try{this.stateChangeCallbacks[e].forEach(r=>{try{r(n)}catch(i){this.log("error",`error in ${e} callback`,i)}})}catch(r){this.log("error",`error triggering ${e} callbacks`,r)}}_setupReconnectionTimer(){this.reconnectTimer=new zie(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},HN.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var n,r,i,s,a,l,c,u,d,f,h,p;switch(this.transport=(n=e==null?void 0:e.transport)!==null&&n!==void 0?n:null,this.timeout=(r=e==null?void 0:e.timeout)!==null&&r!==void 0?r:k4,this.heartbeatIntervalMs=(i=e==null?void 0:e.heartbeatIntervalMs)!==null&&i!==void 0?i:HN.HEARTBEAT_INTERVAL,this.worker=(s=e==null?void 0:e.worker)!==null&&s!==void 0?s:!1,this.accessToken=(a=e==null?void 0:e.accessToken)!==null&&a!==void 0?a:null,this.heartbeatCallback=(l=e==null?void 0:e.heartbeatCallback)!==null&&l!==void 0?l:ZO,this.vsn=(c=e==null?void 0:e.vsn)!==null&&c!==void 0?c:I7,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=>XCe[m-1]||QCe,this.vsn){case Uie:this.encode=(d=e==null?void 0:e.encode)!==null&&d!==void 0?d:(m,x)=>x(JSON.stringify(m)),this.decode=(f=e==null?void 0:e.decode)!==null&&f!==void 0?f:(m,x)=>x(JSON.parse(m));break;case UCe:this.encode=(h=e==null?void 0:e.encode)!==null&&h!==void 0?h: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 D1=class extends Error{constructor(t,e){var n;super(t),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)&&((n=e.icebergType)==null?void 0:n.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function eke(t,e,n){const r=new URL(e,t);if(n)for(const[i,s]of Object.entries(n))s!==void 0&&r.searchParams.set(i,s);return r.toString()}async function tke(t){return!t||t.type==="none"?{}:t.type==="bearer"?{Authorization:`Bearer ${t.token}`}:t.type==="header"?{[t.name]:t.value}:t.type==="custom"?await t.getHeaders():{}}function nke(t){const e=t.fetchImpl??globalThis.fetch;return{async request({method:n,path:r,query:i,body:s,headers:a}){const l=eke(t.baseUrl,r,i),c=await tke(t.auth),u=await e(l,{method:n,headers:{...s?{"Content-Type":"application/json"}:{},...c,...a},body:s?JSON.stringify(s):void 0}),d=await u.text(),f=(u.headers.get("content-type")||"").includes("application/json"),h=f&&d?JSON.parse(d):d;if(!u.ok){const p=f?h:void 0,m=p==null?void 0:p.error;throw new D1((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:h}}}}function WN(t){return t.join("�")}var rke=class{constructor(t,e=""){this.client=t,this.prefix=e}async listNamespaces(t){const e=t?{parent:WN(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:e})).data.namespaces.map(r=>({namespace:r}))}async createNamespace(t,e){const n={namespace:t.namespace,properties:e==null?void 0:e.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:n})).data}async dropNamespace(t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${WN(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${WN(t.namespace)}`})).data.properties}}async namespaceExists(t){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${WN(t.namespace)}`}),!0}catch(e){if(e instanceof D1&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(t,e){try{return await this.createNamespace(t,e)}catch(n){if(n instanceof D1&&n.status===409)return;throw n}}};function qg(t){return t.join("�")}var ike=class{constructor(t,e="",n){this.client=t,this.prefix=e,this.accessDelegation=n}async listTables(t){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${qg(t.namespace)}/tables`})).data.identifiers}async createTable(t,e){const n={};return this.accessDelegation&&(n["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${qg(t.namespace)}/tables`,body:e,headers:n})).data.metadata}async updateTable(t,e){const n=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${qg(t.namespace)}
109/tables/${t.name}`,body:e});return{"metadata-location":n.data["metadata-location"],metadata:n.data.metadata}}async dropTable(t,e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${qg(t.namespace)}/tables/${t.name}`,query:{purgeRequested:String((e==null?void 0:e.purge)??!1)}})}async loadTable(t){const e={};return this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${qg(t.namespace)}/tables/${t.name}`,headers:e})).data.metadata}async tableExists(t){const e={};this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${qg(t.namespace)}/tables/${t.name}`,headers:e}),!0}catch(n){if(n instanceof D1&&n.status===404)return!1;throw n}}async createTableIfNotExists(t,e){try{return await this.createTable(t,e)}catch(n){if(n instanceof D1&&n.status===409)return await this.loadTable({namespace:t.namespace,name:e.name});throw n}}},ske=class{constructor(t){var r;let e="v1";t.catalogName&&(e+=`/${t.catalogName}`);const n=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=nke({baseUrl:n,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=(r=t.accessDelegation)==null?void 0:r.join(","),this.namespaceOps=new rke(this.client,e),this.tableOps=new ike(this.client,e,this.accessDelegation)}async listNamespaces(t){return this.namespaceOps.listNamespaces(t)}async createNamespace(t,e){return this.namespaceOps.createNamespace(t,e)}async dropNamespace(t){await this.namespaceOps.dropNamespace(t)}async loadNamespaceMetadata(t){return this.namespaceOps.loadNamespaceMetadata(t)}async listTables(t){return this.tableOps.listTables(t)}async createTable(t,e){return this.tableOps.createTable(t,e)}async updateTable(t,e){return this.tableOps.updateTable(t,e)}async dropTable(t,e){await this.tableOps.dropTable(t,e)}async loadTable(t){return this.tableOps.loadTable(t)}async namespaceExists(t){return this.namespaceOps.namespaceExists(t)}async tableExists(t){return this.tableOps.tableExists(t)}async createNamespaceIfNotExists(t,e){return this.namespaceOps.createNamespaceIfNotExists(t,e)}async createTableIfNotExists(t,e){return this.tableOps.createTableIfNotExists(t,e)}},mT=class extends Error{constructor(t){super(t),this.__isStorageError=!0,this.name="StorageError"}};function Zr(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var ake=class extends mT{constructor(t,e,n){super(t),this.name="StorageApiError",this.status=e,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},T4=class extends mT{constructor(t,e){super(t),this.name="StorageUnknownError",this.originalError=e}};const uz=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),oke=()=>Response,M4=t=>{if(Array.isArray(t))return t.map(n=>M4(n));if(typeof t=="function"||t!==Object(t))return t;const e={};return Object.entries(t).forEach(([n,r])=>{const i=n.replace(/([-_][a-z])/gi,s=>s.toUpperCase().replace(/[-_]/g,""));e[i]=M4(r)}),e},lke=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},cke=t=>!t||typeof t!="string"||t.length===0||t.length>100||t.trim()!==t||t.includes("/")||t.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(t);function L1(t){"@babel/helpers - typeof";return L1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},L1(t)}function uke(t,e){if(L1(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(L1(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function dke(t){var e=uke(t,"string");return L1(e)=="symbol"?e:e+""}function fke(t,e,n){return(e=dke(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function F7(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Qt(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};
109e%2?F7(Object(n),!0).forEach(function(r){fke(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):F7(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}const eR=t=>{var e;return t.msg||t.message||t.error_description||(typeof t.error=="string"?t.error:(e=t.error)===null||e===void 0?void 0:e.message)||JSON.stringify(t)},hke=async(t,e,n)=>{t instanceof await oke()&&!(n!=null&&n.noResolveJson)?t.json().then(r=>{const i=t.status||500,s=(r==null?void 0:r.statusCode)||i+"";e(new ake(eR(r),i,s))}).catch(r=>{e(new T4(eR(r),r))}):e(new T4(eR(t),t))},pke=(t,e,n,r)=>{const i={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"||!r?i:(lke(r)?(i.headers=Qt({"Content-Type":"application/json"},e==null?void 0:e.headers),i.body=JSON.stringify(r)):i.body=r,e!=null&&e.duplex&&(i.duplex=e.duplex),Qt(Qt({},i),n))};async function wS(t,e,n,r,i,s){return new Promise((a,l)=>{t(n,pke(e,r,i,s)).then(c=>{if(!c.ok)throw c;return r!=null&&r.noResolveJson?c:c.json()}).then(c=>a(c)).catch(c=>hke(c,l,r))})}async function $1(t,e,n,r){return wS(t,"GET",e,n,r)}async function Dl(t,e,n,r,i){return wS(t,"POST",e,r,i,n)}async function P4(t,e,n,r,i){return wS(t,"PUT",e,r,i,n)}async function mke(t,e,n,r){return wS(t,"HEAD",e,Qt(Qt({},n),{},{noResolveJson:!0}),r)}async function dz(t,e,n,r,i){return wS(t,"DELETE",e,r,i,n)}var gke=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e}then(t,e){return this.execute().then(t,e)}async execute(){var t=this;try{return{data:(await t.downloadFn()).body,error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(Zr(e))return{data:null,error:e};throw e}}};let Hie;Hie=Symbol.toStringTag;var xke=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[Hie]="BlobDownloadBuilder",this.promise=null}asStream(){return new gke(this.downloadFn,this.shouldThrowOnError)}then(t,e){return this.getPromise().then(t,e)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var t=this;try{return{data:await(await t.downloadFn()).blob(),error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(Zr(e))return{data:null,error:e};throw e}}};const yke={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},U7={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var vke=class{constructor(t,e={},n,r){this.shouldThrowOnError=!1,this.url=t,this.headers=e,this.bucketId=n,this.fetch=uz(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async uploadOrUpdate(t,e,n,r){var i=this;try{let s;const a=Qt(Qt({},U7),r);let l=Qt(Qt({},i.headers),t==="POST"&&{"x-upsert":String(a.upsert)});const c=a.metadata;typeof Blob<"u"&&n instanceof Blob?(s=new FormData,s.append("cacheControl",a.cacheControl),c&&s.append("metadata",i.encodeMetadata(c)),s.append("",n)):typeof FormData<"u"&&n instanceof FormData?(s=n,s.has("cacheControl")||s.append("cacheControl",a.cacheControl),c&&!s.has("metadata")&&s.append("metadata",i.encodeMetadata(c))):(s=n,l["cache-control"]=`max-age=${a.cacheControl}`,l["content-type"]=a.contentType,c&&(l["x-metadata"]=i.toBase64(i.encodeMetadata(c))),(typeof ReadableStream<"u"&&s instanceof ReadableStream||s&&typeof s=="object"&&"pipe"in s&&typeof s.pipe=="function")&&!a.duplex&&(a.duplex="half")),r!=null&&r.headers&&(l=Qt(Qt({},l),r.headers));const u=i._removeEmptyFolders(e),d=i._getFinalPath(u),f=await(t=="PUT"?P4:Dl)(i.fetch,`${i.url}/object/${d}`,s,Qt({headers:l},a!=null&&a.duplex?{duplex:a.duplex}:{}));return{data:{path:u,id:f.Id,fullPath:f.Key},error:null}}catch(s){if(i.shouldThrowOnError)throw s;if(Zr(s))return{data:null,error:s};throw s}}async upload(t,e,n){return this.uploadOrUpdate("POST",t,e,n)}async uploadToSignedUrl(t,e,n,r){var i=this;const s=i._removeEmptyFolders(t),a=i._getFinalPath(s),l=new URL(i.url+`/object/upload/sign/${a}`);l.searchParams.set("token",e);try{let c;const u=Qt({upsert:U7.upsert},r),d=Qt(Qt({},i.headers),{"x-upsert":String(u.upsert)});return typeof Blob<"u"&&n instanceof Blob?(c=new FormData,c.append("cacheControl",u.cacheControl),c.append("",n)):typeof FormData<"u"&&n instanceof FormData?(c=n,c.append("cacheControl",u.cacheControl)):(c=n,d["cache-control"]=`max-age=${u.cacheControl}`,d["content-type"]=u.contentType),{data:{path:s,fullPath:(await P4(i.fetch,l.toString(),c,{headers:d})).Key},error:null}}catch(c){if(i.shouldThrowOnError)throw c;if(Zr(c))return{data:null,error:c};throw c}}async createSignedUploadUrl(t,e){var n=this;try{let r=n._getFinalPath(t);const i=Qt({},n.headers);e!=null&&e.upsert&&(i["x-upsert"]="true");const s=await Dl(n.fetch,`${n.url}/object/upload/sign/${r}`,{},{headers:i}),a=new URL(n.url+s.url),l=a.searchParams.get("token");if(!l)throw new mT("No token returned by API");return{data:{signedUrl:a.toString(),path:t,token:l},error:null}}catch(r){if(n.shouldThrowOnError)throw r;if(Zr(r))return{data:null,error:r};throw r}}async update(t,e,n){return this.uploadOrUpdate("PUT",t,e,n)}async move(t,e,n){var r=this;try{return{data:await Dl(r.fetch,`${r.url}/object/move`,{bucketId:r.bucketId,sourceKey:t,destinationKey:e,destinationBucket:n==null?void 0:n.destinationBucket},{headers:r.headers}),error:null}}catch(i){if(r.shouldThrowOnError)throw i;if(Zr(i))return{data:null,error:i};throw i}}async copy(t,e,n){var r=this;try{return{data:{path:(await Dl(r.fetch,`${r.url}/object/copy`,{bucketId:r.bucketId,sourceKey:t,destinationKey:e,destinationBucket:n==null?void 0:n.destinationBucket},{headers:r.headers})).Key},error:null}}catch(i){if(r.shouldThrowOnError)throw i;if(Zr(i))return{data:null,error:i};throw i}}async createSignedUrl(t,e,n){var r=this;try{let i=r._getFinalPath(t),s=await Dl(r.fetch,`${r.url}/object/sign/${i}
109`,Qt({expiresIn:e},n!=null&&n.transform?{transform:n.transform}:{}),{headers:r.headers});const a=n!=null&&n.download?`&download=${n.download===!0?"":n.download}`:"";return s={signedUrl:encodeURI(`${r.url}${s.signedURL}${a}`)},{data:s,error:null}}catch(i){if(r.shouldThrowOnError)throw i;if(Zr(i))return{data:null,error:i};throw i}}async createSignedUrls(t,e,n){var r=this;try{const i=await Dl(r.fetch,`${r.url}/object/sign/${r.bucketId}`,{expiresIn:e,paths:t},{headers:r.headers}),s=n!=null&&n.download?`&download=${n.download===!0?"":n.download}`:"";return{data:i.map(a=>Qt(Qt({},a),{},{signedUrl:a.signedURL?encodeURI(`${r.url}${a.signedURL}${s}`):null})),error:null}}catch(i){if(r.shouldThrowOnError)throw i;if(Zr(i))return{data:null,error:i};throw i}}download(t,e){const n=typeof(e==null?void 0:e.transform)<"u"?"render/image/authenticated":"object",r=this.transformOptsToQueryString((e==null?void 0:e.transform)||{}),i=r?`?${r}`:"",s=this._getFinalPath(t),a=()=>$1(this.fetch,`${this.url}/${n}/${s}${i}`,{headers:this.headers,noResolveJson:!0});return new xke(a,this.shouldThrowOnError)}async info(t){var e=this;const n=e._getFinalPath(t);try{return{data:M4(await $1(e.fetch,`${e.url}/object/info/${n}`,{headers:e.headers})),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(Zr(r))return{data:null,error:r};throw r}}async exists(t){var e=this;const n=e._getFinalPath(t);try{return await mke(e.fetch,`${e.url}/object/${n}`,{headers:e.headers}),{data:!0,error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(Zr(r)&&r instanceof T4){const i=r.originalError;if([400,404].includes(i==null?void 0:i.status))return{data:!1,error:r}}throw r}}getPublicUrl(t,e){const n=this._getFinalPath(t),r=[],i=e!=null&&e.download?`download=${e.download===!0?"":e.download}`:"";i!==""&&r.push(i);const s=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 l=r.join("&");return l!==""&&(l=`?${l}`),{data:{publicUrl:encodeURI(`${this.url}/${s}/public/${n}${l}`)}}}async remove(t){var e=this;try{return{data:await dz(e.fetch,`${e.url}/object/${e.bucketId}`,{prefixes:t},{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Zr(n))return{data:null,error:n};throw n}}async list(t,e,n){var r=this;try{const i=Qt(Qt(Qt({},yke),e),{},{prefix:t||""});return{data:await Dl(r.fetch,`${r.url}/object/list/${r.bucketId}`,i,{headers:r.headers},n),error:null}}catch(i){if(r.shouldThrowOnError)throw i;if(Zr(i))return{data:null,error:i};throw i}}async listV2(t,e){var n=this;try{const r=Qt({},t);return{data:await Dl(n.fetch,`${n.url}/object/list-v2/${n.bucketId}`,r,{headers:n.headers},e),error:null}}catch(r){if(n.shouldThrowOnError)throw r;if(Zr(r))return{data:null,error:r};throw r}}encodeMetadata(t){return JSON.stringify(t)}toBase64(t){return typeof Buffer<"u"?Buffer.from(t).toString("base64"):btoa(t)}_getFinalPath(t){return`${this.bucketId}/${t.replace(/^\/+/,"")}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(t){const e=[];return t.width&&e.push(`width=${t.width}`),t.height&&e.push(`height=${t.height}`),t.resize&&e.push(`resize=${t.resize}`),t.format&&e.push(`format=${t.format}`),t.quality&&e.push(`quality=${t.quality}`),e.join("&")}};const Wie="2.90.1",Gie={"X-Client-Info":`storage-js/${Wie}`};var bke=class{constructor(t,e={},n,r){this.shouldThrowOnError=!1;const i=new URL(t);r!=null&&r.useNewHostname&&/supabase\.(co|in|red)$/.test(i.hostname)&&!i.hostname.includes("storage.supabase.")&&(i.hostname=i.hostname.replace("supabase.","storage.supabase.")),this.url=i.href.replace(/\/$/,""),this.headers=Qt(Qt({},Gie),e),this.fetch=uz(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async listBuckets(t){var e=this;try{const n=e.listBucketOptionsToQueryString(t);return{data:await $1(e.fetch,`${e.url}/bucket${n}`,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Zr(n))return{data:null,error:n};throw n}}async getBucket(t){var e=this;try{return{data:await $1(e.fetch,`${e.url}/bucket/${t}`,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Zr(n))return{data:null,error:n};throw n}}async createBucket(t,e={public:!1}){var n=this;try{return{data:await Dl(n.fetch,`${n.url}/bucket`,{id:t,name:t,type:e.type,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:n.headers}),error:null}}catch(r){if(n.shouldThrowOnError)throw r;if(Zr(r))return{data:null,error:r};throw r}}async updateBucket(t,e){var n=this;try{return{data:await P4(n.fetch,`${n.url}/bucket/${t}`,{id:t,name:t,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:n.headers}),error:null}}catch(r){if(n.shouldThrowOnError)throw r;if(Zr(r))return{data:null,error:r};throw r}}async emptyBucket(t){var e=this;try{return{data:await Dl(e.fetch,`${e.url}/bucket/${t}/empty`,{},{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Zr(n))return{data:null,error:n};throw n}}async deleteBucket(t){var e=this;try{return{data:await dz(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Zr(n))return{data:null,error:n};throw n}}listBucketOptionsToQueryString(t){const e={};return t&&("limit"in t&&(e.limit=String(t.limit)),"offset"in t&&(e.offset=String(t.offset)),t.search&&(e.search=t.search),t.sortColumn&&(e.sortColumn=t.sortColumn),t.sortOrder&&(e.sortOrder=t.sortOrder)),Object.keys(e).length>0?"?"+new URLSearchParams(e).toString():""}},wke=class{constructor(t,e={},n){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=Qt(Qt({},Gie),e),this.fetch=uz(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(t){var e=this;try{return{data:await Dl(e.fetch,`${e.url}/bucket`,{name:t},{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Zr(n))return{data:null,error:n};throw n}}async listBuckets(t){var e=this;try{const n=new URLSearchParams;(t==null?void 0:t.limit)!==void 0&&n.set("limit",t.limit.toString()),(t==null?void 0:t.offset)!==void 0&&n.set("offset",t.offset.toString()),t!=null&&t.sortColumn&&n.set("sortColumn",t.sortColumn),t!=null&&t.sortOrder&&n.set("sortOrder",t.sortOrder),t!=null&&t.search&&n.set("search",t.search);const r=n.toString(),i=r?`${e.url}/bucket?${r}`:`${e.url}/bucket`;return{data:await $1(e.fetch,i,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Zr(n))return{data:null,error:n};throw n}}async deleteBucket(t){var e=this;try{return{data:await dz(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Zr(n))return{data:null,error:n};throw n}}from(t){var e=this;if(!cke(t))throw new mT("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 n=new ske({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:async()=>e.headers},fetch:this.fetch}
109),r=this.shouldThrowOnError;return new Proxy(n,{get(i,s){const a=i[s];return typeof a!="function"?a:async(...l)=>{try{return{data:await a.apply(i,l),error:null}}catch(c){if(r)throw c;return{data:null,error:c}}}}})}};const fz={"X-Client-Info":`storage-js/${Wie}`,"Content-Type":"application/json"};var qie=class extends Error{constructor(t){super(t),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};function fo(t){return typeof t=="object"&&t!==null&&"__isStorageVectorsError"in t}var tR=class extends qie{constructor(t,e,n){super(t),this.name="StorageVectorsApiError",this.status=e,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},_ke=class extends qie{constructor(t,e){super(t),this.name="StorageVectorsUnknownError",this.originalError=e}};const hz=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),Ske=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},z7=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),Nke=async(t,e,n)=>{if(t&&typeof t=="object"&&"status"in t&&"ok"in t&&typeof t.status=="number"&&!(n!=null&&n.noResolveJson)){const r=t.status||500,i=t;if(typeof i.json=="function")i.json().then(s=>{const a=(s==null?void 0:s.statusCode)||(s==null?void 0:s.code)||r+"";e(new tR(z7(s),r,a))}).catch(()=>{const s=r+"";e(new tR(i.statusText||`HTTP ${r} error`,r,s))});else{const s=r+"";e(new tR(i.statusText||`HTTP ${r} error`,r,s))}}else e(new _ke(z7(t),t))},jke=(t,e,n,r)=>{const i={method:t,headers:(e==null?void 0:e.headers)||{}};return r?(Ske(r)?(i.headers=Qt({"Content-Type":"application/json"},e==null?void 0:e.headers),i.body=JSON.stringify(r)):i.body=r,Qt(Qt({},i),n)):i};async function Cke(t,e,n,r,i,s){return new Promise((a,l)=>{t(n,jke(e,r,i,s)).then(c=>{if(!c.ok)throw c;if(r!=null&&r.noResolveJson)return c;const u=c.headers.get("content-type");return!u||!u.includes("application/json")?{}:c.json()}).then(c=>a(c)).catch(c=>Nke(c,l,r))})}async function ho(t,e,n,r,i){return Cke(t,"POST",e,r,i,n)}var kke=class{constructor(t,e={},n){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=Qt(Qt({},fz),e),this.fetch=hz(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async createIndex(t){var e=this;try{return{data:await ho(e.fetch,`${e.url}/CreateIndex`,t,{headers:e.headers})||{},error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(fo(n))return{data:null,error:n};throw n}}async getIndex(t,e){var n=this;try{return{data:await ho(n.fetch,`${n.url}/GetIndex`,{vectorBucketName:t,indexName:e},{headers:n.headers}),error:null}}catch(r){if(n.shouldThrowOnError)throw r;if(fo(r))return{data:null,error:r};throw r}}async listIndexes(t){var e=this;try{return{data:await ho(e.fetch,`${e.url}/ListIndexes`,t,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(fo(n))return{data:null,error:n};throw n}}async deleteIndex(t,e){var n=this;try{return{data:await ho(n.fetch,`${n.url}/DeleteIndex`,{vectorBucketName:t,indexName:e},{headers:n.headers})||{},error:null}}catch(r){if(n.shouldThrowOnError)throw r;if(fo(r))return{data:null,error:r};throw r}}},Eke=class{constructor(t,e={},n){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=Qt(Qt({},fz),e),this.fetch=hz(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async putVectors(t){var e=this;try{if(t.vectors.length<1||t.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return{data:await ho(e.fetch,`${e.url}/PutVectors`,t,{headers:e.headers})||{},error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(fo(n))return{data:null,error:n};throw n}}async getVectors(t){var e=this;try{return{data:await ho(e.fetch,`${e.url}/GetVectors`,t,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(fo(n))return{data:null,error:n};throw n}}async listVectors(t){var e=this;try{if(t.segmentCount!==void 0){if(t.segmentCount<1||t.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");
109if(t.segmentIndex!==void 0&&(t.segmentIndex<0||t.segmentIndex>=t.segmentCount))throw new Error(`segmentIndex must be between 0 and ${t.segmentCount-1}`)}return{data:await ho(e.fetch,`${e.url}/ListVectors`,t,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(fo(n))return{data:null,error:n};throw n}}async queryVectors(t){var e=this;try{return{data:await ho(e.fetch,`${e.url}/QueryVectors`,t,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(fo(n))return{data:null,error:n};throw n}}async deleteVectors(t){var e=this;try{if(t.keys.length<1||t.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return{data:await ho(e.fetch,`${e.url}/DeleteVectors`,t,{headers:e.headers})||{},error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(fo(n))return{data:null,error:n};throw n}}},Ake=class{constructor(t,e={},n){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=Qt(Qt({},fz),e),this.fetch=hz(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(t){var e=this;try{return{data:await ho(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{},error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(fo(n))return{data:null,error:n};throw n}}async getBucket(t){var e=this;try{return{data:await ho(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:t},{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(fo(n))return{data:null,error:n};throw n}}async listBuckets(t={}){var e=this;try{return{data:await ho(e.fetch,`${e.url}/ListVectorBuckets`,t,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(fo(n))return{data:null,error:n};throw n}}async deleteBucket(t){var e=this;try{return{data:await ho(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{},error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(fo(n))return{data:null,error:n};throw n}}},Tke=class extends Ake{constructor(t,e={}){super(t,e.headers||{},e.fetch)}from(t){return new Mke(this.url,this.headers,t,this.fetch)}async createBucket(t){var e=()=>super.createBucket,n=this;return e().call(n,t)}async getBucket(t){var e=()=>super.getBucket,n=this;return e().call(n,t)}async listBuckets(t={}){var e=()=>super.listBuckets,n=this;return e().call(n,t)}async deleteBucket(t){var e=()=>super.deleteBucket,n=this;return e().call(n,t)}},Mke=class extends kke{constructor(t,e,n,r){super(t,e,r),this.vectorBucketName=n}async createIndex(t){var e=()=>super.createIndex,n=this;return e().call(n,Qt(Qt({},t),{},{vectorBucketName:n.vectorBucketName}))}async listIndexes(t={}){var e=()=>super.listIndexes,n=this;return e().call(n,Qt(Qt({},t),{},{vectorBucketName:n.vectorBucketName}))}async getIndex(t){var e=()=>super.getIndex,n=this;return e().call(n,n.vectorBucketName,t)}async deleteIndex(t){var e=()=>super.deleteIndex,n=this;return e().call(n,n.vectorBucketName,t)}index(t){return new Pke(this.url,this.headers,this.vectorBucketName,t,this.fetch)}},Pke=class extends Eke{constructor(t,e,n,r,i){super(t,e,i),this.vectorBucketName=n,this.indexName=r}async putVectors(t){var e=()=>super.putVectors,n=this;return e().call(n,Qt(Qt({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async getVectors(t){var e=()=>super.getVectors,n=this;return e().call(n,Qt(Qt({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async listVectors(t={}){var e=()=>super.listVectors,n=this;return e().call(n,Qt(Qt({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async queryVectors(t){var e=()=>super.queryVectors,n=this;return e().call(n,Qt(Qt({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async deleteVectors(t){var e=()=>super.deleteVectors,n=this;return e().call(n,Qt(Qt({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}},Oke=class extends bke{constructor(t,e={},n,r){super(t,e,n,r)}from(t){return new vke(this.url,this.headers,t,this.fetch)}get vectors(){return new Tke(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new wke(this.url+"/iceberg",this.headers,this.fetch)}};const Kie="2.90.1",Ix=30*1e3,O4=3,nR=O4*Ix,Rke="http://localhost:9999",Ike="supabase.auth.token",Dke={"X-Client-Info":`gotrue-js/${Kie}`},R4="X-Supabase-Api-Version",Yie={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}}
109,Lke=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,$ke=10*60*1e3;class F1 extends Error{constructor(e,n,r){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=n,this.code=r}}function Tt(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class Fke extends F1{constructor(e,n,r){super(e,n,r),this.name="AuthApiError",this.status=n,this.code=r}}function Uke(t){return Tt(t)&&t.name==="AuthApiError"}class Fp extends F1{constructor(e,n){super(e),this.name="AuthUnknownError",this.originalError=n}}class Fd extends F1{constructor(e,n,r,i){super(e,r,i),this.name=n,this.status=r}}class ro extends Fd{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function zke(t){return Tt(t)&&t.name==="AuthSessionMissingError"}class Kg extends Fd{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class GN extends Fd{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class qN extends Fd{constructor(e,n=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function Bke(t){return Tt(t)&&t.name==="AuthImplicitGrantRedirectError"}class B7 extends Fd{constructor(e,n=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class Vke extends Fd{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 I4 extends Fd{constructor(e,n){super(e,"AuthRetryableFetchError",n,void 0)}}function rR(t){return Tt(t)&&t.name==="AuthRetryableFetchError"}class V7 extends Fd{constructor(e,n,r){super(e,"AuthWeakPasswordError",n,"weak_password"),this.reasons=r}}class D4 extends Fd{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const Kk="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),H7=` 	
110\r=`.split(""),Hke=(()=>{const t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<H7.length;e+=1)t[H7[e].charCodeAt(0)]=-2;for(let e=0;e<Kk.length;e+=1)t[Kk[e].charCodeAt(0)]=e;return t})();function W7(t,e,n){if(t!==null)for(e.queue=e.queue<<8|t,e.queuedBits+=8;e.queuedBits>=6;){const r=e.queue>>e.queuedBits-6&63;n(Kk[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;n(Kk[r]),e.queuedBits-=6}}function Xie(t,e,n){const r=Hke[t];if(r>-1)for(e.queue=e.queue<<6|r,e.queuedBits+=6;e.queuedBits>=8;)n(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(r===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function G7(t){const e=[],n=a=>{e.push(String.fromCodePoint(a))},r={utf8seq:0,codepoint:0},i={queue:0,queuedBits:0},s=a=>{qke(a,r,n)};for(let a=0;a<t.length;a+=1)Xie(t.charCodeAt(a),i,s);return e.join("")}function Wke(t,e){if(t<=127){e(t);return}else if(t<=2047){e(192|t>>6),e(128|t&63);return}else if(t<=65535){e(224|t>>12),e(128|t>>6&63),e(128|t&63);return}else if(t<=1114111){e(240|t>>18),e(128|t>>12&63),e(128|t>>6&63),e(128|t&63);return}throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}function Gke(t,e){for(let n=0;n<t.length;n+=1){let r=t.charCodeAt(n);if(r>55295&&r<=56319){const i=(r-55296)*1024&65535;r=(t.charCodeAt(n+1)-56320&65535|i)+65536,n+=1}Wke(r,e)}}function qke(t,e,n){if(e.utf8seq===0){if(t<=127){n(t);return}for(let r=1;r<6;r+=1)if(!(t>>7-r&1)){e.utf8seq=r;break}if(e.utf8seq===2)e.codepoint=t&31;else if(e.utf8seq===3)e.codepoint=t&15;else if(e.utf8seq===4)e.codepoint=t&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(t<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|t&63,e.utf8seq-=1,e.utf8seq===0&&n(e.codepoint)}}function Sy(t){const e=[],n={queue:0,queuedBits:0},r=i=>{e.push(i)};for(let i=0;i<t.length;i+=1)Xie(t.charCodeAt(i),n,r);return new Uint8Array(e)}function Kke(t){const e=[];return Gke(t,n=>e.push(n)),new Uint8Array(e)}function Yp(t){const e=[],n={queue:0,queuedBits:0},r=i=>{e.push(i)};return t.forEach(i=>
110W7(i,n,r)),W7(null,n,r),e.join("")}function Yke(t){return Math.round(Date.now()/1e3)+t}function Xke(){return Symbol("auth-callback")}const Es=()=>typeof window<"u"&&typeof document<"u",dp={tested:!1,writable:!1},Qie=()=>{if(!Es())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(dp.tested)return dp.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),dp.tested=!0,dp.writable=!0}catch{dp.tested=!0,dp.writable=!1}return dp.writable};function Qke(t){const e={},n=new URL(t);if(n.hash&&n.hash[0]==="#")try{new URLSearchParams(n.hash.substring(1)).forEach((i,s)=>{e[s]=i})}catch{}return n.searchParams.forEach((r,i)=>{e[i]=r}),e}const Jie=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),Jke=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",Dx=async(t,e,n)=>{await t.setItem(e,JSON.stringify(n))},fp=async(t,e)=>{const n=await t.getItem(e);if(!n)return null;try{return JSON.parse(n)}catch{return n}},ks=async(t,e)=>{await t.removeItem(e)};class gT{constructor(){this.promise=new gT.promiseConstructor((e,n)=>{this.resolve=e,this.reject=n})}}gT.promiseConstructor=Promise;function iR(t){const e=t.split(".");if(e.length!==3)throw new D4("Invalid JWT structure");for(let r=0;r<e.length;r++)if(!Lke.test(e[r]))throw new D4("JWT not in base64url format");return{header:JSON.parse(G7(e[0])),payload:JSON.parse(G7(e[1])),signature:Sy(e[2]),raw:{header:e[0],payload:e[1]}}}async function Zke(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function e2e(t,e){return new Promise((r,i)=>{(async()=>{for(let s=0;s<1/0;s++)try{const a=await t(s);if(!e(s,null,a)){r(a);return}}catch(a){if(!e(s,a)){i(a);return}}})()})}function t2e(t){return("0"+t.toString(16)).substr(-2)}function n2e(){const e=new Uint32Array(56);if(typeof crypto>"u"){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r=n.length;let i="";for(let s=0;s<56;s++)i+=n.charAt(Math.floor(Math.random()*r));return i}return crypto.getRandomValues(e),Array.from(e,t2e).join("")}async function r2e(t){const n=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-256",n),i=new Uint8Array(r);return Array.from(i).map(s=>String.fromCharCode(s)).join("")}async function i2e(t){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),t;const n=await r2e(t);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Yg(t,e,n=!1){const r=n2e();let i=r;n&&(i+="/PASSWORD_RECOVERY"),await Dx(t,`${e}-code-verifier`,i);const s=await i2e(r);return[s,r===s?"plain":"s256"]}const s2e=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function a2e(t){const e=t.headers.get(R4);if(!e||!e.match(s2e))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function o2e(t){if(!t)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(t<=e)throw new Error("JWT has expired")}function l2e(t){switch(t){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const c2e=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Xg(t){if(!c2e.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function sR(){const t={};return new Proxy(t,{get:(e,n)=>{if(n==="__isUserNotAvailableProxy")return!0;if(typeof n=="symbol"){const r=n.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 "${n}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function u2e(t,e){return new Proxy(t,{get:(n,r,i)=>{if(r==="__isInsecureUserWarningProxy")return!0;
110if(typeof r=="symbol"){const s=r.toString();if(s==="Symbol(Symbol.toPrimitive)"||s==="Symbol(Symbol.toStringTag)"||s==="Symbol(util.inspect.custom)"||s==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(n,r,i)}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(n,r,i)}})}function q7(t){return JSON.parse(JSON.stringify(t))}const Tp=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),d2e=[502,503,504];async function K7(t){var e;if(!Jke(t))throw new I4(Tp(t),0);if(d2e.includes(t.status))throw new I4(Tp(t),t.status);let n;try{n=await t.json()}catch(s){throw new Fp(Tp(s),s)}let r;const i=a2e(t);if(i&&i.getTime()>=Yie["2024-01-01"].timestamp&&typeof n=="object"&&n&&typeof n.code=="string"?r=n.code:typeof n=="object"&&n&&typeof n.error_code=="string"&&(r=n.error_code),r){if(r==="weak_password")throw new V7(Tp(n),t.status,((e=n.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(r==="session_not_found")throw new ro}else if(typeof n=="object"&&n&&typeof n.weak_password=="object"&&n.weak_password&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.reasons.reduce((s,a)=>s&&typeof a=="string",!0))throw new V7(Tp(n),t.status,n.weak_password.reasons);throw new Fke(Tp(n),t.status||500,r)}const f2e=(t,e,n,r)=>{const i={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"?i:(i.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),i.body=JSON.stringify(r),Object.assign(Object.assign({},i),n))};async function Xt(t,e,n,r){var i;const s=Object.assign({},r==null?void 0:r.headers);s[R4]||(s[R4]=Yie["2024-01-01"].name),r!=null&&r.jwt&&(s.Authorization=`Bearer ${r.jwt}`);const a=(i=r==null?void 0:r.query)!==null&&i!==void 0?i:{};r!=null&&r.redirectTo&&(a.redirect_to=r.redirectTo);const l=Object.keys(a).length?"?"+new URLSearchParams(a).toString():"",c=await h2e(t,e,n+l,{headers:s,noResolveJson:r==null?void 0:r.noResolveJson},{},r==null?void 0:r.body);return r!=null&&r.xform?r==null?void 0:r.xform(c):{data:Object.assign({},c),error:null}}async function h2e(t,e,n,r,i,s){const a=f2e(e,r,i,s);let l;try{l=await t(n,Object.assign({},a))}catch(c){throw console.error(c),new I4(Tp(c),0)}if(l.ok||await K7(l),r!=null&&r.noResolveJson)return l;try{return await l.json()}catch(c){await K7(c)}}function Ol(t){var e;let n=null;g2e(t)&&(n=Object.assign({},t),t.expires_at||(n.expires_at=Yke(t.expires_in)));const r=(e=t.user)!==null&&e!==void 0?e:t;return{data:{session:n,user:r},error:null}}function Y7(t){const e=Ol(t);return!e.error&&t.weak_password&&typeof t.weak_password=="object"&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.message&&typeof t.weak_password.message=="string"&&t.weak_password.reasons.reduce((n,r)=>n&&typeof r=="string",!0)&&(e.data.weak_password=t.weak_password),e}function kf(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function p2e(t){return{data:t,error:null}}function m2e(t){const{action_link:e,email_otp:n,hashed_token:r,redirect_to:i,verification_type:s}=t,a=j0(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),l={action_link:e,email_otp:n,hashed_token:r,redirect_to:i,verification_type:s},c=Object.assign({},a);return{data:{properties:l,user:c},error:null}}function X7(t){return t}function g2e(t){return t.access_token&&t.refresh_token&&t.expires_in}const aR=["global","local","others"];class x2e{constructor({url:e="",headers:n={},fetch:r}){this.url=e,this.headers=n,this.fetch=Jie(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)}}
vendor: 4,781 bytes, line 110
110async signOut(e,n=aR[0]){if(aR.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${aR.join(", ")}`);try{return await Xt(this.fetch,"POST",`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(r){if(Tt(r))return{data:null,error:r};throw r}}async inviteUserByEmail(e,n={}){try{return await Xt(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:kf})}catch(r){if(Tt(r))return{data:{user:null},error:r};throw r}}async generateLink(e){try{const{options:n}=e,r=j0(e,["options"]),i=Object.assign(Object.assign({},r),n);return"newEmail"in r&&(i.new_email=r==null?void 0:r.newEmail,delete i.newEmail),await Xt(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:i,headers:this.headers,xform:m2e,redirectTo:n==null?void 0:n.redirectTo})}catch(n){if(Tt(n))return{data:{properties:null,user:null},error:n};throw n}}async createUser(e){try{return await Xt(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:kf})}catch(n){if(Tt(n))return{data:{user:null},error:n};throw n}}async listUsers(e){var n,r,i,s,a,l,c;try{const u={nextPage:null,lastPage:0,total:0},d=await Xt(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(n=e==null?void 0:e.page)===null||n===void 0?void 0:n.toString())!==null&&r!==void 0?r:"",per_page:(s=(i=e==null?void 0:e.perPage)===null||i===void 0?void 0:i.toString())!==null&&s!==void 0?s:""},xform:X7});if(d.error)throw d.error;const f=await d.json(),h=(a=d.headers.get("x-total-count"))!==null&&a!==void 0?a:0,p=(c=(l=d.headers.get("link"))===null||l===void 0?void 0:l.split(","))!==null&&c!==void 0?c:[];return p.length>0&&(p.forEach(m=>{const x=parseInt(m.split(";")[0].split("=")[1].substring(0,1)),y=JSON.parse(m.split(";")[1].split("=")[1]);u[`${y}Page`]=x}),u.total=parseInt(h)),{data:Object.assign(Object.assign({},f),u),error:null}}catch(u){if(Tt(u))return{data:{users:[]},error:u};throw u}}async getUserById(e){Xg(e);try{return await Xt(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:kf})}catch(n){if(Tt(n))return{data:{user:null},error:n};throw n}}async updateUserById(e,n){Xg(e);try{return await Xt(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:n,headers:this.headers,xform:kf})}catch(r){if(Tt(r))return{data:{user:null},error:r};throw r}}async deleteUser(e,n=!1){Xg(e);try{return await Xt(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:n},xform:kf})}catch(r){if(Tt(r))return{data:{user:null},error:r};throw r}}async _listFactors(e){Xg(e.userId);try{const{data:n,error:r}=await Xt(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:i=>({data:{factors:i},error:null})});return{data:n,error:r}}catch(n){if(Tt(n))return{data:null,error:n};throw n}}async _deleteFactor(e){Xg(e.userId),Xg(e.id);try{return{data:await Xt(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(n){if(Tt(n))return{data:null,error:n};throw n}}async _listOAuthClients(e){var n,r,i,s,a,l,c;try{const u={nextPage:null,lastPage:0,total:0},d=await Xt(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(n=e==null?void 0:e.page)===null||n===void 0?void 0:n.toString())!==null&&r!==void 0?r:"",per_page:(s=(i=e==null?void 0:e.perPage)===null||i===void 0?void 0:i.toString())!==null&&s!==void 0?s:""},xform:X7});if(d.error)throw d.error;const f=await d.json(),h=(a=d.headers.get("x-total-count"))!==null&&a!==void 0?a:0,p=(c=(l=d.headers.get("link"))===null||l===void 0?void 0:l.split(","))!==null&&c!==void 0?c:[];return p.length>0&&(p.forEach(m=>{const x=parseInt(m.split(";")[0].split("=")[1].substring(0,1)),y=JSON.parse(m.split(";")[1].split("=")[1]);u[`${y}Page`]=x}),u.total=parseInt(h)),{data:Object.assign(Object.assign({},f),u),error:null}}catch(u){if(Tt(u))return{data:{clients:[]},error:u};throw u}}async _createOAuthClient(e){try{return await Xt(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Tt(n))return{data:null,error:n};throw n}}async _getOAuthClient(e){try{return await Xt(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Tt(n))return{data:null,error:n};throw n}}async _updateOAuthClient(e,n){try{return await Xt(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:n,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(Tt(r))return{data:null,error:r};throw r}}async _deleteOAuthClient(e){try{return await Xt(this.fetch,"DELET
110E",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(Tt(n))return{data:null,error:n};throw n}}async _regenerateOAuthClientSecret(e){try{return await Xt(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Tt(n))return{data:null,error:n};throw n}}}function Q7(t={}){return{getItem:e=>t[e]||null,setItem:(e,n)=>{t[e]=n},removeItem:e=>{delete t[e]}}}const Qg={debug:!!(globalThis&&Qie()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class Zie extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class y2e extends Zie{}async function v2e(t,e,n){Qg.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);const r=new globalThis.AbortController;return e>0&&setTimeout(()=>{r.abort(),Qg.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",t)},e),await Promise.resolve().then(()=>globalThis.navigator.locks.request(t,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:r.signal},async i=>{if(i){Qg.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,i.name);try{return await n()}finally{Qg.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,i.name)}}else{if(e===0)throw Qg.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new y2e(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(Qg.debug)try{const s=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(s,null,"  "))}catch(s){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",s)}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 n()}}))}function b2e(){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 ese(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function w2e(t){return parseInt(t,16)}function _2e(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,r=>r.toString(16).padStart(2,"0")).join("")}function S2e(t){var e;const{chainId:n,domain:r,expirationTime:i,issuedAt:s=new Date,nonce:a,notBefore:l,requestId:c,resources:u,scheme:d,uri:f,version:h}=t;{if(!Number.isInteger(n))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${n}`);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(!f)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(h!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${h}`);if(!((e=t.statement)===null||e===void 0)&&e.includes(`
111`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${t.statement}`)}const p=ese(t.address),m=d?`${d}://${r}`:r,x=t.statement?`${t.statement}
112`:"",y=`${m} wants you to sign in with your Ethereum account:
113${p}
114
115${x}`;let g=`URI: ${f}
116Version: ${h}
117Chain ID: ${n}${a?`
118Nonce: ${a}`:""}
119Issued At: ${s.toISOString()}`;if(i&&(g+=`
120Expiration Time: ${i.toISOString()}`),l&&(g+=`
121Not Before: ${l.toISOString()}`),c&&(g+=`
122Request ID: ${c}`),u){let w=`
123Resources:`;for(const v of u){if(!v||typeof v!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${v}`);w+=`
124- ${v}`}g+=w}return`${y}
125${g}`}
125class ji extends Error{constructor({message:e,code:n,cause:r,name:i}){var s;super(e,{cause:r}),this.__isWebAuthnError=!0,this.name=(s=i??(r instanceof Error?r.name:void 0))!==null&&s!==void 0?s:"Unknown Error",this.code=n}}class Yk extends ji{constructor(e,n){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n,message:e}),this.name="WebAuthnUnknownError",this.originalError=n}}function N2e({error:t,options:e}){var n,r,i;const{publicKey:s}=e;if(!s)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new ji({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((n=s.authenticatorSelection)===null||n===void 0?void 0:n.requireResidentKey)===!0)return new ji({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(e.mediation==="conditional"&&((r=s.authenticatorSelection)===null||r===void 0?void 0:r.userVerification)==="required")return new ji({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((i=s.authenticatorSelection)===null||i===void 0?void 0:i.userVerification)==="required")return new ji({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new ji({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new ji({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return s.pubKeyCredParams.filter(l=>l.type==="public-key").length===0?new ji({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new ji({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){const a=window.location.hostname;if(tse(a)){if(s.rp.id!==a)return new ji({message:`The RP ID "${s.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new ji({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(s.user.id.byteLength<1||s.user.id.byteLength>64)return new ji({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.name==="UnknownError")return new ji({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new ji({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function j2e({error:t,options:e}){const{publicKey:n}=e;if(!n)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new ji({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new ji({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const r=window.location.hostname;if(tse(r)){if(n.rpId!==r)return new ji({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new ji({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new ji({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new ji({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}class C2e{createNewAbortSignal(){if(this.controller){const n=new Error("Cancelling existing WebAuthn API call for new one");n.name="AbortError",this.controller.abort(n)}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 k2e=new C2e;function E2e(t){if(!t)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(t);const{challenge:e,user:n,excludeCredentials:r}=t,i=j0(t,["challenge","user","excludeCredentials"]),s=Sy(e).buffer,a=Object.assign(Object.assign({},n),{id:Sy(n.id).buffer}),l=Object.assign(Object.assign({},i),{challenge:s,user:a});if(r&&r.length>0){l.excludeCredentials=new Array(r.length);for(let c=0;c<r.length;c++){const u=r[c];l.excludeCredentials[c]=Object.assign(Object.assign({},u),{id:Sy(u.id).buffer,type:u.type||"public-key",transports:u.transports})}}return l}function A2e(t){if(!t)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(t);const{challenge:e,allowCredentials:n}=t,r=j0(t,["challenge","allowCredentials"]),i=Sy(e).buffer,s=Object.assign(Object.assign({},r),{challenge:i});if(n&&n.length>0){s.allowCredentials=new Array(n.length);for(let a=0;a<n.length;a++){const l=n[a];s.allowCredentials[a]=Object.assign(Object.assign({},l),{id:Sy(l.id).buffer,type:l.type||"public-key",transports:l.transports})}}return s}function T2e(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const n=t;return{id:t.id,rawId:t.id,response:{attestationObject:Yp(new Uint8Array(t.response.attestationObject)),clientDataJSON:Yp(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=n.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function M2e(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const n=t,r=t.getClientExtensionResults(),i=t.response;return{id:t.id,rawId:t.id,response:{authenticatorData:Yp(new Uint8Array(i.authenticatorData)),clientDataJSON:Yp(new Uint8Array(i.clientDataJSON)),signature:Yp(new Uint8Array(i.signature)),userHandle:i.userHandle?Yp(new Uint8Array(i.userHandle)):void 0},type:"public-key",clientExtensionResults:r,authenticatorAttachment:(e=n.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function tse(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function J7(){var t,e;return!!(Es()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((t=navigator==null?void 0:navigator.credentials)===null||t===void 0?void 0:t.create)=="function"&&typeof((e=navigator==null?void 0:navigator.credentials)===null||e===void 0?void 0:e.get)=="function")}async function P2e(t){try{const e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Yk("Browser returned unexpected credential type",e)}:{data:null,error:new Yk("Empty credential response",e)}}catch(e){return{data:null,error:N2e({error:e,options:t})}}}async function O2e(t){try{const e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Yk("Browser returned unexpected credential type",e)}:{data:null,error:new Yk("Empty credential response",e)}}catch(e){return{data:null,error:j2e({error:e,options:t})}}}const R2e={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},I2e={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Xk(...t){const e=i=>i!==null&&typeof i=="object"&&!Array.isArray(i),n=i=>i instanceof ArrayBuffer||ArrayBuffer.isView(i),r={};for(const i of t)if(i)for(const s in i){const a=i[s];if(a!==void 0)if(Array.isArray(a))r[s]=a;else if(n(a))r[s]=a;else if(e(a)){const l=r[s];e(l)?r[s]=Xk(l,a):r[s]=Xk(a)}else r[s]=a}return r}function D2e(t,e){return Xk(R2e,t,e||{})}function L2e(t,e){return Xk(I2e,t,e||{})}class $2e{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:n,friendlyName:r,signal:i},s){try{const{data:a,error:l}=await this.client.mfa.challenge({factorId:e,webauthn:n});if(!a)return{data:null,error:l};const c=i??k2e.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)}
125switch(a.webauthn.type){case"create":{const u=D2e(a.webauthn.credential_options.publicKey,s==null?void 0:s.create),{data:d,error:f}=await P2e({publicKey:u,signal:c});return d?{data:{factorId:e,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:d}},error:null}:{data:null,error:f}}case"request":{const u=L2e(a.webauthn.credential_options.publicKey,s==null?void 0:s.request),{data:d,error:f}=await O2e(Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:u,signal:c}));return d?{data:{factorId:e,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:d}},error:null}:{data:null,error:f}}}}catch(a){return Tt(a)?{data:null,error:a}:{data:null,error:new Fp("Unexpected error in challenge",a)}}}async _verify({challengeId:e,factorId:n,webauthn:r}){return this.client.mfa.verify({factorId:n,challengeId:e,webauthn:r})}async _authenticate({factorId:e,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:i}={}},s){if(!n)return{data:null,error:new F1("rpId is required for WebAuthn authentication")};try{if(!J7())return{data:null,error:new Fp("Browser does not support WebAuthn",null)};const{data:a,error:l}=await this.challenge({factorId:e,webauthn:{rpId:n,rpOrigins:r},signal:i},{request:s});if(!a)return{data:null,error:l};const{webauthn:c}=a;return this._verify({factorId:e,challengeId:a.challengeId,webauthn:{type:c.type,rpId:n,rpOrigins:r,credential_response:c.credential_response}})}catch(a){return Tt(a)?{data:null,error:a}:{data:null,error:new Fp("Unexpected error in authenticate",a)}}}async _register({friendlyName:e,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:i}={}},s){if(!n)return{data:null,error:new F1("rpId is required for WebAuthn registration")};try{if(!J7())return{data:null,error:new Fp("Browser does not support WebAuthn",null)};const{data:a,error:l}=await this._enroll({friendlyName:e});if(!a)return await this.client.mfa.listFactors().then(d=>{var f;return(f=d.data)===null||f===void 0?void 0:f.all.find(h=>h.factor_type==="webauthn"&&h.friendly_name===e&&h.status!=="unverified")}).then(d=>d?this.client.mfa.unenroll({factorId:d==null?void 0:d.id}):void 0),{data:null,error:l};const{data:c,error:u}=await this._challenge({factorId:a.id,friendlyName:a.friendly_name,webauthn:{rpId:n,rpOrigins:r},signal:i},{create:s});return c?this._verify({factorId:a.id,challengeId:c.challengeId,webauthn:{rpId:n,rpOrigins:r,type:c.webauthn.type,credential_response:c.webauthn.credential_response}}):{data:null,error:u}}catch(a){return Tt(a)?{data:null,error:a}:{data:null,error:new Fp("Unexpected error in register",a)}}}}b2e();const F2e={url:Rke,storageKey:Ike,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:Dke,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:1e4};async function Z7(t,e,n){return await n()}const Jg={};class U1{get jwks(){var e,n;return(n=(e=Jg[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&n!==void 0?n:{keys:[]}}set jwks(e){Jg[this.storageKey]=Object.assign(Object.assign({},Jg[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,n;return(n=(e=Jg[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&n!==void 0?n:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){Jg[this.storageKey]=Object.assign(Object.assign({},Jg[this.storageKey]),{cachedAt:e})}constructor(e){var n,r,i;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=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 s=Object.assign(Object.assign({},F2e),e);if(this.storageKey=s.storageKey,this.instanceID=(n=U1.nextInstanceID[this.storageKey])!==null&&n!==void 0?n:0,U1.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!s.debug,typeof s.debug=="function"&&(this.logger=s.debug),this.instanceID>0&&Es()){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=s.persistSession,this.autoRefreshToken=s.autoRefreshToken,this.admin=new x2e({url:s.url,headers:s.headers,fetch:s.fetch}),this.url=s.url,this.headers=s.headers,this.fetch=Jie(s.fetch),this.lock=s.lock||Z7,this.detectSessionInUrl=s.detectSessionInUrl,this.flowType=s.flowType,this.hasCustomAuthorizationHeader=s.hasCustomAuthorizationHeader,this.throwOnError=s.throwOnError,this.lockAcquireTimeout=s.lockAcquireTimeout,s.lock?this.lock=s.lock:this.persistSession&&Es()&&(!((r=globalThis==null?void 0:globalThis.navigator)===null||r===void 0)&&r.locks)?this.lock=v2e:this.lock=Z7,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 $2e(this)}
125,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?(s.storage?this.storage=s.storage:Qie()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=Q7(this.memoryStorage)),s.userStorage&&(this.userStorage=s.userStorage)):(this.memoryStorage={},this.storage=Q7(this.memoryStorage)),Es()&&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)}(i=this.broadcastChannel)===null||i===void 0||i.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} (${Kie}) ${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(this.lockAcquireTimeout,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var e;try{let n={},r="none";if(Es()&&(n=Qke(window.location.href),this._isImplicitGrantCallback(n)?r="implicit":await this._isPKCECallback(n)&&(r="pkce")),Es()&&this.detectSessionInUrl&&r!=="none"){const{data:i,error:s}=await this._getSessionFromURL(n,r);if(s){if(this._debug("#_initialize()","error detecting session from URL",s),Bke(s)){const c=(e=s.details)===null||e===void 0?void 0:e.code;if(c==="identity_already_exists"||c==="identity_not_found"||c==="single_identity_not_deletable")return{error:s}}return{error:s}}const{session:a,redirectType:l}=i;return this._debug("#_initialize()","detected session in URL",a,"redirect type",l),await this._saveSession(a),setTimeout(async()=>{l==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",a):await this._notifyAllSubscribers("SIGNED_IN",a)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(n){return Tt(n)?this._returnResult({error:n}):this._returnResult({error:new Fp("Unexpected error during initialization",n)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var n,r,i;try{const s=await Xt(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(r=(n=e==null?void 0:e.options)===null||n===void 0?void 0:n.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:(i=e==null?void 0:e.options)===null||i===void 0?void 0:i.captchaToken}},xform:Ol}),{data:a,error:l}=s;if(l||!a)return this._returnResult({data:{user:null,session:null},error:l});const c=a.session,u=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",c)),this._returnResult({data:{user:u,session:c},error:null})}catch(s){if(Tt(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signUp(e){var n,r,i;try{let s;if("email"in e){const{email:d,password:f,options:h}=e;let p=null,m=null;this.flowType==="pkce"&&([p,m]=await Yg(this.storage,this.storageKey)),s=await Xt(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:h==null?void 0:h.emailRedirectTo,body:{email:d,password:f,data:(n=h==null?void 0:h.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:h==null?void 0:h.captchaToken},code_challenge:p,code_challenge_method:m},xform:Ol})}else if("phone"in e){const{phone:d,password:f,options:h}=e;s=await Xt(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:d,password:f,data:(r=h==null?void 0:h.data)!==null&&r!==void 0?r:{},channel:(i=h==null?void 0:h.channel)!==null&&i!==void 0?i:"sms",gotrue_meta_security:{captcha_token:h==null?void 0:h.captchaToken}},xform:Ol})}else throw new GN("You must provide either an email or phone number and a password");const{data:a,error:l}=s;if(l||!a)return await ks(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:l});const c=a.session,u=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",c)),this._returnResult({data:{user:u,session:c},error:null})}catch(s){if(await ks(this.storage,`${this.storageKey}-code-verifier`),Tt(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithPassword(e){try{let n;if("email"in e){const{email:s,password:a,options:l}=e;n=await Xt(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:s,password:a,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:Y7})}else if("phone"in e){const{phone:s,password:a,options:l}=e;n=await Xt(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:s,password:a,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:Y7})}else throw new GN("You must provide either an email or phone number and a password");const{data:r,error:i}=n;if(i)return this._returnResult({data:{user:null,session:null},error:i});if(!r||!r.session||!r.user){const s=new Kg;return this._returnResult({data:{user:null,session:null},error:s})}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:i})}catch(n){if(Tt(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOAuth(e){var n,r,i,s;return await this._handleProviderSignIn(e.provider,{redirectTo:(n=e.options)===null||n===void 0?void 0:n.redirectTo,scopes:(r=e.options)===null||r===void 0?void 0:r.scopes,queryParams:(i=e.options)===null||i===void 0?void 0:i.queryParams,skipBrowserRedirect:(s=e.options)===null||s===void 0?void 0:s.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){const{chain:n}=e;switch(n){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${n}"`)}}async signInWithEthereum(e){var n,r,i,s,a,l,c,u,d,f,h;let p,m;if("message"in e)p=e.message,m=e.signature;else{const{chain:x,wallet:y,statement:g,options:w}=e;let v;if(Es())if(typeof y=="object")v=y;else{const C=window;if("ethereum"in C&&typeof C.ethereum=="object"&&"request"in C.ethereum&&typeof C.ethereum.request=="function")v=C.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"||!(w!=null&&w.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");v=y}const N=new URL((n=w==null?void 0:w.url)!==null&&n!==void 0?n:window.location.href),S=await v.request({method:"eth_requestAccounts"}).then(C=>C).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 _=ese(S[0]);let j=(r=w==null?void 0:w.signInWithEthereum)===null||r===void 0?void 0:r.chainId;if(!j){const C=await v.request({method:"eth_chainId"});j=w2e(C)}const A={domain:N.host,address:_,statement:g,uri:N.href,version:"1",chainId:j,nonce:(i=w==null?void 0:w.signInWithEthereum)===null||i===void 0?void 0:i.nonce,issuedAt:(a=(s=w==null?void 0:w.signInWithEthereum)===null||s===void 0?void 0:s.issuedAt)!==null&&a!==void 0?a:new Date,expirationTime:(l=w==null?void 0:w.signInWithEthereum)===null||l===void 0?void 0:l.expirationTime,notBefore:(c=w==null?void 0:w.signInWithEthereum)===null||c===void 0?void 0:c.notBefore,requestId:(u=w==null?void 0:w.signInWithEthereum)===null||u===void 0?void 0:u.requestId,resources:(d=w==null?void 0:w.signInWithEthereum)===null||d===void 0?void 0:d.resources};p=S2e(A),m=await v.request({method:"personal_sign",params:[_2e(p),_]})}try{const{data:x,error:y}=await Xt(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:p,signature:m},!((f=e.options)===null||f===void 0)&&f.captchaToken?{gotrue_meta_security:{captcha_token:(h=e.options)===null||h===void 0?void 0:h.captchaToken}}:null),xform:Ol});if(y)throw y;if(!x||!x.session||!x.user){const g=new Kg;return this._returnResult({data:{user:null,session:null},error:g})}return x.session&&(await this._saveSession(x.session),await this._notifyAllSubscribers("SIGNED_IN",x.session)),this._returnResult({data:Object.assign({},x),error:y})}
125catch(x){if(Tt(x))return this._returnResult({data:{user:null,session:null},error:x});throw x}}async signInWithSolana(e){var n,r,i,s,a,l,c,u,d,f,h,p;let m,x;if("message"in e)m=e.message,x=e.signature;else{const{chain:y,wallet:g,statement:w,options:v}=e;let N;if(Es())if(typeof g=="object")N=g;else{const _=window;if("solana"in _&&typeof _.solana=="object"&&("signIn"in _.solana&&typeof _.solana.signIn=="function"||"signMessage"in _.solana&&typeof _.solana.signMessage=="function"))N=_.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof g!="object"||!(v!=null&&v.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");N=g}const S=new URL((n=v==null?void 0:v.url)!==null&&n!==void 0?n:window.location.href);if("signIn"in N&&N.signIn){const _=await N.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},v==null?void 0:v.signInWithSolana),{version:"1",domain:S.host,uri:S.href}),w?{statement:w}:null));let j;if(Array.isArray(_)&&_[0]&&typeof _[0]=="object")j=_[0];else if(_&&typeof _=="object"&&"signedMessage"in _&&"signature"in _)j=_;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in j&&"signature"in j&&(typeof j.signedMessage=="string"||j.signedMessage instanceof Uint8Array)&&j.signature instanceof Uint8Array)m=typeof j.signedMessage=="string"?j.signedMessage:new TextDecoder().decode(j.signedMessage),x=j.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in N)||typeof N.signMessage!="function"||!("publicKey"in N)||typeof N!="object"||!N.publicKey||!("toBase58"in N.publicKey)||typeof N.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:`,N.publicKey.toBase58(),...w?["",w,""]:[""],"Version: 1",`URI: ${S.href}`,`Issued At: ${(i=(r=v==null?void 0:v.signInWithSolana)===null||r===void 0?void 0:r.issuedAt)!==null&&i!==void 0?i:new Date().toISOString()}`,...!((s=v==null?void 0:v.signInWithSolana)===null||s===void 0)&&s.notBefore?[`Not Before: ${v.signInWithSolana.notBefore}`]:[],...!((a=v==null?void 0:v.signInWithSolana)===null||a===void 0)&&a.expirationTime?[`Expiration Time: ${v.signInWithSolana.expirationTime}`]:[],...!((l=v==null?void 0:v.signInWithSolana)===null||l===void 0)&&l.chainId?[`Chain ID: ${v.signInWithSolana.chainId}`]:[],...!((c=v==null?void 0:v.signInWithSolana)===null||c===void 0)&&c.nonce?[`Nonce: ${v.signInWithSolana.nonce}`]:[],...!((u=v==null?void 0:v.signInWithSolana)===null||u===void 0)&&u.requestId?[`Request ID: ${v.signInWithSolana.requestId}`]:[],...!((f=(d=v==null?void 0:v.signInWithSolana)===null||d===void 0?void 0:d.resources)===null||f===void 0)&&f.length?["Resources",...v.signInWithSolana.resources.map(j=>`- ${j}`)]:[]].join(`
126`);const _=await N.signMessage(new TextEncoder().encode(m),"utf8");if(!_||!(_ instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");x=_}}try{const{data:y,error:g}=await Xt(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:m,signature:Yp(x)},!((h=e.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(p=e.options)===null||p===void 0?void 0:p.captchaToken}}:null),xform:Ol});if(g)throw g;if(!y||!y.session||!y.user){const w=new Kg;return this._returnResult({data:{user:null,session:null},error:w})}return y.session&&(await this._saveSession(y.session),await this._notifyAllSubscribers("SIGNED_IN",y.session)),this._returnResult({data:Object.assign({},y),error:g})}catch(y){if(Tt(y))return this._returnResult({data:{user:null,session:null},error:y});throw y}}async _exchangeCodeForSession(e){const n=await fp(this.storage,`${this.storageKey}-code-verifier`),[r,i]=(n??"").split("/");try{if(!r&&this.flowType==="pkce")throw new Vke;const{data:s,error:a}=await Xt(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:r},xform:Ol});if(await ks(this.storage,`${this.storageKey}-code-verifier`),a)throw a;if(!s||!s.session||!s.user){const l=new Kg;return this._returnResult({data:{user:null,session:null,redirectType:null},error:l})}return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),this._returnResult({data:Object.assign(Object.assign({},s),{redirectType:i??null}),error:a})}catch(s){if(await ks(this.storage,`${this.storageKey}-code-verifier`),Tt(s))return this._returnResult({data:{user:null,session:null,redirectType:null},error:s});throw s}}async signInWithIdToken(e){try{const{options:n,provider:r,token:i,access_token:s,nonce:a}=e,l=await Xt(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:i,access_token:s,nonce:a,gotrue_meta_security:{captcha_token:n==null?void 0:n.captchaToken}},xform:Ol}),{data:c,error:u}=l;if(u)return this._returnResult({data:{user:null,session:null},error:u});if(!c||!c.session||!c.user){const d=new Kg;return this._returnResult({data:{user:null,session:null},error:d})}return c.session&&(await this._saveSession(c.session),await this._notifyAllSubscribers("SIGNED_IN",c.session)),this._returnResult({data:c,error:u})}catch(n){if(Tt(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOtp(e){var n,r,i,s,a;try{if("email"in e){const{email:l,options:c}=e;let u=null,d=null;this.flowType==="pkce"&&([u,d]=await Yg(this.storage,this.storageKey));const{error:f}=await Xt(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:l,data:(n=c==null?void 0:c.data)!==null&&n!==void 0?n:{},create_user:(r=c==null?void 0:c.shouldCreateUser)!==null&&r!==void 0?r:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},code_challenge:u,code_challenge_method:d},redirectTo:c==null?void 0:c.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:f})}if("phone"in e){const{phone:l,options:c}=e,{data:u,error:d}=await Xt(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:l,data:(i=c==null?void 0:c.data)!==null&&i!==void 0?i:{},create_user:(s=c==null?void 0:c.shouldCreateUser)!==null&&s!==void 0?s:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},channel:(a=c==null?void 0:c.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 GN("You must provide either an email or phone number.")}catch(l){if(await ks(this.storage,`${this.storageKey}-code-verifier`),Tt(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}}async verifyOtp(e){var n,r;try{let i,s;"options"in e&&(i=(n=e.options)===null||n===void 0?void 0:n.redirectTo,s=(r=e.options)===null||r===void 0?void 0:r.captchaToken);const{data:a,error:l}=await Xt(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:s}}),redirectTo:i,xform:Ol});if(l)throw l;if(!a)throw new Error("An error occurred on token verification.");const c=a.session,u=a.user;return c!=null&&c.access_token&&(await this._saveSession(c),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",c)),this._returnResult({data:{user:u,session:c},error:null})}catch(i){if(Tt(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithSSO(e){var n,r,i,s,a;try{let l=null,c=null;this.flowType==="pkce"&&([l,c]=await Yg(this.storage,this.storageKey));const u=await Xt(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=(n=e.options)===null||n===void 0?void 0:n.redirectTo)!==null&&r!==void 0?r:void 0}),!((i=e==null?void 0:e.options)===null||i===void 0)&&i.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:l,code_challenge_method:c}),headers:this.headers,xform:p2e});return!((s=u.data)===null||s===void 0)&&s.url&&Es()&&!(!((a=e.options)===null||a===void 0)&&a.skipBrowserRedirect)&&window.location.assign(u.data.url),this._returnResult(u)}catch(l){if(await ks(this.storage,`${this.storageKey}-code-verifier`),Tt(l))return this._returnResult({data:null,error:l});throw l}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:n},error:r}=e;if(r)throw r;if(!n)throw new ro;const{error:i}=await Xt(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return this._returnResult({data:{user:null,session:null},error:i})})}catch(e){if(Tt(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const n=`${this.url}/resend`;if("email"in e){const{email:r,type:i,options:s}=e,{error:a}=await Xt(this.fetch,"POST",n,{headers:this.headers,body:{email:r,type:i,gotrue_meta_security:{captcha_token:s==null?void 0:s.captchaToken}},redirectTo:s==null?void 0:s.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:a})}else if("phone"in e){const{phone:r,type:i,options:s}=e,{data:a,error:l}=await Xt(this.fetch,"POST",n,{headers:this.headers,body:{phone:r,type:i,gotrue_meta_security:{captcha_token:s==null?void 0:s.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:a==null?void 0:a.message_id},error:l})}throw new GN("You must provide either an email or phone number and a type")}catch(n){if(Tt(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async n=>n))}async _acquireLock(e,n){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const r=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),i=(async()=>(await r,await n()))();return this.pendingInLock.push((async()=>{try{await i}catch{}})()),i}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const r=n();for(this.pendingInLock.push((async()=>{try{await r}catch{}})()),await r;this.pendingInLock.length;){const i=[...this.pendingInLock];await Promise.all(i),this.pendingInLock.splice(0,i.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 n=await this.__loadSession();return await e(n)}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 n=await fp(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",n),n!==null&&(this._isValidSession(n)?e=n:(this._debug("#getSession()","session from storage is not val
126id"),await this._removeSession())),!e)return{data:{session:null},error:null};const r=e.expires_at?e.expires_at*1e3-Date.now()<nR:!1;if(this._debug("#__loadSession()",`session has${r?"":" not"} expired`,"expires_at",e.expires_at),!r){if(this.userStorage){const a=await fp(this.userStorage,this.storageKey+"-user");a!=null&&a.user?e.user=a.user:e.user=sR()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const a={value:this.suppressGetSessionWarning};e.user=u2e(e.user,a),a.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}const{data:i,error:s}=await this._callRefreshToken(e.refresh_token);return s?this._returnResult({data:{session:null},error:s}):this._returnResult({data:{session:i},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;const n=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return n.data.user&&(this.suppressGetSessionWarning=!0),n}async _getUser(e){try{return e?await Xt(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:kf}):await this._useSession(async n=>{var r,i,s;const{data:a,error:l}=n;if(l)throw l;return!(!((r=a.session)===null||r===void 0)&&r.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new ro}:await Xt(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(s=(i=a.session)===null||i===void 0?void 0:i.access_token)!==null&&s!==void 0?s:void 0,xform:kf})})}catch(n){if(Tt(n))return zke(n)&&(await this._removeSession(),await ks(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:n});throw n}}async updateUser(e,n={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,n))}async _updateUser(e,n={}){try{return await this._useSession(async r=>{const{data:i,error:s}=r;if(s)throw s;if(!i.session)throw new ro;const a=i.session;let l=null,c=null;this.flowType==="pkce"&&e.email!=null&&([l,c]=await Yg(this.storage,this.storageKey));const{data:u,error:d}=await Xt(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:n==null?void 0:n.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:l,code_challenge_method:c}),jwt:a.access_token,xform:kf});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 ks(this.storage,`${this.storageKey}-code-verifier`),Tt(r))return this._returnResult({data:{user:null},error:r});throw r}}async setSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new ro;const n=Date.now()/1e3;let r=n,i=!0,s=null;const{payload:a}=iR(e.access_token);if(a.exp&&(r=a.exp,i=r<=n),i){const{data:l,error:c}=await this._callRefreshToken(e.refresh_token);if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!l)return{data:{user:null,session:null},error:null};s=l}else{const{data:l,error:c}=await this._getUser(e.access_token);if(c)throw c;s={access_token:e.access_token,refresh_token:e.refresh_token,user:l.user,token_type:"bearer",expires_in:r-n,expires_at:r},await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)}return this._returnResult({data:{user:s.user,session:s},error:null})}catch(n){if(Tt(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async n=>{var r;if(!e){const{data:a,error:l}=n;if(l)throw l;e=(r=a.session)!==null&&r!==void 0?r:void 0}if(!(e!=null&&e.refresh_token))throw new ro;const{data:i,error:s}=await this._callRefreshToken(e.refresh_token);return s?this._returnResult({data:{user:null,session:null},error:s}):i?this._returnResult({data:{user:i.user,session:i},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(n){if(Tt(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async _getSessionFromURL(e,n){try{if(!Es())throw new qN("No browser detected.");
126if(e.error||e.error_description||e.error_code)throw new qN(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(n){case"implicit":if(this.flowType==="pkce")throw new B7("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new qN("Not a valid implicit grant flow url.");break;default:}if(n==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new B7("No code detected.");const{data:w,error:v}=await this._exchangeCodeForSession(e.code);if(v)throw v;const N=new URL(window.location.href);return N.searchParams.delete("code"),window.history.replaceState(window.history.state,"",N.toString()),{data:{session:w.session,redirectType:null},error:null}}const{provider_token:r,provider_refresh_token:i,access_token:s,refresh_token:a,expires_in:l,expires_at:c,token_type:u}=e;if(!s||!l||!a||!u)throw new qN("No session defined in URL");const d=Math.round(Date.now()/1e3),f=parseInt(l);let h=d+f;c&&(h=parseInt(c));const p=h-d;p*1e3<=Ix&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${p}s, should have been closer to ${f}s`);const m=h-f;d-m>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",m,h,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,h,d);const{data:x,error:y}=await this._getUser(s);if(y)throw y;const g={provider_token:r,provider_refresh_token:i,access_token:s,expires_in:f,expires_at:h,refresh_token:a,token_type:u,user:x.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:g,redirectType:e.type},error:null})}catch(r){if(Tt(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 n=await fp(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&n)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async n=>{var r;const{data:i,error:s}=n;if(s)return this._returnResult({error:s});const a=(r=i.session)===null||r===void 0?void 0:r.access_token;if(a){const{error:l}=await this.admin.signOut(a,e);if(l&&!(Uke(l)&&(l.status===404||l.status===401||l.status===403)))return this._returnResult({error:l})}return e!=="others"&&(await this._removeSession(),await ks(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const n=Xke(),r={id:n,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",n),this.stateChangeEmitters.delete(n)}};return this._debug("#onAuthStateChange()","registered callback with id",n),this.stateChangeEmitters.set(n,r),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(n)})))(),{data:{subscription:r}}}async _emitInitialSession(e){return await this._useSession(async n=>{var r,i;try{const{data:{session:s},error:a}=n;if(a)throw a;await((r=this.stateChangeEmitters.get(e))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",s)),this._debug("INITIAL_SESSION","callback id",e,"session",s)}catch(s){await((i=this.stateChangeEmitters.get(e))===null||i===void 0?void 0:i.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",s),console.error(s)}})}async resetPasswordForEmail(e,n={}){let r=null,i=null;this.flowType==="pkce"&&([r,i]=await Yg(this.storage,this.storageKey,!0));try{return await Xt(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:r,code_challenge_method:i,gotrue_meta_security:{captcha_token:n.captchaToken}},headers:this.headers,redirectTo:n.redirectTo})}catch(s){if(await ks(this.storage,`${this.storageKey}-code-verifier`),Tt(s))return this._returnResult({data:null,error:s});throw s}}async getUserIdentities(){var e;try{const{data:n,error:r}=await this.getUser();if(r)throw r;return this._returnResult({data:{identities:(e=n.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(n){if(Tt(n))return this._returnResult({data:null,error:n});throw n}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var n;try{const{data:r,error:i}=await this._useSession(async s=>{var a,l,c,u,d;const{data:f,error:h}=s;if(h)throw h;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:(l=e.options)===null||l===void 0?void 0:l.scopes,queryParams:(c=e.options)===null||c===void 0?void 0:c.queryParams,skipBrowserRedirect:!0});return await Xt(this.fetch,"GET",p,{headers:this.headers,jwt:(d=(u=f.session)===null||u===void 0?void 0:u.access_token)!==null&&d!==void 0?d:void 0})});if(i)throw i;
126return Es()&&!(!((n=e.options)===null||n===void 0)&&n.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(Tt(r))return this._returnResult({data:{provider:e.provider,url:null},error:r});throw r}}async linkIdentityIdToken(e){return await this._useSession(async n=>{var r;try{const{error:i,data:{session:s}}=n;if(i)throw i;const{options:a,provider:l,token:c,access_token:u,nonce:d}=e,f=await Xt(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(r=s==null?void 0:s.access_token)!==null&&r!==void 0?r:void 0,body:{provider:l,id_token:c,access_token:u,nonce:d,link_identity:!0,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:Ol}),{data:h,error:p}=f;return p?this._returnResult({data:{user:null,session:null},error:p}):!h||!h.session||!h.user?this._returnResult({data:{user:null,session:null},error:new Kg}):(h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("USER_UPDATED",h.session)),this._returnResult({data:h,error:p}))}catch(i){if(await ks(this.storage,`${this.storageKey}-code-verifier`),Tt(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}})}async unlinkIdentity(e){try{return await this._useSession(async n=>{var r,i;const{data:s,error:a}=n;if(a)throw a;return await Xt(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(i=(r=s.session)===null||r===void 0?void 0:r.access_token)!==null&&i!==void 0?i:void 0})})}catch(n){if(Tt(n))return this._returnResult({data:null,error:n});throw n}}async _refreshAccessToken(e){const n=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(n,"begin");try{const r=Date.now();return await e2e(async i=>(i>0&&await Zke(200*Math.pow(2,i-1)),this._debug(n,"refreshing attempt",i),await Xt(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:Ol})),(i,s)=>{const a=200*Math.pow(2,i);return s&&rR(s)&&Date.now()+a-r<Ix})}catch(r){if(this._debug(n,"error",r),Tt(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}finally{this._debug(n,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,n){const r=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:n.redirectTo,scopes:n.scopes,queryParams:n.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",n,"url",r),Es()&&!n.skipBrowserRedirect&&window.location.assign(r),{data:{provider:e,url:r},error:null}}async _recoverAndRefresh(){var e,n;const r="#_recoverAndRefresh()";this._debug(r,"begin");try{const i=await fp(this.storage,this.storageKey);if(i&&this.userStorage){let a=await fp(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!a&&(a={user:i.user},await Dx(this.userStorage,this.storageKey+"-user",a)),i.user=(e=a==null?void 0:a.user)!==null&&e!==void 0?e:sR()}else if(i&&!i.user&&!i.user){const a=await fp(this.storage,this.storageKey+"-user");a&&(a!=null&&a.user)?(i.user=a.user,await ks(this.storage,this.storageKey+"-user"),await Dx(this.storage,this.storageKey,i)):i.user=sR()}if(this._debug(r,"session from storage",i),!this._isValidSession(i)){this._debug(r,"session is not valid"),i!==null&&await this._removeSession();return}const s=((n=i.expires_at)!==null&&n!==void 0?n:1/0)*1e3-Date.now()<nR;if(this._debug(r,`session has${s?"":" not"} expired with margin of ${nR}s`),s){if(this.autoRefreshToken&&i.refresh_token){const{error:a}=await this._callRefreshToken(i.refresh_token);a&&(console.error(a),rR(a)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",a),await this._removeSession()))}}else if(i.user&&i.user.__isUserNotAvailableProxy===!0)try{const{data:a,error:l}=await this._getUser(i.access_token);!l&&(a!=null&&a.user)?(i.user=a.user,await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)):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",i)}catch(i){this._debug(r,"error",i),console.error(i);return}finally{this._debug(r,"end")}}async _callRefreshToken(e){var n,r;if(!e)throw new ro;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const i=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(i,"begin");try{this.refreshingDeferred=new gT;const{data:s,error:a}=await this._refreshAccessToken(e);if(a)throw a;if(!s.session)throw new ro;await this._saveSession(s.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",s.session);const l={data:s.session,error:null};return this.refreshingDeferred.resolve(l),l}catch(s){if(this._debug(i,"error",s),Tt(s)){const a={data:null,error:s};return rR(s)||await this._removeSession(),(n=this.refreshingDeferred)===null||n===void 0||n.resolve(a),a}throw(r=this.refreshingDeferred)===null||r===void 0||r.reject(s),s}finally{this.refreshingDeferred=null,this._debug(i,"end")}}async _notifyAllSubscribers(e,n,r=!0){const i=`#_notifyAllSubscribers(${e})`;this._debug(i,"begin",n,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:e,session:n});const s=[],a=Array.from(this.stateChangeEmitters.values()).map(async l=>{try{await l.callback(e,n)}catch(c){s.push(c)}});if(await Promise.all(a),s.length>0){for(let l=0;l<s.length;l+=1)console.error(s[l]);throw s[0]}}finally{this._debug(i,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await ks(this.storage,`${this.storageKey}-code-verifier`);const n=Object.assign({},e),r=n.user&&n.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!r&&n.user&&await Dx(this.userStorage,this.storageKey+"-user",{user:n.user});const i=Object.assign({},n);delete i.user;const s=q7(i);await Dx(this.storage,this.storageKey,s)}else{const i=q7(n);await Dx(this.storage,this.storageKey,i)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await ks(this.storage,this.storageKey),await ks(this.storage,this.storageKey+"-code-verifier"),await ks(this.storage,this.storageKey+"-user"),this.userStorage&&await ks(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&Es()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}
126catch(n){console.error("removing visibilitychange callback failed",n)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),Ix);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e);const n=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=n,n&&typeof n=="object"&&typeof n.unref=="function"?n.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(n)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);const n=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,n&&clearTimeout(n)}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 n=>{const{data:{session:r}}=n;if(!r||!r.refresh_token||!r.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const i=Math.floor((r.expires_at*1e3-e)/Ix);this._debug("#_autoRefreshTokenTick()",`access token expires in ${i} ticks, a tick lasts ${Ix}ms, refresh threshold is ${O4} ticks`),i<=O4&&await this._callRefreshToken(r.refresh_token)})}catch(n){console.error("Auto refresh tick failed with error. This is likely a transient error.",n)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof Zie)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Es()||!(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 n=`#_onVisibilityChanged(${e})`;this._debug(n,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(n,"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,n,r){const i=[`provider=${encodeURIComponent(n)}`];if(r!=null&&r.redirectTo&&i.push(`redirect_to=${encodeURIComponent(r.redirectTo)}`),r!=null&&r.scopes&&i.push(`scopes=${encodeURIComponent(r.scopes)}`),this.flowType==="pkce"){const[s,a]=await Yg(this.storage,this.storageKey),l=new URLSearchParams({code_challenge:`${encodeURIComponent(s)}`,code_challenge_method:`${encodeURIComponent(a)}`});i.push(l.toString())}if(r!=null&&r.queryParams){const s=new URLSearchParams(r.queryParams);i.push(s.toString())}return r!=null&&r.skipBrowserRedirect&&i.push(`skip_http_redirect=${r.skipBrowserRedirect}`),`${e}?${i.join("&")}`}async _unenroll(e){try{return await this._useSession(async n=>{var r;const{data:i,error:s}=n;return s?this._returnResult({data:null,error:s}):await Xt(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(r=i==null?void 0:i.session)===null||r===void 0?void 0:r.access_token})})}catch(n){if(Tt(n))return this._returnResult({data:null,error:n});throw n}}async _enroll(e){try{return await this._useSession(async n=>{var r,i;const{data:s,error:a}=n;if(a)return this._returnResult({data:null,error:a});const l=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:c,error:u}=await Xt(this.fetch,"POST",`${this.url}/factors`,{body:l,headers:this.headers,jwt:(r=s==null?void 0:s.session)===null||r===void 0?void 0:r.access_token});return u?this._returnResult({data:null,error:u}):(e.factorType==="totp"&&c.type==="totp"&&(!((i=c==null?void 0:c.totp)===null||i===void 0)&&i.qr_code)&&(c.totp.qr_code=`data:image/svg+xml;utf-8,${c.totp.qr_code}`),this._returnResult({data:c,error:null}))})}catch(n){if(Tt(n))return this._returnResult({data:null,error:n});throw n}}async _verify(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var r;const{data:i,error:s}=n;if(s)return this._returnResult({data:null,error:s});const a=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?T2e(e.webauthn.credential_response):M2e(e.webauthn.credential_response)})}:{code:e.code}),{data:l,error:c}=await Xt(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:a,headers:this.headers,jwt:(r=i==null?void 0:i.session)===null||r===void 0?void 0:r.access_token});return c?this._returnResult({data:null,error:c}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+l.expires_in},l)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",l),this._returnResult({data:l,error:c}))})}catch(n){if(Tt(n))return this._returnResult({data:null,error:n});throw n}})}async _challenge(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var r;const{data:i,error:s}=n;if(s)return this._returnResult({data:null,error:s});const a=await Xt(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(r=i==null?void 0:i.session)===null||r===void 0?void 0:r.access_token});if(a.error)return a;const{data:l}=a;if(l.type!=="webauthn")return{data:l,error:null};switch(l.webauthn.type){case"create":return{data:Object.assign(Object.assign({},l),{webauthn:Object.assign(Object.assign({},l.webauthn),{credential_options:Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:E2e(l.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},l),{webauthn:Object.assign(Object.assign({},l.webauthn),{credential_options:Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:A2e(l.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(Tt(n))return this._returnResult({data:null,error:n});throw n}})}async _challengeAndVerify(e){const{data:n,error:r}=await this._challenge({factorId:e.factorId});return r?this._returnResult({data:null,error:r}):await this._verify({factorId:e.factorId,challengeId:n.id,code:e.code})}async _listFactors(){var e;const{data:{user:n},error:r}=await this.getUser();if(r)return{data:null,error:r};const i={all:[],phone:[],totp:[],webauthn:[]};for(const s of(e=n==null?void 0:n.factors)!==null&&e!==void 0?e:[])i.all.push(s),s.status==="verified"&&i[s.factor_type].push(s);return{data:i,error:null}}async _getAuthenticatorAssuranceLevel(){var e,n;const{data:{session:r},error:i}
126=await this.getSession();if(i)return this._returnResult({data:null,error:i});if(!r)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:s}=iR(r.access_token);let a=null;s.aal&&(a=s.aal);let l=a;((n=(e=r.user.factors)===null||e===void 0?void 0:e.filter(d=>d.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(l="aal2");const u=s.amr||[];return{data:{currentLevel:a,nextLevel:l,currentAuthenticationMethods:u},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async n=>{const{data:{session:r},error:i}=n;return i?this._returnResult({data:null,error:i}):r?await Xt(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:r.access_token,xform:s=>({data:s,error:null})}):this._returnResult({data:null,error:new ro})})}catch(n){if(Tt(n))return this._returnResult({data:null,error:n});throw n}}async _approveAuthorization(e,n){try{return await this._useSession(async r=>{const{data:{session:i},error:s}=r;if(s)return this._returnResult({data:null,error:s});if(!i)return this._returnResult({data:null,error:new ro});const a=await Xt(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"approve"},xform:l=>({data:l,error:null})});return a.data&&a.data.redirect_url&&Es()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(a.data.redirect_url),a})}catch(r){if(Tt(r))return this._returnResult({data:null,error:r});throw r}}async _denyAuthorization(e,n){try{return await this._useSession(async r=>{const{data:{session:i},error:s}=r;if(s)return this._returnResult({data:null,error:s});if(!i)return this._returnResult({data:null,error:new ro});const a=await Xt(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"deny"},xform:l=>({data:l,error:null})});return a.data&&a.data.redirect_url&&Es()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(a.data.redirect_url),a})}catch(r){if(Tt(r))return this._returnResult({data:null,error:r});throw r}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:n},error:r}=e;return r?this._returnResult({data:null,error:r}):n?await Xt(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new ro})})}catch(e){if(Tt(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async n=>{const{data:{session:r},error:i}=n;return i?this._returnResult({data:null,error:i}):r?(await Xt(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 ro})})}catch(n){if(Tt(n))return this._returnResult({data:null,error:n});throw n}}async fetchJwk(e,n={keys:[]}){let r=n.keys.find(l=>l.kid===e);if(r)return r;const i=Date.now();if(r=this.jwks.keys.find(l=>l.kid===e),r&&this.jwks_cached_at+$ke>i)return r;const{data:s,error:a}=await Xt(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(a)throw a;return!s.keys||s.keys.length===0||(this.jwks=s,this.jwks_cached_at=i,r=s.keys.find(l=>l.kid===e),!r)?null:r}async getClaims(e,n={}){try{let r=e;if(!r){const{data:p,error:m}
126=await this.getSession();if(m||!p.session)return this._returnResult({data:null,error:m});r=p.session.access_token}const{header:i,payload:s,signature:a,raw:{header:l,payload:c}}=iR(r);n!=null&&n.allowExpired||o2e(s.exp);const u=!i.alg||i.alg.startsWith("HS")||!i.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(i.kid,n!=null&&n.keys?{keys:n.keys}:n==null?void 0:n.jwks);if(!u){const{error:p}=await this.getUser(r);if(p)throw p;return{data:{claims:s,header:i,signature:a},error:null}}const d=l2e(i.alg),f=await crypto.subtle.importKey("jwk",u,d,!0,["verify"]);if(!await crypto.subtle.verify(d,f,a,Kke(`${l}.${c}`)))throw new D4("Invalid JWT signature");return{data:{claims:s,header:i,signature:a},error:null}}catch(r){if(Tt(r))return this._returnResult({data:null,error:r});throw r}}}U1.nextInstanceID={};const U2e=U1,z2e="2.90.1";let uw="";typeof Deno<"u"?uw="deno":typeof document<"u"?uw="web":typeof navigator<"u"&&navigator.product==="ReactNative"?uw="react-native":uw="node";const B2e={"X-Client-Info":`supabase-js-${uw}/${z2e}`},V2e={headers:B2e},H2e={schema:"public"},W2e={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},G2e={};function z1(t){"@babel/helpers - typeof";return z1=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},z1(t)}function q2e(t,e){if(z1(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(z1(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function K2e(t){var e=q2e(t,"string");return z1(e)=="symbol"?e:e+""}function Y2e(t,e,n){return(e=K2e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function eH(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ci(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?eH(Object(n),!0).forEach(function(r){Y2e(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):eH(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}const X2e=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),Q2e=()=>Headers,J2e=(t,e,n)=>{const r=X2e(n),i=Q2e();return async(s,a)=>{var l;const c=(l=await e())!==null&&l!==void 0?l:t;let u=new i(a==null?void 0:a.headers);return u.has("apikey")||u.set("apikey",t),u.has("Authorization")||u.set("Authorization",`Bearer ${c}`),r(s,ci(ci({},a),{},{headers:u}))}};function Z2e(t){return t.endsWith("/")?t:t+"/"}function eEe(t,e){var n,r;const{db:i,auth:s,realtime:a,global:l}=t,{db:c,auth:u,realtime:d,global:f}=e,h={db:ci(ci({},c),i),auth:ci(ci({},u),s),realtime:ci(ci({},d),a),storage:{},global:ci(ci(ci({},f),l),{},{headers:ci(ci({},(n=f==null?void 0:f.headers)!==null&&n!==void 0?n:{}),(r=l==null?void 0:l.headers)!==null&&r!==void 0?r:{})}),accessToken:async()=>""};return t.accessToken?h.accessToken=t.accessToken:delete h.accessToken,h}function tEe(t){const e=t==null?void 0:t.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(Z2e(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var nEe=class extends U2e{constructor(t){super(t)}},rEe=class{constructor(t,e,n){var r,i;this.supabaseUrl=t,this.supabaseKey=e;const s=tEe(t);if(!e)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",s),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",s),this.storageUrl=new URL("storage/v1",s),this.functionsUrl=new URL("functions/v1",s);const a=`sb-${s.hostname.split(".")[0]}-auth-token`,l={db:H2e,realtime:G2e,auth:ci(ci({},W2e),{},{storageKey:a}),global:V2e},c=eEe(n??{},l);if(this.storageKey=(r=c.auth.storageKey)!==null&&r!==void 0?r:"",this.headers=(i=c.global.headers)!==null&&i!==void 0?i:{},c.accessToken)this.accessToken=c.accessToken,this.auth=new Proxy({},{get:(d,f)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(f)} is not possible`)}});else{var u;this.auth=this._initSupabaseAuthClient((u=c.auth)!==null&&u!==void 0?u:{},this.headers,c.global.fetch)}this.fetch=J2e(e,this._getAccessToken.bind(this),c.global.fetch),this.realtime=this._initRealtimeClient(ci({headers:this.headers,accessToken:this._getAccessToken.bind(this)},c.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 DCe(new URL("rest/v1",s).href,{headers:this.headers,schema:c.db.schema,fetch:this.fetch}),this.storage=new Oke(this.storageUrl.href,this.headers,this.fetch,n==null?void 0:n.storage),c.accessToken||this._listenForAuthEvents()}get functions(){return new MCe(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}rpc(t,e={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(t,e,n)}channel(t,e={config:{}}){return this.realtime.channel(t,e)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var t=this,e,n;if(t.accessToken)return await t.accessToken();const{data:r}=await t.auth.getSession();
126return(e=(n=r.session)===null||n===void 0?void 0:n.access_token)!==null&&e!==void 0?e:t.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:e,detectSessionInUrl:n,storage:r,userStorage:i,storageKey:s,flowType:a,lock:l,debug:c,throwOnError:u},d,f){const h={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new nEe({url:this.authUrl.href,headers:ci(ci({},h),d),storageKey:s,autoRefreshToken:t,persistSession:e,detectSessionInUrl:n,storage:r,userStorage:i,flowType:a,lock:l,debug:c,throwOnError:u,fetch:f,hasCustomAuthorizationHeader:Object.keys(this.headers).some(p=>p.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new ZCe(this.realtimeUrl.href,ci(ci({},t),{},{params:ci(ci({},{apikey:this.supabaseKey}),t==null?void 0:t.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((t,e)=>{this._handleTokenChanged(t,"CLIENT",e==null?void 0:e.access_token)})}_handleTokenChanged(t,e,n){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==n?(this.changedAccessToken=n,this.realtime.setAuth(n)):t==="SIGNED_OUT"&&(this.realtime.setAuth(),e=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const iEe=(t,e,n)=>new rEe(t,e,n);function sEe(){if(typeof window<"u")return!1;const t=globalThis.process;if(!t)return!1;const e=t.version;if(e==null)return!1;const n=e.match(/^v(\d+)\./);return n?parseInt(n[1],10)<=18:!1}sEe()&&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 aEe="https://usaaultgpbhnqofkydqa.supabase.co",oEe="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InVzYWF1bHRncGJobnFvZmt5ZHFhIiwicm9sZSI6ImFub24iLCJpYXQiOjE3Njk2NzcwNTEsImV4cCI6MjA4NTI1MzA1MX0.IbqNtlMjnnc72lfewAVgIdFaOXkIa8NpqF9Oyw3pJWo",lEe=typeof window<"u"&&(window.location.hash.includes("access_token")||window.location.search.includes("code=")),co=iEe(aEe,oEe,{auth:{autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:lEe,storageKey:"hjaelp-auth",flowType:"pkce"}}),cEe="https://api.hjaelp.ai";class uEe{constructor(e){up(this,"baseUrl");up(this,"isRefreshing",!1);up(this,"refreshPromise",null);this.baseUrl=e}getHeaders(){const e={"Content-Type":"application/json"},n=Rr.getState().session;return n!=null&&n.access_token&&(e.Authorization=`Bearer ${n.access_token}`),e}async refreshSession(){return this.isRefreshing&&this.refreshPromise?this.refreshPromise:(this.isRefreshing=!0,this.refreshPromise=(async()=>{try{const{data:e,error:n}=await co.auth.refreshSession();if(n)throw console.error("Failed to refresh session:",n),n;e.session&&Rr.setState({session:e.session,user:e.session.user})}finally{this.isRefreshing=!1,this.refreshPromise=null}})(),this.refreshPromise)}async request(e,n,r,i=!1){var c,u,d;const s=`${this.baseUrl}${n}`,a=await fetch(s,{method:e,headers:this.getHeaders(),body:r?JSON.stringify(r):void 0});if(a.status===401&&!i)try{return await this.refreshSession(),this.request(e,n,r,!0)}catch{}const l=await a.json();if(!l.success||l.error)throw new nse(((c=l.error)==null?void 0:c.message)||"An error occurred",((u=l.error)==null?void 0:u.code)||"UNKNOWN_ERROR",a.status,(d=l.error)==null?void 0:d.details);return l.data}async get(e){return this.request("GET",e)}async post(e,n){return this.request("POST",e,n)}async patch(e,n){return this.request("PATCH",e,n)}async put(e,n){return this.request("PUT",e,n)}async delete(e){return this.request("DELETE",e)}}class nse extends Error{constructor(n,r,i,s){super(n);up(this,"code");up(this,"status");up(this,"details");this.name="ApiError",this.code=r,this.status=i,this.details=s}}const Ce=new uEe(`${cEe}/api/v1`);let oR=!1,KN=null;const Rr=$d((t,e)=>({user:null,session:null,profile:null,isInitialized:!1,isLoading:!1,initialize:async()=>{if(!(oR||e().isInitialized)){oR=!0;try{KN&&(KN.unsubscribe(),KN=null);const{data:{session:n},error:r}=await co.auth.getSession();if(r){console.error("Error getting session:",r),t({isInitialized:!0});return}n&&(t({user:n.user,session:n}
126),e().refreshProfile().catch(console.error));const{data:{subscription:i}}=co.auth.onAuthStateChange(async(s,a)=>{var c,u;const l=e();if(!(s==="INITIAL_SESSION"&&((c=l.user)==null?void 0:c.id)===((u=a==null?void 0:a.user)==null?void 0:u.id)&&l.isInitialized)){if(s==="TOKEN_REFRESHED"){t({session:a});return}if(console.log("Auth state change:",s),t({user:(a==null?void 0:a.user)??null,session:a}),a){if(s==="SIGNED_IN"){try{await Ce.post("/auth/ensure-profile",{})}catch(d){console.error("Failed to ensure profile:",d)}e().refreshProfile().catch(console.error)}s==="USER_UPDATED"&&e().refreshProfile().catch(console.error)}else t({profile:null})}});KN=i}catch(n){console.error("Error initializing auth:",n)}finally{oR=!1,t({isInitialized:!0})}}},login:async(n,r)=>{t({isLoading:!0});try{const{data:i,error:s}=await co.auth.signInWithPassword({email:n,password:r});if(s)throw s;t({user:i.user,session:i.session}),await e().refreshProfile()}finally{t({isLoading:!1})}},signup:async(n,r,i)=>{t({isLoading:!0});try{const{data:s,error:a}=await co.auth.signUp({email:n,password:r,options:{data:{full_name:i},emailRedirectTo:`${window.location.origin}/login`}});if(a)throw a;s.session&&(t({user:s.user,session:s.session}),await e().refreshProfile())}finally{t({isLoading:!1})}},signInWithGoogle:async()=>{t({isLoading:!0});try{const{error:n}=await co.auth.signInWithOAuth({provider:"google",options:{redirectTo:`${window.location.origin}/dashboard`}});if(n)throw n}finally{t({isLoading:!1})}},logout:async()=>{await co.auth.signOut(),t({user:null,session:null,profile:null})},refreshProfile:async()=>{const{user:n}=e();if(n)try{const{data:r,error:i}=await co.from("user_profiles").select("*").eq("id",n.id).single();if(i){console.error("Error fetching profile:",i);return}r&&t({profile:{id:r.id,fullName:r.full_name,avatarUrl:r.avatar_url,subscriptionTier:r.subscription_tier,subscriptionStatus:r.subscription_status,promptsUsed:r.prompts_used,promptsLimit:r.prompts_limit,llmsLimit:r.llms_limit??2,tokenBalance:r.token_balance??0,timezone:r.timezone,isAdmin:r.is_admin??!1,onboardingCompletedAt:r.onboarding_completed_at}})}catch(r){console.error("Error in refreshProfile:",r)}},updateProfileUsage:n=>{const{profile:r}=e();r&&t({profile:{...r,...n.promptsUsed!==void 0&&{promptsUsed:n.promptsUsed},...n.promptsLimit!==void 0&&{promptsLimit:n.promptsLimit},...n.llmsLimit!==void 0&&{llmsLimit:n.llmsLimit}}})},updateTokenBalance:n=>{const{profile:r}=e();r&&t({profile:{...r,tokenBalance:n}})}})),nu=Object.create(null);nu.open="0";nu.close="1";nu.ping="2";nu.pong="3";nu.message="4";nu.upgrade="5";nu.noop="6";const zC=Object.create(null);Object.keys(nu).forEach(t=>{zC[nu[t]]=t});const L4={type:"error",data:"parser error"},rse=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",ise=typeof ArrayBuffer=="function",sse=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,pz=({type:t,data:e},n,r)=>rse&&e instanceof Blob?n?r(e):tH(e,r):ise&&(e instanceof ArrayBuffer||sse(e))?n?r(e):tH(new Blob([e]),r):r(nu[t]+(e||"")),tH=(t,e)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];e("b"+(r||""))},n.readAsDataURL(t)};function nH(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let lR;function dEe(t,e){if(rse&&t.data instanceof Blob)return t.data.arrayBuffer().then(nH).then(e);if(ise&&(t.data instanceof ArrayBuffer||sse(t.data)))return e(nH(t.data));pz(t,!1,n=>{lR||(lR=new TextEncoder),e(lR.encode(n))})}const rH="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",dw=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<rH.length;t++)dw[rH.charCodeAt(t)]=t;const fEe=t=>{let e=t.length*.75,n=t.length,r,i=0,s,a,l,c;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);const u=new ArrayBuffer(e),d=new Uint8Array(u);for(r=0;r<n;r+=4)s=dw[t.charCodeAt(r)],a=dw[t.charCodeAt(r+1)],l=dw[t.charCodeAt(r+2)],c=dw[t.charCodeAt(r+3)],d[i++]=s<<2|a>>4,d[i++]=(a&15)<<4|l>>2,d[i++]=(l&3)<<6|c&63;return u},hEe=typeof ArrayBuffer=="function",mz=(t,e)=>{if(typeof t!="string")return{type:"message",data:ase(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:pEe(t.substring(1),e)}:zC[n]?t.length>1?{type:zC[n],data:t.substring(1)}:{type:zC[n]}:L4},pEe=(t,e)=>{if(hEe){const n=fEe(t);return ase(n,e)}else return{base64:!0,data:t}},ase=(t,e)=>{switch(e){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},ose="�",mEe=(t,e)=>{const n=t.length,r=new Array(n);let i=0;t.forEach((s,a)=>{pz(s,!1,l=>{r[a]=l,++i===n&&e(r.join(ose))})})},gEe=(t,e)=>{const n=t.split(ose),r=[];for(let i=0;i<n.length;i++){const s=mz(n[i],e);if(r.push(s),s.type==="error")break}return r};function xEe(){return new TransformStream({transform(t,e){dEe(t,n=>{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const s=new DataView(i.buffer);s.setUint8(0,126),s.setUint16(1,r)}else{i=new Uint8Array(9);const s=new DataView(i.buffer);s.setUint8(0,127),s.setBigUint64(1,BigInt(r))}t.data&&typeof t.data!="string"&&(i[0]|=128),e.enqueue(i),e.enqueue(n)})}})}let cR;function YN(t){return t.reduce((e,n)=>e+n.length,0)}function XN(t,e){if(t[0].length===e)return t.shift();const n=new Uint8Array(e);let r=0;for(let i=0;i<e;i++)n[i]=t[0][r++],r===t[0].length&&(t.shift(),r=0);return t.length&&r<t[0].length&&(t[0]=t[0].slice(r)),n}function yEe(t,e){cR||(cR=new TextDecoder);const n=[];let r=0,i=-1,s=!1;return new TransformStream({transform(a,l){for(n.push(a);;){if(r===0){if(YN(n)<1)break;const c=XN(n,1);s=(c[0]&128)===128,i=c[0]&127,i<126?r=3:i===126?r=1:r=2}else if(r===1){if(YN(n)<2)break;const c=XN(n,2);i=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),r=3}else if(r===2){if(YN(n)<8)break;const c=XN(n,8),u=new DataView(c.buffer,c.byteOffset,c.length),d=u.getUint32(0);if(d>Math.pow(2,21)-1){l.enqueue(L4);break}i=d*Math.pow(2,32)+u.getUint32(4),r=3}else{if(YN(n)<i)break;const c=XN(n,i);l.enqueue(mz(s?c:cR.decode(c),e)),r=0}if(i===0||i>t){l.enqueue(L4);break}}}})}const lse=4;function Ti(t){if(t)return vEe(t)}function vEe(t){for(var e in Ti.prototype)t[e]=Ti.prototype[e];return t}Ti.prototype.on=Ti.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this};Ti.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this};Ti.prototype.off=Ti.prototype.removeListener=Ti.prototype.removeAllListeners=Ti.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+t];
vendor: 8,916 bytes, line 126
126if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var r,i=0;i<n.length;i++)if(r=n[i],r===e||r.fn===e){n.splice(i,1);break}return n.length===0&&delete this._callbacks["$"+t],this};Ti.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),n=this._callbacks["$"+t],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,i=n.length;r<i;++r)n[r].apply(this,e)}return this};Ti.prototype.emitReserved=Ti.prototype.emit;Ti.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]};Ti.prototype.hasListeners=function(t){return!!this.listeners(t).length};const xT=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,n)=>n(e,0),Jo=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),bEe="arraybuffer";function cse(t,...e){return e.reduce((n,r)=>(t.hasOwnProperty(r)&&(n[r]=t[r]),n),{})}const wEe=Jo.setTimeout,_Ee=Jo.clearTimeout;function yT(t,e){e.useNativeTimers?(t.setTimeoutFn=wEe.bind(Jo),t.clearTimeoutFn=_Ee.bind(Jo)):(t.setTimeoutFn=Jo.setTimeout.bind(Jo),t.clearTimeoutFn=Jo.clearTimeout.bind(Jo))}const SEe=1.33;function NEe(t){return typeof t=="string"?jEe(t):Math.ceil((t.byteLength||t.size)*SEe)}function jEe(t){let e=0,n=0;for(let r=0,i=t.length;r<i;r++)e=t.charCodeAt(r),e<128?n+=1:e<2048?n+=2:e<55296||e>=57344?n+=3:(r++,n+=4);return n}function use(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function CEe(t){let e="";for(let n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}function kEe(t){let e={},n=t.split("&");for(let r=0,i=n.length;r<i;r++){let s=n[r].split("=");e[decodeURIComponent(s[0])]=decodeURIComponent(s[1])}return e}class EEe extends Error{constructor(e,n,r){super(e),this.description=n,this.context=r,this.type="TransportError"}}class gz extends Ti{constructor(e){super(),this.writable=!1,yT(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,n,r){return super.emitReserved("error",new EEe(e,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const n=mz(e,this.socket.binaryType);this.onPacket(n)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,n={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const n=CEe(e);return n.length?"?"+n:""}}class AEe extends gz{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const n=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};gEe(e,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,mEe(e,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=use()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(e,n)}}let dse=!1;try{dse=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const TEe=dse;function MEe(){}class PEe extends AEe{constructor(e){if(super(e),typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||r!==e.port}}doWrite(e,n){const r=this.request({method:"POST",data:e});r.on("success",n),r.on("error",(i,s)=>{this.onError("xhr post error",i,s)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=e}}class qc extends Ti{constructor(e,n,r){super(),this.createRequest=e,yT(this,r),this._opts=r,this._method=r.method||"GET",this._uri=n,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var e;const n=cse(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this._opts.extraHeaders[i])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var i;r.readyState===3&&((i=this._opts.cookieJar)===null||i===void 0||i.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(i){this.setTimeoutFn(()=>{this._onError(i)},0);return}typeof document<"u"&&(this._index=qc.requestsCount++,qc.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=MEe,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete qc.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}qc.requestsCount=0;qc.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",iH);else if(typeof addEventListener=="function"){const t="onpagehide"in Jo?"pagehide":"unload";addEventListener(t,iH,!1)}}function iH(){for(let t in qc.requests)qc.requests.hasOwnProperty(t)&&qc.requests[t].abort()}const OEe=function(){const t=fse({xdomain:!1});return t&&t.responseType!==null}();class REe extends PEe{constructor(e){super(e);const n=e&&e.forceBase64;this.supportsBinary=OEe&&!n}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new qc(fse,this.uri(),e)}}function fse(t){const e=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||TEe))return new XMLHttpRequest}catch{}if(!e)try{return new Jo[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const hse=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class IEe extends gz{get name(){return"websocket"}doOpen(){const e=this.uri(),n=this.opts.protocols,r=hse?{}:cse(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let n=0;n<e.length;n++){const r=e[n],i=n===e.length-1;pz(r,this.supportsBinary,s=>{try{this.doWrite(r,s)}catch{}i&&xT(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=use()),this.supportsBinary||(n.b64=1),this.createUri(e,n
vendor: 20,327 bytes, line 126
126)}}const uR=Jo.WebSocket||Jo.MozWebSocket;let DEe=class extends IEe{createSocket(e,n,r){return hse?new uR(e,n,r):n?new uR(e,n):new uR(e)}doWrite(e,n){this.ws.send(n)}};class LEe extends gz{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const n=yEe(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(n).getReader(),i=xEe();i.readable.pipeTo(e.writable),this._writer=i.writable.getWriter();const s=()=>{r.read().then(({done:l,value:c})=>{l||(this.onPacket(c),s())}).catch(l=>{})};s();const a={type:"open"};this.query.sid&&(a.data=`{"sid":"${this.query.sid}"}`),this._writer.write(a).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let n=0;n<e.length;n++){const r=e[n],i=n===e.length-1;this._writer.write(r).then(()=>{i&&xT(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const $Ee={websocket:DEe,webtransport:LEe,polling:REe},FEe=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,UEe=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function $4(t){if(t.length>8e3)throw"URI too long";const e=t,n=t.indexOf("["),r=t.indexOf("]");n!=-1&&r!=-1&&(t=t.substring(0,n)+t.substring(n,r).replace(/:/g,";")+t.substring(r,t.length));let i=FEe.exec(t||""),s={},a=14;for(;a--;)s[UEe[a]]=i[a]||"";return n!=-1&&r!=-1&&(s.source=e,s.host=s.host.substring(1,s.host.length-1).replace(/;/g,":"),s.authority=s.authority.replace("[","").replace("]","").replace(/;/g,":"),s.ipv6uri=!0),s.pathNames=zEe(s,s.path),s.queryKey=BEe(s,s.query),s}function zEe(t,e){const n=/\/{2,9}/g,r=e.replace(n,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&r.splice(0,1),e.slice(-1)=="/"&&r.splice(r.length-1,1),r}function BEe(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,s){i&&(n[i]=s)}),n}const F4=typeof addEventListener=="function"&&typeof removeEventListener=="function",BC=[];F4&&addEventListener("offline",()=>{BC.forEach(t=>t())},!1);class fh extends Ti{constructor(e,n){if(super(),this.binaryType=bEe,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(n=e,e=null),e){const r=$4(e);n.hostname=r.host,n.secure=r.protocol==="https"||r.protocol==="wss",n.port=r.port,r.query&&(n.query=r.query)}else n.host&&(n.hostname=$4(n.host).host);yT(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(r=>{const i=r.prototype.name;this.transports.push(i),this._transportsByName[i]=r}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=kEe(this.opts.query)),F4&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},BC.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const n=Object.assign({},this.opts.query);n.EIO=lse,n.transport=e,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&fh.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(e);n.open(),this.setTransport(n)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",fh.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=e.data,this._onError(n);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r<this.writeBuffer.length;r++){const i=this.writeBuffer[r].data;if(i&&(n+=NEe(i)),r>0&&n>this._maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,xT(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,n,r){return this._sendPacket("message",e,n,r),this}send(e,n,r){return this._sendPacket("message",e,n,r),this}_sendPacket(e,n,r,i){if(typeof n=="function"&&(i=n,n=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const s={type:e,data:n,options:r};this.emitReserved("packetCreate",s),this.writeBuffer.push(s),i&&this.once("flush",i),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),e()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():e()}):this.upgrading?r():e()),this}_onError(e){if(fh.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),F4&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=BC.indexOf(this._offlineEventListener);r!==-1&&BC.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,n),this.writeBuffer=[],this._prevBufferLen=0}}}fh.protocol=lse;class VEe extends fh{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let n=this.createTransport(e),r=!1;fh.priorWebsocketSuccess=!1;const i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",f=>{if(!r)if(f.type==="pong"&&f.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;fh.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(d(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const h=new Error("probe error");h.transport=n.name,this.emitReserved("upgradeError",h)}}))};function s(){r||(r=!0,d(),n.close(),n=null)}const a=f=>{const h=new Error("probe error: "+f);h.transport=n.name,s(),this.emitReserved("upgradeError",h)};function l(){a("transport closed")}function c(){a("socket closed")}function u(f){n&&f.name!==n.name&&s()}const d=()=>{n.removeListener("open",i),n.removeListener("error",a),n.removeListener("close",l),this.off("close",c),this.off("upgrading",u)};n.once("open",i),n.once("error",a),n.once("close",l),this.once("close",c),this.once("upgrading",u),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const n=[];for(let r=0;r<e.length;r++)~this.transports.indexOf(e[r])&&n.push(e[r]);return n}}let HEe=class extends VEe{constructor(e,n={}){const r=typeof e=="object"?e:n;(!r.transports||r.transports&&typeof r.transports[0]=="string")&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(i=>$Ee[i]).filter(i=>!!i)),super(e,r)}};function WEe(t,e="",n){let r=t;n=n||typeof location<"u"&&location,t==null&&(t=n.protocol+"//"+n.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=n.protocol+t:t=n.host+t),/^(https?|wss?):\/\//.test(t)||(typeof n<"u"?t=n.protocol+"//"+t:t="https://"+t),r=$4(t)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const s=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+s+":"+r.port+e,r.href=r.protocol+"://"+s+(n&&n.port===r.port?"":":"+r.port),r}const GEe=typeof ArrayBuffer=="function",qEe=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,pse=Object.prototype.toString,KEe=typeof Blob=="function"||typeof Blob<"u"&&pse.call(Blob)==="[object BlobConstructor]",YEe=typeof File=="function"||typeof File<"u"&&pse.call(File)==="[object FileConstructor]";function xz(t){return GEe&&(t instanceof ArrayBuffer||qEe(t))||KEe&&t instanceof Blob||YEe&&t instanceof File}function VC(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,r=t.length;n<r;n++)if(VC(t[n]))return!0;return!1}if(xz(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return VC(t.toJSON(),!0);for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&VC(t[n]))return!0;return!1}function XEe(t){const e=[],n=t.data,r=t;return r.data=U4(n,e),r.attachments=e.length,{packet:r,buffers:e}}function U4(t,e){if(!t)return t;if(xz(t)){const n={_placeholder:!0,num:e.length};return e.push(t),n}else if(Array.isArray(t)){const n=new Array(t.length);for(let r=0;r<t.length;r++)n[r]=U4(t[r],e);return n}else if(typeof t=="object"&&!(t instanceof Date)){const n={};for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=U4(t[r],e));return n}return t}function QEe(t,e){return t.data=z4(t.data,e),delete t.attachments,t}function z4(t,e){if(!t)return t;if(t&&t._placeholder===!0){if(typeof t.num=="number"&&t.num>=0&&t.num<e.length)return e[t.num];throw new Error("illegal attachments")}else if(Array.isArray(t))for(let n=0;n<t.length;n++)t[n]=z4(t[n],e);else if(typeof t=="object")for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t[n]=z4(t[n],e));return t}const mse=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],JEe=5;var _n;(function(t){t[t.CONNECT=0]="CONNECT",t[t.DISCONNECT=1]="DISCONNECT",t[t.EVENT=2]="EVENT",t[t.ACK=3]="ACK",t[t.CONNECT_ERROR=4]="CONNECT_ERROR",t[t.BINARY_EVENT=5]="BINARY_EVENT",t[t.BINARY_ACK=6]="BINARY_ACK"})(_n||(_n={}));class ZEe{constructor(e){this.replacer=e}encode(e){return(e.type===_n.EVENT||e.type===_n.ACK)&&VC(e)?this.encodeAsBinary({type:e.type===_n.EVENT?_n.BINARY_EVENT:_n.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let n=""+e.type;return(e.type===_n.BINARY_EVENT||e.type===_n.BINARY_ACK)&&(n+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(n+=e.nsp+","),e.id!=null&&(n+=e.id),e.data!=null&&(n+=JSON.stringify(e.data,this.replacer)),n}encodeAsBinary(e){const n=XEe(e),r=this.encodeAsString(n.packet),i=n.buffers;return i.unshift(r),i}}class yz extends Ti{constructor(e){super(),this.reviver=e}add(e){let n;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(e);const r=n.type===_n.BINARY_EVENT;r||n.type===_n.BINARY_ACK?(n.type=r?_n.EVENT:_n.ACK,this.reconstructor=new eAe(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(xz(e)||e.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(e),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let n=0;const r={type:Number(e.charAt(0))};if(_n[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===_n.BINARY_EVENT||r.type===_n.BINARY_ACK){const s=n+1;for(;e.charAt(++n)!=="-"&&n!=e.length;);const a=e.substring(s,n);if(a!=Number(a)||e.charAt(n)!=="-")throw new Error("Illegal attachments");r.attachments=Number(a)}if(e.charAt(n+1)==="/"){const s=n+1;for(;++n&&!(e.charAt(n)===","||n===e.length););r.nsp=e.substring(s,n)}else r.nsp="/";const i=e.charAt(n+1);if(i!==""&&Number(i)==i){const s=n+1;for(;++n;){const a=e.charAt(n);if(a==null||Number(a)!=a){--n;break}if(n===e.length)break}r.id=Number(e.substring(s,n+1))}if(e.charAt(++n)){const s=this.tryParse(e.substr(n));if(yz.isPayloadValid(r.type,s))r.data=s;else throw new Error("invalid payload")}return r}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,n){switch(e){case _n.CONNECT:return Qk(n);case _n.DISCONNECT:return n===void 0;case _n.CONNECT_ERROR:return typeof n=="string"||Qk(n);case _n.EVENT:case _n.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&mse.indexOf(n[0])===-1);case _n.ACK:case _n.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class eAe{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const n=QEe(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function tAe(t){return typeof t=="string"}const nAe=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};function rAe(t){return t===void 0||nAe(t)}function Qk(t){return Object.prototype.toString.call(t)==="[object Object]"}function iAe(t,e){switch(t){case _n.CONNECT:return e===void 0||Qk(e);case _n.DISCONNECT:return e===void 0;case _n.EVENT:return Array.isArray(e)&&(typeof e[0]=="number"||typeof e[0]=="string"&&mse.indexOf(e[0])===-1);case _n.ACK:return Array.isArray(e);case _n.CONNECT_ERROR:return typeof e=="string"||Qk(e);default:return!1}}function sAe(t){return tAe(t.nsp)&&rAe(t.id)&&iAe(t.type,t.data)}const aAe=Object.freeze(Object.defineProperty({__proto__:null,Decoder:yz,Encoder:ZEe,get PacketType(){return _n},isPacketValid:sAe,protocol:JEe},Symbol.toStringTag,{value:"Module"}));function zl(t,e,n){return t.on(e,n),function(){t.off(e,n)}}const oAe=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class gse extends Ti{constructor(e,n,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[zl(e,"open",this.onopen.bind(this)),zl(e,"packet",this.onpacket.bind(this)),zl(e,"error",this.onerror.bind(this)),zl(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...n){var r,i,s;if(oAe.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(n.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const a={type:_n.EVENT,data:n};if(a.options={},a.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const d=this.ids++,f=n.pop();this._registerAckCallback(d,f),a.id=d}const l=(i=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||i===void 0?void 0:i.writable,c=this.connected&&!(!((s=this.io.engine)===null||s===void 0)&&s._hasPingExpired());return this.flags.volatile&&!l||(c?(this.notifyOutgoingListeners(a),this.packet(a)):this.sendBuffer.push(a)),this.flags={},this}_registerAckCallback(e,n){var r;const i=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(i===void 0){this.acks[e]=n;return}const s=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let l=0;l<this.sendBuffer.length;l++)this.sendBuffer[l].id===e&&this.sendBuffer.splice(l,1);n.call(this,new Error("operation has timed out"))},i),a=(...l)=>{this.io.clearTimeoutFn(s),n.apply(this,l)};a.withError=!0,this.acks[e]=a}emitWithAck(e,...n){return new Promise((r,i)=>{const s=(a,l)=>a?i(a):r(l);s.withError=!0,n.push(s),this.emit(e,...n)})}_addToQueue(e){let n;typeof e[e.length-1]=="function"&&(n=e.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((i,...s)=>(this._queue[0],i!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...s)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!e||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:_n.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,n),this._clearAcks()}
vendor: 7,085 bytes, line 126
126_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(r=>String(r.id)===e)){const r=this.acks[e];delete this.acks[e],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case _n.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case _n.EVENT:case _n.BINARY_EVENT:this.onevent(e);break;case _n.ACK:case _n.BINARY_ACK:this.onack(e);break;case _n.DISCONNECT:this.ondisconnect();break;case _n.CONNECT_ERROR:this.destroy();const r=new Error(e.data.message);r.data=e.data.data,this.emitReserved("connect_error",r);break}}onevent(e){const n=e.data||[];e.id!=null&&n.push(this.ack(e.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const n=this;let r=!1;return function(...i){r||(r=!0,n.packet({type:_n.ACK,id:e,data:i}))}}onack(e){const n=this.acks[e.id];typeof n=="function"&&(delete this.acks[e.id],n.withError&&e.data.unshift(null),n.apply(this,e.data))}onconnect(e,n){this.id=e,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:_n.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const n=this._anyListeners;for(let r=0;r<n.length;r++)if(e===n[r])return n.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const n=this._anyOutgoingListeners;for(let r=0;r<n.length;r++)if(e===n[r])return n.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const r of n)r.apply(this,e.data)}}}function C0(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}C0.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=Math.floor(e*10)&1?t+n:t-n}return Math.min(t,this.max)|0};C0.prototype.reset=function(){this.attempts=0};C0.prototype.setMin=function(t){this.ms=t};C0.prototype.setMax=function(t){this.max=t};C0.prototype.setJitter=function(t){this.jitter=t};class B4 extends Ti{constructor(e,n){var r;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(n=e,e=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,yT(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new C0({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=e;const i=n.parser||aAe;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var n;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(n=this.backoff)===null||n===void 0||n.setMin(e),this)}randomizationFactor(e){var n;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(n=this.backoff)===null||n===void 0||n.setJitter(e),this)}reconnectionDelayMax(e){var n;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(n=this.backoff)===null||n===void 0||n.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new HEe(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=zl(n,"open",function(){r.onopen(),e&&e()}),s=l=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",l),e?e(l):this.maybeReconnectOnOpen()},a=zl(n,"error",s);if(this._timeout!==!1){const l=this._timeout,c=this.setTimeoutFn(()=>{i(),s(new Error("timeout")),n.close()},l);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(i),this.subs.push(a),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(zl(e,"ping",this.onping.bind(this)),zl(e,"data",this.ondata.bind(this)),zl(e,"error",this.onerror.bind(this)),zl(e,"close",this.onclose.bind(this)),zl(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(n){this.onclose("parse error",n)}}ondecoded(e){xT(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,n){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new gse(this,e,n),this.nsps[e]=r),r}_destroy(e){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(e){const n=this.encoder.encode(e);for(let r=0;r<n.length;r++)this.engine.write(n[r],e.options)}
126cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,n){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(i=>{i?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",i)):e.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const db={};function HC(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const n=WEe(t,e.path||"/socket.io"),r=n.source,i=n.id,s=n.path,a=db[i]&&s in db[i].nsps,l=e.forceNew||e["force new connection"]||e.multiplex===!1||a;let c;return l?c=new B4(r,e):(db[i]||(db[i]=new B4(r,e)),c=db[i]),n.query&&!e.query&&(e.query=n.queryKey),c.socket(n.path,e)}Object.assign(HC,{Manager:B4,Socket:gse,io:HC,connect:HC});const lAe="https://api.hjaelp.ai";let Hi=null;function Um(){return Hi}function cAe(t){return Hi!=null&&Hi.connected||(Hi=HC(lAe,{auth:{token:t},transports:["websocket","polling"],reconnection:!0,reconnectionAttempts:5,reconnectionDelay:1e3}),Hi.on("connect",()=>{console.log("Socket connected")}),Hi.on("disconnect",e=>{console.log("Socket disconnected:",e)}),Hi.on("connect_error",e=>{console.error("Socket connection error:",e)})),Hi}function uAe(){Hi&&(Hi.disconnect(),Hi=null)}function sH(t){Hi==null||Hi.emit("company:subscribe",{companyId:t})}function dAe(t){Hi==null||Hi.emit("company:unsubscribe",{companyId:t})}const fAe={};function hAe(t,e){let n;try{n=t()}catch{return}return{getItem:i=>{var s;const a=c=>c===null?null:JSON.parse(c,void 0),l=(s=n.getItem(i))!=null?s:null;return l instanceof Promise?l.then(a):a(l)},setItem:(i,s)=>n.setItem(i,JSON.stringify(s,void 0)),removeItem:i=>n.removeItem(i)}}const B1=t=>e=>{try{const n=t(e);return n instanceof Promise?n:{then(r){return B1(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return B1(r)(n)}}}},pAe=(t,e)=>(n,r,i)=>{let s={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:y=>y,version:0,merge:(y,g)=>({...g,...y}),...e},a=!1;const l=new Set,c=new Set;let u;try{u=s.getStorage()}catch{}if(!u)return t((...y)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),n(...y)},r,i);const d=B1(s.serialize),f=()=>{const y=s.partialize({...r()});let g;const w=d({state:y,version:s.version}).then(v=>u.setItem(s.name,v)).catch(v=>{g=v});if(g)throw g;return w},h=i.setState;i.setState=(y,g)=>{h(y,g),f()};const p=t((...y)=>{n(...y),f()},r,i);let m;const x=()=>{var y;if(!u)return;a=!1,l.forEach(w=>w(r()));const g=((y=s.onRehydrateStorage)==null?void 0:y.call(s,r()))||void 0;return B1(u.getItem.bind(u))(s.name).then(w=>{if(w)return s.deserialize(w)}).then(w=>{if(w)if(typeof w.version=="number"&&w.version!==s.version){if(s.migrate)return s.migrate(w.state,w.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return w.state}).then(w=>{var v;return m=s.merge(w,(v=r())!=null?v:p),n(m,!0),f()}).then(()=>{g==null||g(m,void 0),a=!0,c.forEach(w=>w(m))}).catch(w=>{g==null||g(void 0,w)})};return i.persist={setOptions:y=>{s={...s,...y},y.getStorage&&(u=y.getStorage())},clearStorage:()=>{u==null||u.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>x(),hasHydrated:()=>a,onHydrate:y=>(l.add(y),()=>{l.delete(y)}),onFinishHydration:y=>(c.add(y),()=>{c.delete(y)})},x(),m||p},mAe=(t,e)=>(n,r,i)=>{let s={storage:hAe(()=>localStorage),partialize:x=>x,version:0,merge:(x,y)=>({...y,...x}),...e},a=!1;const l=new Set,c=new Set;let u=s.storage;if(!u)return t((...x)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),n(...x)},r,i);const d=()=>{const x=s.partialize({...r()});return u.setItem(s.name,{state:x,version:s.version})},f=i.setState;i.setState=(x,y)=>{f(x,y),d()};const h=t((...x)=>{n(...x),d()},r,i);i.getInitialState=()=>h;let p;const m=()=>{var x,y;if(!u)return;a=!1,l.forEach(w=>{var v;return w((v=r())!=null?v:h)});const g=((y=s.onRehydrateStorage)==null?void 0:y.call(s,(x=r())!=null?x:h))||void 0;return B1(u.getItem.bind(u))(s.name).then(w=>
126{if(w)if(typeof w.version=="number"&&w.version!==s.version){if(s.migrate)return[!0,s.migrate(w.state,w.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,w.state];return[!1,void 0]}).then(w=>{var v;const[N,S]=w;if(p=s.merge(S,(v=r())!=null?v:h),n(p,!0),N)return d()}).then(()=>{g==null||g(p,void 0),p=r(),a=!0,c.forEach(w=>w(p))}).catch(w=>{g==null||g(void 0,w)})};return i.persist={setOptions:x=>{s={...s,...x},x.storage&&(u=x.storage)},clearStorage:()=>{u==null||u.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>m(),hasHydrated:()=>a,onHydrate:x=>(l.add(x),()=>{l.delete(x)}),onFinishHydration:x=>(c.add(x),()=>{c.delete(x)})},s.skipHydration||m(),p||h},gAe=(t,e)=>"getStorage"in e||"serialize"in e||"deserialize"in e?((fAe?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),pAe(t,e)):mAe(t,e),xse=gAe,Ri=$d()(xse((t,e)=>({companies:[],currentCompanyId:null,isLoading:!1,hasFetched:!1,get currentCompany(){const{companies:n,currentCompanyId:r}=e();return n.find(i=>i.id===r)??null},fetchCompanies:async()=>{t({isLoading:!0});try{const n=await Ce.get("/companies");t({companies:n,hasFetched:!0});const{currentCompanyId:r}=e();r&&n.some(s=>s.id===r)||t({currentCompanyId:n.length>0?n[0].id:null})}finally{t({isLoading:!1})}},setCurrentCompany:n=>{t({currentCompanyId:n})},createCompany:async n=>{const r=await Ce.post("/companies",n);return t(i=>({companies:[...i.companies,r],currentCompanyId:r.id})),r},updateCompany:async(n,r)=>{await Ce.patch(`/companies/${n}`,r),t(i=>({companies:i.companies.map(s=>s.id===n?{...s,...r}:s)}))},deleteCompany:async n=>{await Ce.delete(`/companies/${n}`),t(r=>{var i;return{companies:r.companies.filter(s=>s.id!==n),currentCompanyId:r.currentCompanyId===n?((i=r.companies[0])==null?void 0:i.id)??null:r.currentCompanyId}})},updateCompanyLlmCount:(n,r)=>{t(i=>({companies:i.companies.map(s=>s.id===n?{...s,enabledLlmsCount:r}:s)}))}}),{name:"company-storage",partialize:t=>({currentCompanyId:t.currentCompanyId})})),Jk=$d((t,e)=>({runningQueries:new Map,setQueryStatus:(n,r)=>{t(i=>{const s=new Map(i.runningQueries);return(r==="completed"||r==="failed"||r===null)&&setTimeout(()=>{e().clearQueryStatus(n)},2e3),s.set(n,r),{runningQueries:s}})},clearQueryStatus:n=>{t(r=>{const i=new Map(r.runningQueries);return i.delete(n),{runningQueries:i}})},isQueryRunning:n=>{const r=e().runningQueries.get(n);return r==="started"||r==="analyzing"},getQueryStatus:n=>e().runningQueries.get(n)||null})),xAe=500,V1=$d((t,e)=>({lastRankingUpdate:null,lastUpdateTimestamp:0,_pendingUpdate:null,_debounceTimer:null,setLastRankingUpdate:n=>{const{_debounceTimer:r}=e();r&&clearTimeout(r),t({_pendingUpdate:n});const i=setTimeout(()=>{const{_pendingUpdate:s}=e();if(s){const a=Date.now();t({lastRankingUpdate:{...s,timestamp:a},lastUpdateTimestamp:a,_pendingUpdate:null,_debounceTimer:null})}},xAe);t({_debounceTimer:i})}})),V4=$d(t=>({newCount:0,setNewCount:e=>t({newCount:e}),incrementNewCount:()=>t(e=>({newCount:e.newCount+1})),decrementNewCount:()=>t(e=>({newCount:Math.max(0,e.newCount-1)}))})),ca=$d()(xse((t,e)=>({conversations:[],isLoadingConversations:!1,activeConversationId:null,messages:{},isLoadingMessages:!1,isOpen:!1,activeTab:"list",pageContext:null,isStreaming:!1,streamingMessageId:null,streamingContent:"",currentSteps:[],articleGenerations:{},chatBudget:null,fetchChatBudget:async n=>{try{const r=await Ce.get(`/companies/${n}/agent/budget`);t({chatBudget:r})}catch(r){console.error("Failed to fetch agent chat budget:",r)}},fetchConversations:async n=>{t({isLoadingConversations:!0});try{const r=await Ce.get(`/companies/${n}/agent/conversations`);t({conversations:r,isLoadingConversations:!1})}catch(r){console.error("Failed to fetch agent conversations:",r),t({isLoadingConversations:!1})}},createConversation:async n=>{try{const r=await Ce.post(`/companies/${n}/agent/conversations`,{});return t(i=>({conversations:[r,...i.conversations],activeConversationId:r.id,activeTab:"conversation",messages:{...i.messages,[r.id]:[]}})),r}catch(r){return console.error("Failed to create agent conversation:",r),null}},deleteConversation:async(n,r)=>{try{await Ce.delete(`/companies/${n}/agent/conversations/${r}`),t(i=>{const s={...i.messages};return delete s[r],{conversations:i.conversations.filter(a=>a.id!==r),activeConversationId:i.activeConversationId===r?null:i.activeConversationId,activeTab:i.activeConversationId===r?"list":i.activeTab,messages:s}})}catch(i){console.error("Failed to delete agent conversation:",i)}},fetchMessages:async(n,r)=>{t({isLoadingMessages:!0});try{const i=await Ce.get(`/companies/${n}/agent/conversations/${r}`);t(s=>({messages:{...s.messages,[r]:i.messages||[]},isLoadingMessages:!1}))}catch(i){console.error("Failed to fetch agent messages:",i),t({isLoadingMessages:!1})}},sendMessage:async(n,r,i)=>{try{const{pageContext:s}=e(),a=await Ce.post(`/companies/${n}/agent/conversations/${r}/messages`,{content:i,...s?{pageContext:s}:{}});t(l=>({messages:{...l.messages,[r]:[...l.messages[r]||[],a]},isStreaming:!0,streamingContent:"",streamingMessageId:null,currentSteps:[],chatBudget:l.chatBudget?{...l.chatBudget,usedThisMonth:l.chatBudget.usedThisMonth+1,remaining:Math.max(0,l.chatBudget.remaining-1)}:l.chatBudget}))}
126catch(s){if(s instanceof nse){const a=s.code==="PLAN_LIMIT_REACHED",l={id:crypto.randomUUID(),conversationId:r,role:"assistant",content:a?"You've reached your monthly agent chat limit. Upgrade your plan to continue chatting with the AI agent.":s.message,metadata:{error:s.message},createdAt:new Date().toISOString()};t(c=>({messages:{...c.messages,[r]:[...c.messages[r]||[],l]},chatBudget:a&&c.chatBudget?{...c.chatBudget,remaining:0}:c.chatBudget}))}else console.error("Failed to send agent message:",s)}},setActiveConversation:n=>{t({activeConversationId:n,activeTab:n?"conversation":"list",isStreaming:!1,streamingContent:"",streamingMessageId:null,currentSteps:[]})},toggleOpen:()=>t(n=>({isOpen:!n.isOpen})),setOpen:n=>t({isOpen:n}),setActiveTab:n=>t({activeTab:n}),setPageContext:n=>t({pageContext:n}),generateArticle:async(n,r,i,s)=>{try{const a=await Ce.post(`/companies/${n}/agent/conversations/${r}/generate-article`,{title:i.title,topic:i.topic,contentType:i.contentType,messageId:s});t(l=>({articleGenerations:{...l.articleGenerations,[a.articleId]:{articleId:a.articleId,title:a.title,steps:[],status:"generating"}}}))}catch(a){console.error("Failed to generate article from agent:",a)}},handleStepUpdate:n=>{const{activeConversationId:r}=e();n.conversationId===r&&t(i=>{const s=i.currentSteps.findIndex(l=>l.label===n.step.label),a=[...i.currentSteps];return s>=0?a[s]=n.step:a.push(n.step),{currentSteps:a,streamingMessageId:n.messageId}})},handleStreamChunk:n=>{const{activeConversationId:r}=e();n.conversationId===r&&t(i=>({streamingContent:i.streamingContent+n.chunk,streamingMessageId:n.messageId}))},handleStreamComplete:n=>{const{activeConversationId:r}=e();if(n.conversationId!==r)return;const i={id:n.messageId,conversationId:n.conversationId,role:"assistant",content:n.message.content,toolCalls:n.message.toolCalls,steps:n.message.steps,metadata:n.message.metadata,createdAt:new Date().toISOString()};t(s=>{const a=s.messages[n.conversationId]||[];return{messages:{...s.messages,[n.conversationId]:[...a,i]},isStreaming:!1,streamingContent:"",streamingMessageId:null,currentSteps:[],conversations:s.conversations.map(l=>l.id===n.conversationId?{...l,updatedAt:new Date().toISOString()}:l)}})},handleError:n=>{const{activeConversationId:r}=e();if(n.conversationId!==r)return;const i={id:n.messageId,conversationId:n.conversationId,role:"assistant",content:"I'm sorry, I encountered an error while processing your request. Please try again.",metadata:{error:n.error},createdAt:new Date().toISOString()};t(s=>({messages:{...s.messages,[n.conversationId]:[...s.messages[n.conversationId]||[],i]},isStreaming:!1,streamingContent:"",streamingMessageId:null,currentSteps:[]}))},handleArticleGenerationStarted:n=>{t(r=>({articleGenerations:{...r.articleGenerations,[n.articleId]:{articleId:n.articleId,title:n.title,steps:[],status:"generating"}}}))},handleArticleStep:n=>{t(r=>{const i=r.articleGenerations[n.articleId];if(!i)return r;const s=i.steps.findIndex(l=>l.step===n.step),a=[...i.steps];return s>=0?a[s]={step:n.step,status:n.status,label:n.label}:a.push({step:n.step,status:n.status,label:n.label}),{articleGenerations:{...r.articleGenerations,[n.articleId]:{...i,steps:a}}}})},handleArticleCompleted:n=>{t(r=>{const i=r.articleGenerations[n.articleId];return i?{articleGenerations:{...r.articleGenerations,[n.articleId]:{...i,status:"completed",wordCount:n.wordCount,articleUrl:n.articleUrl}}}:r})}}),{name:"agent-store",partialize:t=>
126({isOpen:t.isOpen,activeConversationId:t.activeConversationId,activeTab:t.activeTab})})),H4=new pNe({defaultOptions:{queries:{staleTime:1e3*60,retry:1,refetchOnWindowFocus:!1}}}),yse=$d((t,e)=>({socket:null,isConnected:!1,subscribedCompanies:new Set,connect:n=>{const r=cAe(n);r.on("connect",()=>{t({isConnected:!0});const{subscribedCompanies:i}=e();i.forEach(s=>{sH(s)})}),r.on("disconnect",()=>{t({isConnected:!1})}),r.on("profile:updated",i=>{Rr.getState().updateProfileUsage(i),i.onboardingCompletedAt!==void 0&&Rr.getState().refreshProfile()}),r.on("company:llm_count",i=>{Ri.getState().updateCompanyLlmCount(i.companyId,i.enabledLlmsCount)}),r.on("query:processing",i=>{Jk.getState().setQueryStatus(i.queryId,i.status)}),r.on("query:ranking_updated",i=>{V1.getState().setLastRankingUpdate({companyId:i.companyId,queryId:i.queryId,ranking:i.ranking})}),r.on("competitor:enriched",i=>{V1.getState().setLastRankingUpdate({companyId:i.companyId,queryId:"",ranking:null})}),r.on("tokens:balance_updated",i=>{Rr.getState().updateTokenBalance(i.tokenBalance)}),r.on("opportunity:new",()=>{V4.getState().incrementNewCount()}),r.on("opportunity:count_updated",i=>{V4.getState().setNewCount(i.newCount)}),r.on("setup:task_updated",i=>{H4.invalidateQueries({queryKey:["setup-status",i.companyId]}),i.taskType==="sitemap_crawl"&&H4.invalidateQueries({queryKey:["audit-status",i.companyId]})}),r.on("agent:step_update",i=>{ca.getState().handleStepUpdate(i)}),r.on("agent:stream_chunk",i=>{ca.getState().handleStreamChunk(i)}),r.on("agent:stream_complete",i=>{ca.getState().handleStreamComplete(i)}),r.on("agent:error",i=>{ca.getState().handleError(i)}),r.on("agent:article_generation_started",i=>{ca.getState().handleArticleGenerationStarted(i)}),r.on("agent:article_step",i=>{ca.getState().handleArticleStep(i)}),r.on("agent:article_completed",i=>{ca.getState().handleArticleCompleted(i)}),t({socket:r})},disconnect:()=>{uAe(),t({socket:null,isConnected:!1,subscribedCompanies:new Set})},subscribeToCompany:n=>{sH(n),t(r=>({subscribedCompanies:new Set([...r.subscribedCompanies,n])}))},unsubscribeFromCompany:n=>{dAe(n),t(r=>{const i=new Set(r.subscribedCompanies);return i.delete(n),{subscribedCompanies:i}})}}));function vse(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(n=vse(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function an(){for(var t,e,n=0,r="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=vse(t))&&(r&&(r+=" "),r+=e);return r}const vz="-",yAe=t=>{const e=bAe(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:a=>{const l=a.split(vz);return l[0]===""&&l.length!==1&&l.shift(),bse(l,e)||vAe(a)},getConflictingClassGroupIds:(a,l)=>{const c=n[a]||[];return l&&r[a]?[...c,...r[a]]:c}}},bse=(t,e)=>{var a;if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),i=r?bse(t.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(vz);return(a=e.validators.find(({validator:l})=>l(s)))==null?void 0:a.classGroupId},aH=/^\[(.+)\]$/,vAe=t=>{if(aH.test(t)){const e=aH.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},bAe=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return _Ae(Object.entries(t.classGroups),n).forEach(([s,a])=>{W4(a,r,s,e)}),r},W4=(t,e,n,r)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:oH(e,i);s.classGroupId=n;return}if(typeof i=="function"){if(wAe(i)){W4(i(r),e,n,r);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([s,a])=>{W4(a,oH(e,s),n,r)})})},oH=(t,e)=>{let n=t;return e.split(vz).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},wAe=t=>t.isThemeGetter,_Ae=(t,e)=>e?t.map(([n,r])=>{const i=r.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([a,l])=>[e+a,l])):s);return[n,i]}):t,SAe=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const i=(s,a)=>{n.set(s,a),e++,e>t&&(e=0,r=n,n=new Map)};return{get(s){let a=n.get(s);if(a!==void 0)return a;
vendor: 4,313 bytes, line 126
126if((a=r.get(s))!==void 0)return i(s,a),a},set(s,a){n.has(s)?n.set(s,a):i(s,a)}}},wse="!",NAe=t=>{const{separator:e,experimentalParseClassName:n}=t,r=e.length===1,i=e[0],s=e.length,a=l=>{const c=[];let u=0,d=0,f;for(let y=0;y<l.length;y++){let g=l[y];if(u===0){if(g===i&&(r||l.slice(y,y+s)===e)){c.push(l.slice(d,y)),d=y+s;continue}if(g==="/"){f=y;continue}}g==="["?u++:g==="]"&&u--}const h=c.length===0?l:l.substring(d),p=h.startsWith(wse),m=p?h.substring(1):h,x=f&&f>d?f-d:void 0;return{modifiers:c,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:x}};return n?l=>n({className:l,parseClassName:a}):a},jAe=t=>{if(t.length<=1)return t;const e=[];let n=[];return t.forEach(r=>{r[0]==="["?(e.push(...n.sort(),r),n=[]):n.push(r)}),e.push(...n.sort()),e},CAe=t=>({cache:SAe(t.cacheSize),parseClassName:NAe(t),...yAe(t)}),kAe=/\s+/,EAe=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=e,s=[],a=t.trim().split(kAe);let l="";for(let c=a.length-1;c>=0;c-=1){const u=a[c],{modifiers:d,hasImportantModifier:f,baseClassName:h,maybePostfixModifierPosition:p}=n(u);let m=!!p,x=r(m?h.substring(0,p):h);if(!x){if(!m){l=u+(l.length>0?" "+l:l);continue}if(x=r(h),!x){l=u+(l.length>0?" "+l:l);continue}m=!1}const y=jAe(d).join(":"),g=f?y+wse:y,w=g+x;if(s.includes(w))continue;s.push(w);const v=i(x,m);for(let N=0;N<v.length;++N){const S=v[N];s.push(g+S)}l=u+(l.length>0?" "+l:l)}return l};function AAe(){let t=0,e,n,r="";for(;t<arguments.length;)(e=arguments[t++])&&(n=_se(e))&&(r&&(r+=" "),r+=n);return r}const _se=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=_se(t[r]))&&(n&&(n+=" "),n+=e);return n};function TAe(t,...e){let n,r,i,s=a;function a(c){const u=e.reduce((d,f)=>f(d),t());return n=CAe(u),r=n.cache.get,i=n.cache.set,s=l,l(c)}function l(c){const u=r(c);if(u)return u;const d=EAe(c,n);return i(c,d),d}return function(){return s(AAe.apply(null,arguments))}}const Lr=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},Sse=/^\[(?:([a-z-]+):)?(.+)\]$/i,MAe=/^\d+\/\d+$/,PAe=new Set(["px","full","screen"]),OAe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,RAe=/\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$/,IAe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,DAe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,LAe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Su=t=>Ny(t)||PAe.has(t)||MAe.test(t),Qd=t=>k0(t,"length",WAe),Ny=t=>!!t&&!Number.isNaN(Number(t)),dR=t=>k0(t,"number",Ny),fb=t=>!!t&&Number.isInteger(Number(t)),$Ae=t=>t.endsWith("%")&&Ny(t.slice(0,-1)),pn=t=>Sse.test(t),Jd=t=>OAe.test(t),FAe=new Set(["length","size","percentage"]),UAe=t=>k0(t,FAe,Nse),zAe=t=>k0(t,"position",Nse),BAe=new Set(["image","url"]),VAe=t=>k0(t,BAe,qAe),HAe=t=>k0(t,"",GAe),hb=()=>!0,k0=(t,e,n)=>{const r=Sse.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1},WAe=t=>RAe.test(t)&&!IAe.test(t),Nse=()=>!1,GAe=t=>DAe.test(t),qAe=t=>LAe.test(t),KAe=()=>{const t=Lr("colors"),e=Lr("spacing"),n=Lr("blur"),r=Lr("brightness"),i=Lr("borderColor"),s=Lr("borderRadius"),a=Lr("borderSpacing"),l=Lr("borderWidth"),c=Lr("contrast"),u=Lr("grayscale"),d=Lr("hueRotate"),f=Lr("invert"),h=Lr("gap"),p=Lr("gradientColorStops"),m=Lr("gradientColorStopPositions"),x=Lr("inset"),y=Lr("margin"),g=Lr("opacity"),w=Lr("padding"),v=Lr("saturate"),N=Lr("scale"),S=Lr("sepia"),_=Lr("skew"),j=Lr("space"),A=Lr("translate"),C=()=>["auto","contain","none"],k=()=>["auto","hidden","clip","visible","scroll"],M=()=>["auto",pn,e],I=()=>[pn,e],R=()=>["",Su,Qd],E=()=>["auto",Ny,pn],P=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],O=()=>["solid","dashed","dotted","double","none"],L=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],T=()=>["start","end","center","between","around","evenly","stretch"],D=()=>["","0",pn],F=()=>["auto","avoid","all","avoid-page","page","left","right","column"],q=()=>[Ny,pn];return{cacheSize:500,separator:":",theme:{colors:[hb],spacing:[Su,Qd],blur:["none","",Jd,pn],brightness:q(),borderColor:[t],borderRadius:["n
126one","","full",Jd,pn],borderSpacing:I(),borderWidth:R(),contrast:q(),grayscale:D(),hueRotate:q(),invert:D(),gap:I(),gradientColorStops:[t],gradientColorStopPositions:[$Ae,Qd],inset:M(),margin:M(),opacity:q(),padding:I(),saturate:q(),scale:q(),sepia:D(),skew:q(),space:I(),translate:I()},classGroups:{aspect:[{aspect:["auto","square","video",pn]}],container:["container"],columns:[{columns:[Jd]}],"break-after":[{"break-after":F()}],"break-before":[{"break-before":F()}],"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:[...P(),pn]}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[x]}],"inset-x":[{"inset-x":[x]}],"inset-y":[{"inset-y":[x]}],start:[{start:[x]}],end:[{end:[x]}],top:[{top:[x]}],right:[{right:[x]}],bottom:[{bottom:[x]}],left:[{left:[x]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",fb,pn]}],basis:[{basis:M()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",pn]}],grow:[{grow:D()}],shrink:[{shrink:D()}],order:[{order:["first","last","none",fb,pn]}],"grid-cols":[{"grid-cols":[hb]}],"col-start-end":[{col:["auto",{span:["full",fb,pn]},pn]}],"col-start":[{"col-start":E()}],"col-end":[{"col-end":E()}],"grid-rows":[{"grid-rows":[hb]}],"row-start-end":[{row:["auto",{span:[fb,pn]},pn]}],"row-start":[{"row-start":E()}],"row-end":[{"row-end":E()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",pn]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",pn]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal",...T()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...T(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...T(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[w]}],px:[{px:[w]}],py:[{py:[w]}],ps:[{ps:[w]}],pe:[{pe:[w]}],pt:[{pt:[w]}],pr:[{pr:[w]}],pb:[{pb:[w]}],pl:[{pl:[w]}],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":[j]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[j]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",pn,e]}],"min-w":[{"min-w":[pn,e,"min","max","fit"]}],"max-w":[{"max-w":[pn,e,"none","full","min","max","fit","prose",{screen:[Jd]},Jd]}],h:[{h:[pn,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[pn,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[pn,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[pn,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Jd,Qd]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",dR]}],"font-family":[{font:[hb]}],"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",pn]}],"line-clamp":[{"line-clamp":["none",Ny,dR]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Su,pn]}],"list-image":[{"list-image":["none",pn]}],"list-style-type":[{list:["none","disc","decimal",pn]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[g]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[g]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...O(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Su,Qd]}],"underline-offset":[{"underline-offset":["auto",Su,pn]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",pn]}],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",pn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[g]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...P(),zAe]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",UAe]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},VAe]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[m]}
vendor: 5,181 bytes, line 126
126],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[g]}],"border-style":[{border:[...O(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[g]}],"divide-style":[{divide:O()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...O()]}],"outline-offset":[{"outline-offset":[Su,pn]}],"outline-w":[{outline:[Su,Qd]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:R()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[g]}],"ring-offset-w":[{"ring-offset":[Su,Qd]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Jd,HAe]}],"shadow-color":[{shadow:[hb]}],opacity:[{opacity:[g]}],"mix-blend":[{"mix-blend":[...L(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":L()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",Jd,pn]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[f]}],saturate:[{saturate:[v]}],sepia:[{sepia:[S]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[g]}],"backdrop-saturate":[{"backdrop-saturate":[v]}],"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",pn]}],duration:[{duration:q()}],ease:[{ease:["linear","in","out","in-out",pn]}],delay:[{delay:q()}],animate:[{animate:["none","spin","ping","pulse","bounce",pn]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[N]}],"scale-x":[{"scale-x":[N]}],"scale-y":[{"scale-y":[N]}],rotate:[{rotate:[fb,pn]}],"translate-x":[{"translate-x":[A]}],"translate-y":[{"translate-y":[A]}],"skew-x":[{"skew-x":[_]}],"skew-y":[{"skew-y":[_]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",pn]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",pn]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}
126],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",pn]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Su,Qd,dR]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},YAe=TAe(KAe);function ne(...t){return YAe(an(t))}function XAe(t){return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"}).format(new Date(t))}function QAe(t){const e=new Date,n=new Date(t),r=Math.floor((e.getTime()-n.getTime())/1e3);return r<60?"just now":r<3600?`${Math.floor(r/60)}m ago`:r<86400?`${Math.floor(r/3600)}h ago`:r<604800?`${Math.floor(r/86400)}d ago`:XAe(t)}function jse(t,e=100,n=0,r=!1){const i=e-n;if(i===0)return"var(--muted)";let s=(t-n)/i*100;return r&&(s=100-s),s>=80?"var(--primary)":s>=50?"var(--chart-3)":s>=25?"var(--chart-4)":"var(--foreground)"}function JAe(t,e=10){const n=Math.min(t,e);return jse(n,e,1,!0)}function ZAe(t){return jse(t,100,0,!1)}function eTe(t){if(!(!t||t==="null"||t==="undefined"))return t}function _S(t){const e=eTe(t),{data:n,isLoading:r}=En({queryKey:["content-status",e],queryFn:()=>Ce.get(`/companies/${e}/content-status`),enabled:!!e,staleTime:3e4,gcTime:6e4,refetchInterval:s=>{const a=s.state.data;return a!=null&&a.setup.hasPendingTasks||a!=null&&a.siteHealth.isAuditing||a!=null&&a.opportunities.isGenerating?3e3:!1}}),i=r&&!n;return{hasSiteHealthData:(n==null?void 0:n.siteHealth.hasAudits)??!1,hasSiteAuditData:(n==null?void 0:n.siteHealth.hasAudits)??!1,hasResearchData:(n==null?void 0:n.research.isResearchReady)??!1,hasOpportunitiesData:(n==null?void 0:n.opportunities.hasOpportunities)??!1,isSetupRunning:(n==null?void 0:n.setup.hasPendingTasks)||(n==null?void 0:n.siteHealth.isAuditing)||(n==null?void 0:n.opportunities.isGenerating)||!1,isInitialLoad:i,hasData:!!n}}const Cse=b.createContext(null),pb="settings",tTe=["profile","notifications","billing","integrations"];function nTe(t){return t!==null&&tTe.includes(t)}function rTe({children:t}){const[e,n]=N0(),[r,i]=b.useState(!1),[s,a]=b.useState("profile");b.useEffect(()=>{const d=e.get(pb);if(nTe(d))i(!0),a(d);else if(d!==null){const f=new URLSearchParams(e);f.delete(pb),n(f,{replace:!0})}},[e,n]);const l=b.useCallback((d="profile")=>{i(!0),a(d);const f=new URLSearchParams(e);f.set(pb,d),n(f,{replace:!0})},[e,n]),c=b.useCallback(()=>{i(!1);const d=new URLSearchParams(e);d.delete(pb),n(d,{replace:!0})},[e,n]),u=b.useCallback(d=>
vendor: 8,017 bytes, lines 126-231
126{if(a(d),r){const f=new URLSearchParams(e);f.set(pb,d),n(f,{replace:!0})}},[r,e,n]);return o.jsx(Cse.Provider,{value:{isOpen:r,activeTab:s,openSettings:l,closeSettings:c,setActiveTab:u},children:t})}function kse(){const t=b.useContext(Cse);if(!t)throw new Error("useAccountSettings must be used within an AccountSettingsProvider");return t}/**
127 * @license lucide-react v0.436.0 - ISC
128 *
129 * This source code is licensed under the ISC license.
130 * See the LICENSE file in the root directory of this source tree.
131 */const iTe=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Ese=(...t)=>t.filter((e,n,r)=>!!e&&r.indexOf(e)===n).join(" ");/**
132 * @license lucide-react v0.436.0 - ISC
133 *
134 * This source code is licensed under the ISC license.
135 * See the LICENSE file in the root directory of this source tree.
136 */var sTe={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"};/**
137 * @license lucide-react v0.436.0 - ISC
138 *
139 * This source code is licensed under the ISC license.
140 * See the LICENSE file in the root directory of this source tree.
141 */const aTe=b.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:a,...l},c)=>b.createElement("svg",{ref:c,...sTe,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:Ese("lucide",i),...l},[...a.map(([u,d])=>b.createElement(u,d)),...Array.isArray(s)?s:[s]]));/**
142 * @license lucide-react v0.436.0 - ISC
143 *
144 * This source code is licensed under the ISC license.
145 * See the LICENSE file in the root directory of this source tree.
146 */const Be=(t,e)=>{const n=b.forwardRef(({className:r,...i},s)=>b.createElement(aTe,{ref:s,iconNode:e,className:Ese(`lucide-${iTe(t)}`,r),...i}));return n.displayName=`${t}`,n};/**
147 * @license lucide-react v0.436.0 - ISC
148 *
149 * This source code is licensed under the ISC license.
150 * See the LICENSE file in the root directory of this source tree.
151 */const Zu=Be("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
152 * @license lucide-react v0.436.0 - ISC
153 *
154 * This source code is licensed under the ISC license.
155 * See the LICENSE file in the root directory of this source tree.
156 */const lH=Be("AlignLeft",[["line",{x1:"21",x2:"3",y1:"6",y2:"6",key:"1fp77t"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}],["line",{x1:"17",x2:"3",y1:"18",y2:"18",key:"1awlsn"}]]);/**
157 * @license lucide-react v0.436.0 - ISC
158 *
159 * This source code is licensed under the ISC license.
160 * See the LICENSE file in the root directory of this source tree.
161 */const bz=Be("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"}]]);/**
162 * @license lucide-react v0.436.0 - ISC
163 *
164 * This source code is licensed under the ISC license.
165 * See the LICENSE file in the root directory of this source tree.
166 */const Ase=Be("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/**
167 * @license lucide-react v0.436.0 - ISC
168 *
169 * This source code is licensed under the ISC license.
170 * See the LICENSE file in the root directory of this source tree.
171 */const Ii=Be("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
172 * @license lucide-react v0.436.0 - ISC
173 *
174 * This source code is licensed under the ISC license.
175 * See the LICENSE file in the root directory of this source tree.
176 */const Ai=Be("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
177 * @license lucide-react v0.436.0 - ISC
178 *
179 * This source code is licensed under the ISC license.
180 * See the LICENSE file in the root directory of this source tree.
181 */const oTe=Be("ArrowUpDown",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);/**
182 * @license lucide-react v0.436.0 - ISC
183 *
184 * This source code is licensed under the ISC license.
185 * See the LICENSE file in the root directory of this source tree.
186 */const lTe=Be("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/**
187 * @license lucide-react v0.436.0 - ISC
188 *
189 * This source code is licensed under the ISC license.
190 * See the LICENSE file in the root directory of this source tree.
191 */const Tse=Be("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
192 * @license lucide-react v0.436.0 - ISC
193 *
194 * This source code is licensed under the ISC license.
195 * See the LICENSE file in the root directory of this source tree.
196 */const cTe=Be("AtSign",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]]);/**
197 * @license lucide-react v0.436.0 - ISC
198 *
199 * This source code is licensed under the ISC license.
200 * See the LICENSE file in the root directory of this source tree.
201 */const cH=Be("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/**
202 * @license lucide-react v0.436.0 - ISC
203 *
204 * This source code is licensed under the ISC license.
205 * See the LICENSE file in the root directory of this source tree.
206 */const Mse=Be("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/**
207 * @license lucide-react v0.436.0 - ISC
208 *
209 * This source code is licensed under the ISC license.
210 * See the LICENSE file in the root directory of this source tree.
211 */const Pse=Be("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"}]]);/**
212 * @license lucide-react v0.436.0 - ISC
213 *
214 * This source code is licensed under the ISC license.
215 * See the LICENSE file in the root directory of this source tree.
216 */const uTe=Be("BookOpen",[["path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z",key:"vv98re"}],["path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z",key:"1cyq3y"}]]);/**
217 * @license lucide-react v0.436.0 - ISC
218 *
219 * This source code is licensed under the ISC license.
220 * See the LICENSE file in the root directory of this source tree.
221 */const ga=Be("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/**
222 * @license lucide-react v0.436.0 - ISC
223 *
224 * This source code is licensed under the ISC license.
225 * See the LICENSE file in the root directory of this source tree.
226 */const dTe=Be("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"}]]);/**
227 * @license lucide-react v0.436.0 - ISC
228 *
229 * This source code is licensed under the ISC license.
230 * See the LICENSE file in the root directory of this source tree.
231 */const lv=Be("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}
231],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/**
232 * @license lucide-react v0.436.0 - ISC
233 *
234 * This source code is licensed under the ISC license.
235 * See the LICENSE file in the root directory of this source tree.
236 */const vT=Be("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"}]]);/**
237 * @license lucide-react v0.436.0 - ISC
238 *
239 * This source code is licensed under the ISC license.
240 * See the LICENSE file in the root directory of this source tree.
241 */const wz=Be("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/**
242 * @license lucide-react v0.436.0 - ISC
243 *
244 * This source code is licensed under the ISC license.
245 * See the LICENSE file in the root directory of this source tree.
246 */const fTe=Be("ChartLine",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]]);/**
247 * @license lucide-react v0.436.0 - ISC
248 *
249 * This source code is licensed under the ISC license.
250 * See the LICENSE file in the root directory of this source tree.
251 */const Ose=Be("ChartPie",[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",key:"pzmjnu"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}]]);/**
252 * @license lucide-react v0.436.0 - ISC
253 *
254 * This source code is licensed under the ISC license.
255 * See the LICENSE file in the root directory of this source tree.
256 */const Sn=Be("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
257 * @license lucide-react v0.436.0 - ISC
258 *
259 * This source code is licensed under the ISC license.
260 * See the LICENSE file in the root directory of this source tree.
261 */const ms=Be("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
262 * @license lucide-react v0.436.0 - ISC
263 *
264 * This source code is licensed under the ISC license.
265 * See the LICENSE file in the root directory of this source tree.
266 */const wd=Be("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
267 * @license lucide-react v0.436.0 - ISC
268 *
269 * This source code is licensed under the ISC license.
270 * See the LICENSE file in the root directory of this source tree.
271 */const Ga=Be("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
272 * @license lucide-react v0.436.0 - ISC
273 *
274 * This source code is licensed under the ISC license.
275 * See the LICENSE file in the root directory of this source tree.
276 */const Kc=Be("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
277 * @license lucide-react v0.436.0 - ISC
278 *
279 * This source code is licensed under the ISC license.
280 * See the LICENSE file in the root directory of this source tree.
281 */const bg=Be("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/**
282 * @license lucide-react v0.436.0 - ISC
283 *
284 * This source code is licensed under the ISC license.
285 * See the LICENSE file in the root directory of this source tree.
286 */const _z=Be("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"}]]);/**
287 * @license lucide-react v0.436.0 - ISC
288 *
289 * This source code is licensed under the ISC license.
290 * See the LICENSE file in the root directory of this source tree.
291 */const bT=Be("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
292 * @license lucide-react v0.436.0 - ISC
293 *
294 * This source code is licensed under the ISC license.
295 * See the LICENSE file in the root directory of this source tree.
296 */const wg=Be("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
297 * @license lucide-react v0.436.0 - ISC
298 *
299 * This source code is licensed under the ISC license.
300 * See the LICENSE file in the root directory of this source tree.
301 */const hTe=Be("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"}]]);/**
302 * @license lucide-react v0.436.0 - ISC
303 *
304 * This source code is licensed under the ISC license.
305 * See the LICENSE file in the root directory of this source tree.
306 */const Rse=Be("CircleUser",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]]);/**
307 * @license lucide-react v0.436.0 - ISC
308 *
309 * This source code is licensed under the ISC license.
310 * See the LICENSE file in the root directory of this source tree.
311 */const Sz=Be("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
312 * @license lucide-react v0.436.0 - ISC
313 *
314 * This source code is licensed under the ISC license.
315 * See the LICENSE file in the root directory of this source tree.
316 */const pTe=Be("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/**
317 * @license lucide-react v0.436.0 - ISC
318 *
319 * This source code is licensed under the ISC license.
320 * See the LICENSE file in the root directory of this source tree.
321 */const SS=Be("Coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]]);/**
322 * @license lucide-react v0.436.0 - ISC
323 *
324 * This source code is licensed under the ISC license.
325 * See the LICENSE file in the root directory of this source tree.
326 */const Nz=Be("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"}]]);/**
327 * @license lucide-react v0.436.0 - ISC
328 *
329 * This source code is licensed under the ISC license.
330 * See the LICENSE file in the root directory of this source tree.
331 */const jz=Be("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/**
332 * @license lucide-react v0.436.0 - ISC
333 *
334 * This source code is licensed under the ISC license.
335 * See the LICENSE file in the root directory of this source tree.
336 */const Ise=Be("CreditCard",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]);/**
337 * @license lucide-react v0.436.0 - ISC
338 *
339 * This source code is licensed under the ISC license.
340 * See the LICENSE file in the root directory of this source tree.
341 */const mTe=Be("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"}]]);/**
342 * @license lucide-react v0.436.0 - ISC
343 *
344 * This source code is licensed under the ISC license.
345 * See the LICENSE file in the root directory of this source tree.
346 */const gTe=Be("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);/**
347 * @license lucide-react v0.436.0 - ISC
348 *
349 * This source code is licensed under the ISC license.
350 * See the LICENSE file in the root directory of this source tree.
351 */const ru=Be("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"}]]);/**
352 * @license lucide-react v0.436.0 - ISC
353 *
354 * This source code is licensed under the ISC license.
355 * See the LICENSE file in the root directory of this source tree.
356 */const Wr=Be("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"}]]);/**
357 * @license lucide-react v0.436.0 - ISC
358 *
359 * This source code is licensed under the ISC license.
360 * See the LICENSE file in the root directory of this source tree.
361 */const Dse=Be("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"}]]);/**
362 * @license lucide-react v0.436.0 - ISC
363 *
364 * This source code is licensed under the ISC license.
365 * See the LICENSE file in the root directory of this source tree.
366 */const Eh=Be("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"}]]);/**
367 * @license lucide-react v0.436.0 - ISC
368 *
369 * This source code is licensed under the ISC license.
370 * See the LICENSE file in the root directory of this source tree.
371 */const Ao=Be("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"}]]);/**
372 * @license lucide-react v0.436.0 - ISC
373 *
374 * This source code is licensed under the ISC license.
375 * See the LICENSE file in the root directory of this source tree.
376 */const xTe=Be("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]]);/**
377 * @license lucide-react v0.436.0 - ISC
378 *
379 * This source code is licensed under the ISC license.
380 * See the LICENSE file in the root directory of this source tree.
381 */const To=Be("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"}]]);/**
382 * @license lucide-react v0.436.0 - ISC
383 *
384 * This source code is licensed under the ISC license.
385 * See the LICENSE file in the root directory of this source tree.
386 */const Lse=Be("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}
386]]);/**
387 * @license lucide-react v0.436.0 - ISC
388 *
389 * This source code is licensed under the ISC license.
390 * See the LICENSE file in the root directory of this source tree.
391 */const $se=Be("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"}]]);/**
392 * @license lucide-react v0.436.0 - ISC
393 *
394 * This source code is licensed under the ISC license.
395 * See the LICENSE file in the root directory of this source tree.
396 */const Fse=Be("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"}]]);/**
397 * @license lucide-react v0.436.0 - ISC
398 *
399 * This source code is licensed under the ISC license.
400 * See the LICENSE file in the root directory of this source tree.
401 */const Use=Be("Heading3",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]]);/**
402 * @license lucide-react v0.436.0 - ISC
403 *
404 * This source code is licensed under the ISC license.
405 * See the LICENSE file in the root directory of this source tree.
406 */const yTe=Be("Heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]);/**
407 * @license lucide-react v0.436.0 - ISC
408 *
409 * This source code is licensed under the ISC license.
410 * See the LICENSE file in the root directory of this source tree.
411 */const vTe=Be("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"}]]);/**
412 * @license lucide-react v0.436.0 - ISC
413 *
414 * This source code is licensed under the ISC license.
415 * See the LICENSE file in the root directory of this source tree.
416 */const NS=Be("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"}]]);/**
417 * @license lucide-react v0.436.0 - ISC
418 *
419 * This source code is licensed under the ISC license.
420 * See the LICENSE file in the root directory of this source tree.
421 */const xr=Be("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
422 * @license lucide-react v0.436.0 - ISC
423 *
424 * This source code is licensed under the ISC license.
425 * See the LICENSE file in the root directory of this source tree.
426 */const zse=Be("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"}]]);/**
427 * @license lucide-react v0.436.0 - ISC
428 *
429 * This source code is licensed under the ISC license.
430 * See the LICENSE file in the root directory of this source tree.
431 */const Bse=Be("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/**
432 * @license lucide-react v0.436.0 - ISC
433 *
434 * This source code is licensed under the ISC license.
435 * See the LICENSE file in the root directory of this source tree.
436 */const bTe=Be("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/**
437 * @license lucide-react v0.436.0 - ISC
438 *
439 * This source code is licensed under the ISC license.
440 * See the LICENSE file in the root directory of this source tree.
441 */const Cz=Be("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/**
442 * @license lucide-react v0.436.0 - ISC
443 *
444 * This source code is licensed under the ISC license.
445 * See the LICENSE file in the root directory of this source tree.
446 */const iu=Be("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"}]]);/**
447 * @license lucide-react v0.436.0 - ISC
448 *
449 * This source code is licensed under the ISC license.
450 * See the LICENSE file in the root directory of this source tree.
451 */const Vse=Be("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"}]]);/**
452 * @license lucide-react v0.436.0 - ISC
453 *
454 * This source code is licensed under the ISC license.
455 * See the LICENSE file in the root directory of this source tree.
456 */const wTe=Be("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
457 * @license lucide-react v0.436.0 - ISC
458 *
459 * This source code is licensed under the ISC license.
460 * See the LICENSE file in the root directory of this source tree.
461 */const Hse=Be("ListOrdered",[["line",{x1:"10",x2:"21",y1:"6",y2:"6",key:"76qw6h"}],["line",{x1:"10",x2:"21",y1:"12",y2:"12",key:"16nom4"}],["line",{x1:"10",x2:"21",y1:"18",y2:"18",key:"u3jurt"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/**
462 * @license lucide-react v0.436.0 - ISC
463 *
464 * This source code is licensed under the ISC license.
465 * See the LICENSE file in the root directory of this source tree.
466 */const Wse=Be("List",[["line",{x1:"8",x2:"21",y1:"6",y2:"6",key:"7ey8pc"}],["line",{x1:"8",x2:"21",y1:"12",y2:"12",key:"rjfblc"}],["line",{x1:"8",x2:"21",y1:"18",y2:"18",key:"c3b1m8"}],["line",{x1:"3",x2:"3.01",y1:"6",y2:"6",key:"1g7gq3"}],["line",{x1:"3",x2:"3.01",y1:"12",y2:"12",key:"1pjlvk"}],["line",{x1:"3",x2:"3.01",y1:"18",y2:"18",key:"28t2mc"}]]);/**
467 * @license lucide-react v0.436.0 - ISC
468 *
469 * This source code is licensed under the ISC license.
470 * See the LICENSE file in the root directory of this source tree.
471 */const Me=Be("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
472 * @license lucide-react v0.436.0 - ISC
473 *
474 * This source code is licensed under the ISC license.
475 * See the LICENSE file in the root directory of this source tree.
476 */const Zk=Be("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"}]]);/**
477 * @license lucide-react v0.436.0 - ISC
478 *
479 * This source code is licensed under the ISC license.
480 * See the LICENSE file in the root directory of this source tree.
481 */const _Te=Be("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/**
482 * @license lucide-react v0.436.0 - ISC
483 *
484 * This source code is licensed under the ISC license.
485 * See the LICENSE file in the root directory of this source tree.
486 */const Gse=Be("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"}]]);/**
487 * @license lucide-react v0.436.0 - ISC
488 *
489 * This source code is licensed under the ISC license.
490 * See the LICENSE file in the root directory of this source tree.
491 */const uH=Be("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"}]]);/**
492 * @license lucide-react v0.436.0 - ISC
493 *
494 * This source code is licensed under the ISC license.
495 * See the LICENSE file in the root directory of this source tree.
496 */const dH=Be("MapPin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/**
497 * @license lucide-react v0.436.0 - ISC
498 *
499 * This source code is licensed under the ISC license.
500 * See the LICENSE file in the root directory of this source tree.
501 */const STe=Be("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"}]]);/**
502 * @license lucide-react v0.436.0 - ISC
503 *
504 * This source code is licensed under the ISC license.
505 * See the LICENSE file in the root directory of this source tree.
506 */const NTe=Be("Megaphone",[["path",{d:"m3 11 18-5v12L3 14v-3z",key:"n962bs"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}]]);/**
507 * @license lucide-react v0.436.0 - ISC
508 *
509 * This source code is licensed under the ISC license.
510 * See the LICENSE file in the root directory of this source tree.
511 */const jTe=Be("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"}]]);/**
512 * @license lucide-react v0.436.0 - ISC
513 *
514 * This source code is licensed under the ISC license.
515 * See the LICENSE file in the root directory of this source tree.
516 */const fw=Be("Merge",[["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}],["path",{d:"M12 2v10.3a4 4 0 0 1-1.172 2.872L4 22",key:"1hyw0i"}],["path",{d:"m20 22-5-5",key:"1m27yz"}]]);/**
517 * @license lucide-react v0.436.0 - ISC
518 *
519 * This source code is licensed under the ISC license.
520 * See the LICENSE file in the root directory of this source tree.
521 */const Mo=Be("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"}]]);/**
522 * @license lucide-react v0.436.0 - ISC
523 *
524 * This source code is licensed under the ISC license.
525 * See the LICENSE file in the root directory of this source tree.
526 */const kz=Be("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
527 * @license lucide-react v0.436.0 - ISC
528 *
529 * This source code is licensed under the ISC license.
530 * See the LICENSE file in the root directory of this source tree.
531 */const qse=Be("Package",[["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/**
532 * @license lucide-react v0.436.0 - ISC
533 *
534 * This source code is licensed under the ISC license.
535 * See the LICENSE file in the root directory of this source tree.
536 */const CTe=Be("PanelRightClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]]);/**
537 * @license lucide-react v0.436.0 - ISC
538 *
539 * This source code is licensed under the ISC license.
540 * See the LICENSE file in the root directory of this source tree.
541 */const kTe=Be("PanelRightOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]]);/**
542 * @license lucide-react v0.436.0 - ISC
543 *
544 * This source code is licensed under the ISC license.
545 * See the LICENSE file in the root directory of this source tree.
546 */const Kse=Be("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);/**
547 * @license lucide-react v0.436.0 - ISC
548 *
549 * This source code is licensed under the ISC license.
550 * See the LICENSE file in the root directory of this source tree.
551 */const cv=Be("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"}]]);/**
552 * @license lucide-react v0.436.0 - ISC
553 *
554 * This source code is licensed under the ISC license.
555 * See the LICENSE file in the root directory of this source tree.
556 */const H1=Be("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
557 * @license lucide-react v0.436.0 - ISC
558 *
559 * This source code is licensed under the ISC license.
560 * See the LICENSE file in the root directory of this source tree.
561 */const yi=Be("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
562 * @license lucide-react v0.436.0 - ISC
563 *
564 * This source code is licensed under the ISC license.
565 * See the LICENSE file in the root directory of this source tree.
566 */const ETe=Be("Puzzle",[["path",{d:"M19.439 7.85c-.049.322.059.648.289.878l1.568 1.568c.47.47.706 1.087.706 1.704s-.235 1.233-.706 1.704l-1.611 1.611a.98.98 0 0 1-.837.276c-.47-.07-.802-.48-.968-.925a2.501 2.501 0 1 0-3.214 3.214c.446.166.855.497.925.968a.979.979 0 0 1-.276.837l-1.61 1.61a2.404 2.404 0 0 1-1.705.707 2.402 2.402 0 0 1-1.704-.706l-1.568-1.568a1.026 1.026 0 0 0-.877-.29c-.493.074-.84.504-1.02.968a2.5 2.5 0 1 1-3.237-3.237c.464-.18.894-.527.967-1.02a1.026 1.026 0 0 0-.289-.877l-1.568-1.568A2.402 2.402 0 0 1 1.998 12c0-.617.236-1.234.706-1.704L4.23 8.77c.24-.24.581-.353.917-.303.515.077.877.528 1.073 1.01a2.5 2.5 0 1 0 3.259-3.259c-.482-.196-.933-.558-1.01-1.073-.05-.336.062-.676.303-.917l1.525-1.525A2.402 2.402 0 0 1 12 1.998c.617 0 1.234.236 1.704.706l1.568 1.568c.23.23.556.338.877.29.493-.074.84-.504 1.02-.968a2.5 2.5 0 1 1 3.237 3.237c-.464.18-.894.527-.967 1.02Z",key:"i0oyt7"}]]);/**
567 * @license lucide-react v0.436.0 - ISC
568 *
569 * This source code is licensed under the ISC license.
570 * See the LICENSE file in the root directory of this source tree.
571 */const ATe=Be("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"}]]);/**
572 * @license lucide-react v0.436.0 - ISC
573 *
574 * This source code is licensed under the ISC license.
575 * See the LICENSE file in the root directory of this source tree.
576 */const TTe=Be("Redo2",[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]]);/**
577 * @license lucide-react v0.436.0 - ISC
578 *
579 * This source code is licensed under the ISC license.
580 * See the LICENSE file in the root directory of this source tree.
581 */const MTe=Be("RefreshCcw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]]);/**
582 * @license lucide-react v0.436.0 - ISC
583 *
584 * This source code is licensed under the ISC license.
585 * See the LICENSE file in the root directory of this source tree.
586 */const ws=Be("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"}]]);/**
587 * @license lucide-react v0.436.0 - ISC
588 *
589 * This source code is licensed under the ISC license.
590 * See the LICENSE file in the root directory of this source tree.
591 */const PTe=Be("RemoveFormatting",[["path",{d:"M4 7V4h16v3",key:"9msm58"}],["path",{d:"M5 20h6",key:"1h6pxn"}],["path",{d:"M13 4 8 20",key:"kqq6aj"}],["path",{d:"m15 15 5 5",key:"me55sn"}],["path",{d:"m20 15-5 5",key:"11p7ol"}]]);/**
592 * @license lucide-react v0.436.0 - ISC
593 *
594 * This source code is licensed under the ISC license.
595 * See the LICENSE file in the root directory of this source tree.
596 */const OTe=Be("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);/**
597 * @license lucide-react v0.436.0 - ISC
598 *
599 * This source code is licensed under the ISC license.
600 * See the LICENSE file in the root directory of this source tree.
601 */const W1=Be("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"}]]);/**
602 * @license lucide-react v0.436.0 - ISC
603 *
604 * This source code is licensed under the ISC license.
605 * See the LICENSE file in the root directory of this source tree.
606 */const Xa=Be("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
607 * @license lucide-react v0.436.0 - ISC
608 *
609 * This source code is licensed under the ISC license.
610 * See the LICENSE file in the root directory of this source tree.
611 */const RTe=Be("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]);/**
612 * @license lucide-react v0.436.0 - ISC
613 *
614 * This source code is licensed under the ISC license.
615 * See the LICENSE file in the root directory of this source tree.
616 */const wT=Be("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"}]]);/**
617 * @license lucide-react v0.436.0 - ISC
618 *
619 * This source code is licensed under the ISC license.
620 * See the LICENSE file in the root directory of this source tree.
621 */const G4=Be("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
621y:"oel41y"}]]);/**
622 * @license lucide-react v0.436.0 - ISC
623 *
624 * This source code is licensed under the ISC license.
625 * See the LICENSE file in the root directory of this source tree.
626 */const q4=Be("Shuffle",[["path",{d:"M2 18h1.4c1.3 0 2.5-.6 3.3-1.7l6.1-8.6c.7-1.1 2-1.7 3.3-1.7H22",key:"1wmou1"}],["path",{d:"m18 2 4 4-4 4",key:"pucp1d"}],["path",{d:"M2 6h1.9c1.5 0 2.9.9 3.6 2.2",key:"10bdb2"}],["path",{d:"M22 18h-5.9c-1.3 0-2.6-.7-3.3-1.8l-.5-.8",key:"vgxac0"}],["path",{d:"m18 14 4 4-4 4",key:"10pe0f"}]]);/**
627 * @license lucide-react v0.436.0 - ISC
628 *
629 * This source code is licensed under the ISC license.
630 * See the LICENSE file in the root directory of this source tree.
631 */const ITe=Be("Smile",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/**
632 * @license lucide-react v0.436.0 - ISC
633 *
634 * This source code is licensed under the ISC license.
635 * See the LICENSE file in the root directory of this source tree.
636 */const pr=Be("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"}]]);/**
637 * @license lucide-react v0.436.0 - ISC
638 *
639 * This source code is licensed under the ISC license.
640 * See the LICENSE file in the root directory of this source tree.
641 */const wm=Be("Star",[["polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2",key:"8f66p6"}]]);/**
642 * @license lucide-react v0.436.0 - ISC
643 *
644 * This source code is licensed under the ISC license.
645 * See the LICENSE file in the root directory of this source tree.
646 */const Yse=Be("Strikethrough",[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]);/**
647 * @license lucide-react v0.436.0 - ISC
648 *
649 * This source code is licensed under the ISC license.
650 * See the LICENSE file in the root directory of this source tree.
651 */const Ez=Be("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"}]]);/**
652 * @license lucide-react v0.436.0 - ISC
653 *
654 * This source code is licensed under the ISC license.
655 * See the LICENSE file in the root directory of this source tree.
656 */const DTe=Be("ToggleLeft",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"6",ry:"6",key:"f2vt7d"}],["circle",{cx:"8",cy:"12",r:"2",key:"1nvbw3"}]]);/**
657 * @license lucide-react v0.436.0 - ISC
658 *
659 * This source code is licensed under the ISC license.
660 * See the LICENSE file in the root directory of this source tree.
661 */const Yi=Be("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
662 * @license lucide-react v0.436.0 - ISC
663 *
664 * This source code is licensed under the ISC license.
665 * See the LICENSE file in the root directory of this source tree.
666 */const Xse=Be("TrendingDown",[["polyline",{points:"22 17 13.5 8.5 8.5 13.5 2 7",key:"1r2t7k"}],["polyline",{points:"16 17 22 17 22 11",key:"11uiuu"}]]);/**
667 * @license lucide-react v0.436.0 - ISC
668 *
669 * This source code is licensed under the ISC license.
670 * See the LICENSE file in the root directory of this source tree.
671 */const Ud=Be("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/**
672 * @license lucide-react v0.436.0 - ISC
673 *
674 * This source code is licensed under the ISC license.
675 * See the LICENSE file in the root directory of this source tree.
676 */const ll=Be("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"}]]);/**
677 * @license lucide-react v0.436.0 - ISC
678 *
679 * This source code is licensed under the ISC license.
680 * See the LICENSE file in the root directory of this source tree.
681 */const LTe=Be("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"}]]);/**
682 * @license lucide-react v0.436.0 - ISC
683 *
684 * This source code is licensed under the ISC license.
685 * See the LICENSE file in the root directory of this source tree.
686 */const $Te=Be("Underline",[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",ke
vendor: 23,840 bytes, lines 686-726
686y:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]]);/**
687 * @license lucide-react v0.436.0 - ISC
688 *
689 * This source code is licensed under the ISC license.
690 * See the LICENSE file in the root directory of this source tree.
691 */const FTe=Be("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);/**
692 * @license lucide-react v0.436.0 - ISC
693 *
694 * This source code is licensed under the ISC license.
695 * See the LICENSE file in the root directory of this source tree.
696 */const G1=Be("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"}]]);/**
697 * @license lucide-react v0.436.0 - ISC
698 *
699 * This source code is licensed under the ISC license.
700 * See the LICENSE file in the root directory of this source tree.
701 */const UTe=Be("UserPlus",[["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"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/**
702 * @license lucide-react v0.436.0 - ISC
703 *
704 * This source code is licensed under the ISC license.
705 * See the LICENSE file in the root directory of this source tree.
706 */const Az=Be("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"}]]);/**
707 * @license lucide-react v0.436.0 - ISC
708 *
709 * This source code is licensed under the ISC license.
710 * See the LICENSE file in the root directory of this source tree.
711 */const uc=Be("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"}]]);/**
712 * @license lucide-react v0.436.0 - ISC
713 *
714 * This source code is licensed under the ISC license.
715 * See the LICENSE file in the root directory of this source tree.
716 */const _T=Be("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/**
717 * @license lucide-react v0.436.0 - ISC
718 *
719 * This source code is licensed under the ISC license.
720 * See the LICENSE file in the root directory of this source tree.
721 */const mr=Be("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
722 * @license lucide-react v0.436.0 - ISC
723 *
724 * This source code is licensed under the ISC license.
725 * See the LICENSE file in the root directory of this source tree.
726 */const bo=Be("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"}]]);function at(t,e,{checkForDefaultPrevented:n=!0}={}){return function(i){if(t==null||t(i),n===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function fH(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Ir(...t){return e=>{let n=!1;const r=t.map(i=>{const s=fH(i,e);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let i=0;i<r.length;i++){const s=r[i];typeof s=="function"?s():fH(t[i],null)}}}}function Pn(...t){return b.useCallback(Ir(...t),t)}function zTe(t,e){const n=b.createContext(e),r=s=>{const{children:a,...l}=s,c=b.useMemo(()=>l,Object.values(l));return o.jsx(n.Provider,{value:c,children:a})};r.displayName=t+"Provider";function i(s){const a=b.useContext(n);if(a)return a;if(e!==void 0)return e;throw new Error(`\`${s}\` must be used within \`${t}\``)}return[r,i]}function BTe(t,e=[]){let n=[];function r(s,a){const l=b.createContext(a),c=n.length;n=[...n,a];const u=f=>{var g;const{scope:h,children:p,...m}=f,x=((g=h==null?void 0:h[t])==null?void 0:g[c])||l,y=b.useMemo(()=>m,Object.values(m));return o.jsx(x.Provider,{value:y,children:p})};u.displayName=s+"Provider";function d(f,h){var x;const p=((x=h==null?void 0:h[t])==null?void 0:x[c])||l,m=b.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[u,d]}const i=()=>{const s=n.map(a=>b.createContext(a));return function(l){const c=(l==null?void 0:l[t])||s;return b.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return i.scopeName=t,[r,VTe(i,...e)]}function VTe(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const a=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...l,...f}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return n.scopeName=e.scopeName,n}var ts=globalThis!=null&&globalThis.document?b.useLayoutEffect:()=>{},HTe=YA[" useId ".trim().toString()]||(()=>{}),WTe=0;function ys(t){const[e,n]=b.useState(HTe());return ts(()=>{n(r=>r??String(WTe++))},[t]),e?`radix-${e}`:""}var GTe=YA[" useInsertionEffect ".trim().toString()]||ts;function su({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[i,s,a]=qTe({defaultProp:e,onChange:n}),l=t!==void 0,c=l?t:i;{const d=b.useRef(t!==void 0);b.useEffect(()=>{const f=d.current;f!==l&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=l},[l,r])}const u=b.useCallback(d=>{var f;if(l){const h=KTe(d)?d(t):d;h!==t&&((f=a.current)==null||f.call(a,h))}else s(d)},[l,t,s,a]);return[c,u]}function qTe({defaultProp:t,onChange:e}){const[n,r]=b.useState(t),i=b.useRef(n),s=b.useRef(e);return GTe(()=>{s.current=e},[e]),b.useEffect(()=>{var a;i.current!==n&&((a=s.current)==null||a.call(s,n),i.current=n)},[n,i]),[n,r,s]}function KTe(t){return typeof t=="function"}function YTe(t){const e=XTe(t),n=b.forwardRef((r,i)=>{const{children:s,...a}=r,l=b.Children.toArray(s),c=l.find(JTe);if(c){const u=c.props.children,d=l.map(f=>f===c?b.Children.count(u)>1?b.Children.only(null):b.isValidElement(u)?u.props.children:null:f);return o.jsx(e,{...a,ref:i,children:b.isValidElement(u)?b.cloneElement(u,void 0,d):null})}return o.jsx(e,{...a,ref:i,children:s})});return n.displayName=`${t}.Slot`,n}function XTe(t){const e=b.forwardRef((n,r)=>{const{children:i,...s}=n;if(b.isValidElement(i)){const a=eMe(i),l=ZTe(s,i.props);return i.type!==b.Fragment&&(l.ref=r?Ir(r,a):a),b.cloneElement(i,l)}return b.Children.count(i)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var QTe=Symbol("radix.slottable");function JTe(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===QTe}function ZTe(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...l)=>{const c=s(...l);return i(...l),c}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function eMe(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var tMe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Qse=tMe.reduce((t,e)=>{const n=YTe(`Primitive.${e}`),r=b.forwardRef((i,s)=>{const{asChild:a,...l}=i,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function nMe(t,e){t&&wl.flushSync(()=>t.dispatchEvent(e))}function dc(t){const e=b.useRef(t);return b.useEffect(()=>{e.current=t}),b.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function rMe(t,e=globalThis==null?void 0:globalThis.document){const n=dc(t);b.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var iMe="DismissableLayer",K4="dismissableLayer.update",sMe="dismissableLayer.pointerDownOutside",aMe="dismissableLayer.focusOutside",hH,Jse=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),_g=b.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:a,onDismiss:l,...c}=t,u=b.useContext(Jse),[d,f]=b.useState(null),h=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=b.useState({}),m=Pn(e,j=>f(j)),x=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),g=x.indexOf(y),w=d?x.indexOf(d):-1,v=u.layersWithOutsidePointerEventsDisabled.size>0,N=w>=g,S=cMe(j=>{const A=j.target,C=[...u.branches].some(k=>k.contains(A));!N||C||(i==null||i(j),a==null||a(j),j.defaultPrevented||l==null||l())},h),_=uMe(j=>{const A=j.target;[...u.branches].some(k=>k.contains(A))||(s==null||s(j),a==null||a(j),j.defaultPrevented||l==null||l())},h);return rMe(j=>{w===u.layers.size-1&&(r==null||r(j),!j.defaultPrevented&&l&&(j.preventDefault(),l()))},h),b.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(hH=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),pH(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=hH)}},[d,h,n,u]),b.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),pH())},[d,u]),b.useEffect(()=>{const j=()=>p({});return document.addEventListener(K4,j),()=>document.removeEventListener(K4,j)},[]),o.jsx(Qse.div,{...c,ref:m,style:{pointerEvents:v?N?"auto":"none":void 0,...t.style},onFocusCapture:at(t.onFocusCapture,_.onFocusCapture),onBlurCapture:at(t.onBlurCapture,_.onBlurCapture),onPointerDownCapture:at(t.onPointerDownCapture,S.onPointerDownCapture)})});_g.displayName=iMe;var oMe="DismissableLayerBranch",lMe=b.forwardRef((t,e)=>{const n=b.useContext(Jse),r=b.useRef(null),i=Pn(e,r);return b.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),o.jsx(Qse.div,{...t,ref:i})});lMe.displayName=oMe;function cMe(t,e=globalThis==null?void 0:globalThis.document){const n=dc(t),r=b.useRef(!1),i=b.useRef(()=>{});return b.useEffect(()=>{const s=l=>{if(l.target&&!r.current){let c=function(){Zse(sMe,n,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=c,e.addEventListener("click",i.current,{once:!0})):c()}else e.removeEventListener("click",i.current);r.current=!1},a=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(a),e.removeEventListener("pointerdown",s),e.removeEventListener("click",i.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function uMe(t,e=globalThis==null?void 0:globalThis.document){const n=dc(t),r=b.useRef(!1);return b.useEffect(()=>{const i=s=>{s.target&&!r.current&&Zse(aMe,n,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function pH(){const t=new CustomEvent(K4);document.dispatchEvent(t)}function Zse(t,e,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),r?nMe(i,s):i.dispatchEvent(s)}function dMe(t){const e=fMe(t),n=b.forwardRef((r,i)=>{const{children:s,...a}=r,l=b.Children.toArray(s),c=l.find(pMe);if(c){const u=c.props.children,d=l.map(f=>f===c?b.Children.count(u)>1?b.Children.only(null):b.isValidElement(u)?u.props.children:null:f);return o.jsx(e,{...a,ref:i,children:b.isValidElement(u)?b.cloneElement(u,void 0,d):null})}return o.jsx(e,{...a,ref:i,children:s})});return n.displayName=`${t}.Slot`,n}function fMe(t){const e=b.forwardRef((n,r)=>{const{children:i,...s}=n;if(b.isValidElement(i)){const a=gMe(i),l=mMe(s,i.props);return i.type!==b.Fragment&&(l.ref=r?Ir(r,a):a),b.cloneElement(i,l)}return b.Children.count(i)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var hMe=Symbol("radix.slottable");function pMe(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===hMe}function mMe(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...l)=>{const c=s(...l);return i(...l),c}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function gMe(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var xMe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],yMe=xMe.reduce((t,e)=>{const n=dMe(`Primitive.${e}`),r=b.forwardRef((i,s)=>{const{asChild:a,...l}=i,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),fR="focusScope.autoFocusOnMount",hR="focusScope.autoFocusOnUnmount",mH={bubbles:!1,cancelable:!0},vMe="FocusScope",jS=b.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...a}=t,[l,c]=b.useState(null),u=dc(i),d=dc(s),f=b.useRef(null),h=Pn(e,x=>c(x)),p=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(r){let x=function(v){if(p.paused||!l)return;const N=v.target;l.contains(N)?f.current=N:pf(f.current,{select:!0})},y=function(v){if(p.paused||!l)return;const N=v.relatedTarget;N!==null&&(l.contains(N)||pf(f.current,{select:!0}))},g=function(v){if(document.activeElement===document.body)for(const S of v)S.removedNodes.length>0&&pf(l)};document.addEventListener("focusin",x),document.addEventListener("focusout",y);const w=new MutationObserver(g);return l&&w.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",x),document.removeEventListener("focusout",y),w.disconnect()}}},[r,l,p.paused]),b.useEffect(()=>{if(l){xH.add(p);const x=document.activeElement;if(!l.contains(x)){const g=new CustomEvent(fR,mH);l.addEventListener(fR,u),l.dispatchEvent(g),g.defaultPrevented||(bMe(jMe(eae(l)),{select:!0}),document.activeElement===x&&pf(l))}return()=>{l.removeEventListener(fR,u),setTimeout(()=>{const g=new CustomEvent(hR,mH);l.addEventListener(hR,d),l.dispatchEvent(g),g.defaultPrevented||pf(x??document.body,{select:!0}),l.removeEventListener(hR,d),xH.remove(p)},0)}}},[l,u,d,p]);const m=b.useCallback(x=>{if(!n&&!r||p.paused)return;const y=x.key==="Tab"&&!x.altKey&&!x.ctrlKey&&!x.metaKey,g=document.activeElement;if(y&&g){const w=x.currentTarget,[v,N]=wMe(w);v&&N?!x.shiftKey&&g===N?(x.preventDefault(),n&&pf(v,{select:!0})):x.shiftKey&&g===v&&(x.preventDefault(),n&&pf(N,{select:!0})):g===w&&x.preventDefault()}},[n,r,p.paused]);return o.jsx(yMe.div,{tabIndex:-1,...a,ref:h,onKeyDown:m})});jS.displayName=vMe;function bMe(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(pf(r,{select:e}),document.activeElement!==n)return}function wMe(t){const e=eae(t),n=gH(e,t),r=gH(e.reverse(),t);return[n,r]}function eae(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function gH(t,e){for(const n of t)if(!_Me(n,{upTo:e}))return n}function _Me(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function SMe(t){return t instanceof HTMLInputElement&&"select"in t}function pf(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&SMe(t)&&e&&t.select()}}var xH=NMe();function NMe(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=yH(t,e),t.unshift(e)},remove(e){var n;t=yH(t,e),(n=t[0])==null||n.resume()}}}function yH(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function jMe(t){return t.filter(e=>e.tagName!=="A")}function CMe(t){const e=kMe(t),n=b.forwardRef((r,i)=>{const{children:s,...a}=r,l=b.Children.toArray(s),c=l.find(AMe);if(c){const u=c.props.children,d=l.map(f=>f===c?b.Children.count(u)>1?b.Children.only(null):b.isValidElement(u)?u.props.children:null:f);return o.jsx(e,{...a,ref:i,children:b.isValidElement(u)?b.cloneElement(u,void 0,d):null})}return o.jsx(e,{...a,ref:i,children:s})});return n.displayName=`${t}.Slot`,n}function kMe(t){const e=b.forwardRef((n,r)=>{const{children:i,...s}=n;if(b.isValidElement(i)){const a=MMe(i),l=TMe(s,i.props);return i.type!==b.Fragment&&(l.ref=r?Ir(r,a):a),b.cloneElement(i,l)}return b.Children.count(i)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var EMe=Symbol("radix.slottable");function AMe(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===EMe}function TMe(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...l)=>{const c=s(...l);return i(...l),c}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function MMe(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var PMe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],OMe=PMe.reduce((t,e)=>{const n=CMe(`Primitive.${e}`),r=b.forwardRef((i,s)=>{const{asChild:a,...l}=i,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),RMe="Portal",Sg=b.forwardRef((t,e)=>{var l;const{container:n,...r}=t,[i,s]=b.useState(!1);ts(()=>s(!0),[]);const a=n||i&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return a?JU.createPortal(o.jsx(OMe.div,{...r,ref:e}),a):null});Sg.displayName=RMe;function IMe(t,e){return b.useReducer((n,r)=>e[n][r]??n,t)}var Na=t=>{const{present:e,children:n}=t,r=DMe(e),i=typeof n=="function"?n({present:r.isPresent}):b.Children.only(n),s=Pn(r.ref,LMe(i));return typeof n=="function"||r.isPresent?b.cloneElement(i,{ref:s}):null};Na.displayName="Presence";function DMe(t){const[e,n]=b.useState(),r=b.useRef(null),i=b.useRef(t),s=b.useRef("none"),a=t?"mounted":"unmounted",[l,c]=IMe(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{const u=QN(r.current);s.current=l==="mounted"?u:"none"},[l]),ts(()=>{const u=r.current,d=i.current;if(d!==t){const h=s.current,p=QN(u);t?c("MOUNT"):p==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&h!==p?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,c]),ts(()=>{if(e){let u;const d=e.ownerDocument.defaultView??window,f=p=>{const x=QN(r.current).includes(CSS.escape(p.animationName));if(p.target===e&&x&&(c("ANIMATION_END"),!i.current)){const y=e.style.animationFillMode;e.style.animationFillMode="forwards",u=d.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=y)})}},h=p=>{p.target===e&&(s.current=QN(r.current))};return e.addEventListener("animationstart",h),e.addEventListener("animationcancel",f),e.addEventListener("animationend",f),()=>{d.clearTimeout(u),e.removeEventListener("animationstart",h),e.removeEventListener("animationcancel",f),e.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[e,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:b.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function QN(t){return(t==null?void 0:t.animationName)||"none"}function LMe(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function tae(t){const e=$Me(t),n=b.forwardRef((r,i)=>{const{children:s,...a}=r,l=b.Children.toArray(s),c=l.find(UMe);if(c){const u=c.props.children,d=l.map(f=>f===c?b.Children.count(u)>1?b.Children.only(null):b.isValidElement(u)?u.props.children:null:f);return o.jsx(e,{...a,ref:i,children:b.isValidElement(u)?b.cloneElement(u,void 0,d):null})}return o.jsx(e,{...a,ref:i,children:s})});return n.displayName=`${t}.Slot`,n}function $Me(t){const e=b.forwardRef((n,r)=>{const{children:i,...s}=n;if(b.isValidElement(i)){const a=BMe(i),l=zMe(s,i.props);return i.type!==b.Fragment&&(l.ref=r?Ir(r,a):a),b.cloneElement(i,l)}return b.Children.count(i)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var FMe=Symbol("radix.slottable");function UMe(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===FMe}function zMe(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...l)=>{const c=s(...l);return i(...l),c}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function BMe(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var VMe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],CS=VMe.reduce((t,e)=>{const n=tae(`Primitive.${e}`),r=b.forwardRef((i,s)=>{const{asChild:a,...l}=i,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),pR=0;function ST(){b.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??vH()),document.body.insertAdjacentElement("beforeend",t[1]??vH()),pR++,()=>{pR===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),pR--}},[])}function vH(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var WC="right-scroll-bar-position",GC="width-before-scroll-bar",HMe="with-scroll-bars-hidden",WMe="--removed-body-scroll-bar-size";function mR(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function GMe(t,e){var n=b.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=e,n.facade}var qMe=typeof window<"u"?b.useLayoutEffect:b.useEffect,bH=new WeakMap;function KMe(t,e){var n=GMe(null,function(r){return t.forEach(function(i){return mR(i,r)})});return qMe(function(){var r=bH.get(n);if(r){var i=new Set(r),s=new Set(t),a=n.current;
vendor: 4,231 bytes, lines 726-741
726i.forEach(function(l){s.has(l)||mR(l,null)}),s.forEach(function(l){i.has(l)||mR(l,a)})}bH.set(n,t)},[t]),n}function YMe(t){return t}function XMe(t,e){e===void 0&&(e=YMe);var n=[],r=!1,i={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(s){var a=e(s,r);return n.push(a),function(){n=n.filter(function(l){return l!==a})}},assignSyncMedium:function(s){for(r=!0;n.length;){var a=n;n=[],a.forEach(s)}n={push:function(l){return s(l)},filter:function(){return n}}},assignMedium:function(s){r=!0;var a=[];if(n.length){var l=n;n=[],l.forEach(s),a=n}var c=function(){var d=a;a=[],d.forEach(s)},u=function(){return Promise.resolve().then(c)};u(),n={push:function(d){a.push(d),u()},filter:function(d){return a=a.filter(d),n}}}};return i}function QMe(t){t===void 0&&(t={});var e=XMe(null);return e.options=Fc({async:!0,ssr:!1},t),e}var nae=function(t){var e=t.sideCar,n=j0(t,["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 b.createElement(r,Fc({},n))};nae.isSideCarExport=!0;function JMe(t,e){return t.useMedium(e),nae}var rae=QMe(),gR=function(){},NT=b.forwardRef(function(t,e){var n=b.useRef(null),r=b.useState({onScrollCapture:gR,onWheelCapture:gR,onTouchMoveCapture:gR}),i=r[0],s=r[1],a=t.forwardProps,l=t.children,c=t.className,u=t.removeScrollBar,d=t.enabled,f=t.shards,h=t.sideCar,p=t.noRelative,m=t.noIsolation,x=t.inert,y=t.allowPinchZoom,g=t.as,w=g===void 0?"div":g,v=t.gapMode,N=j0(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=h,_=KMe([n,e]),j=Fc(Fc({},N),i);return b.createElement(b.Fragment,null,d&&b.createElement(S,{sideCar:rae,removeScrollBar:u,shards:f,noRelative:p,noIsolation:m,inert:x,setCallbacks:s,allowPinchZoom:!!y,lockRef:n,gapMode:v}),a?b.cloneElement(b.Children.only(l),Fc(Fc({},j),{ref:_})):b.createElement(w,Fc({},j,{className:c,ref:_}),l))});NT.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};NT.classNames={fullWidth:GC,zeroRight:WC};var ZMe=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function ePe(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=ZMe();return e&&t.setAttribute("nonce",e),t}function tPe(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function nPe(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var rPe=function(){var t=0,e=null;return{add:function(n){t==0&&(e=ePe())&&(tPe(e,n),nPe(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},iPe=function(){var t=rPe();return function(e,n){b.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},iae=function(){var t=iPe(),e=function(n){var r=n.styles,i=n.dynamic;return t(r,i),null};return e},sPe={left:0,top:0,right:0,gap:0},xR=function(t){return parseInt(t||"",10)||0},aPe=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],r=e[t==="padding"?"paddingTop":"marginTop"],i=e[t==="padding"?"paddingRight":"marginRight"];return[xR(n),xR(r),xR(i)]},oPe=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return sPe;var e=aPe(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},lPe=iae(),jy="data-scroll-locked",cPe=function(t,e,n,r){var i=t.left,s=t.top,a=t.right,l=t.gap;return n===void 0&&(n="margin"),`
727  .`.concat(HMe,` {
728   overflow: hidden `).concat(r,`;
729   padding-right: `).concat(l,"px ").concat(r,`;
730  }
731  body[`).concat(jy,`] {
732    overflow: hidden `).concat(r,`;
733    overscroll-behavior: contain;
734    `).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&`
735    padding-left: `.concat(i,`px;
736    padding-top: `).concat(s,`px;
737    padding-right: `).concat(a,`px;
738    margin-left:0;
739    margin-top:0;
740    margin-right: `).concat(l,"px ").concat(r,`;
741    `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";
741")].filter(Boolean).join(""),`
742  }
743  
744  .`).concat(WC,` {
745    right: `).concat(l,"px ").concat(r,`;
746  }
747  
748  .`).concat(GC,` {
749    margin-right: `).concat(l,"px ").concat(r,`;
750  }
751  
752  .`).concat(WC," .").concat(WC,` {
753    right: 0 `).concat(r,`;
754  }
755  
756  .`).concat(GC," .").concat(GC,` {
757    margin-right: 0 `).concat(r,`;
758  }
759  
760  body[`).concat(jy,`] {
761    `).concat(WMe,": ").concat(l,`px;
762  }
763`)},wH=function(){var t=parseInt(document.body.getAttribute(jy)||"0",10);return isFinite(t)?t:0},uPe=function(){b.useEffect(function(){return document.body.setAttribute(jy,(wH()+1).toString()),function(){var t=wH()-1;t<=0?document.body.removeAttribute(jy):document.body.setAttribute(jy,t.toString())}},[])},dPe=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,i=r===void 0?"margin":r;uPe();var s=b.useMemo(function(){return oPe(i)},[i]);return b.createElement(lPe,{styles:cPe(s,!e,i,n?"":"!important")})},Y4=!1;if(typeof window<"u")try{var JN=Object.defineProperty({},"passive",{get:function(){return Y4=!0,!0}});window.addEventListener("test",JN,JN),window.removeEventListener("test",JN,JN)}catch{Y4=!1}var Zg=Y4?{passive:!1}:!1,fPe=function(t){return t.tagName==="TEXTAREA"},sae=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!fPe(t)&&n[e]==="visible")},hPe=function(t){return sae(t,"overflowY")},pPe=function(t){return sae(t,"overflowX")},_H=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=aae(t,r);if(i){var s=oae(t,r),a=s[1],l=s[2];if(a>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},mPe=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},gPe=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},aae=function(t,e){return t==="v"?hPe(e):pPe(e)},oae=function(t,e){return t==="v"?mPe(e):gPe(e)},xPe=function(t,e){return t==="h"&&e==="rtl"?-1:1},yPe=function(t,e,n,r,i){var s=xPe(t,window.getComputedStyle(e).direction),a=s*r,l=n.target,c=e.contains(l),u=!1,d=a>0,f=0,h=0;do{if(!l)break;var p=oae(t,l),m=p[0],x=p[1],y=p[2],g=x-y-s*m;(m||g)&&aae(t,l)&&(f+=g,h+=m);var w=l.parentNode;l=w&&w.nodeType===Node.DOCUMENT_FRAGMENT_NODE?w.host:w}while(!c&&l!==document.body||c&&(e.contains(l)||e===l));return(d&&Math.abs(f)<1||!d&&Math.abs(h)<1)&&(u=!0),u},ZN=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},SH=function(t){return[t.deltaX,t.deltaY]},NH=function(t){return t&&"current"in t?t.current:t},vPe=function(t,e){return t[0]===e[0]&&t[1]===e[1]},bPe=function(t){return`
764  .block-interactivity-`.concat(t,` {pointer-events: none;}
765  .allow-interactivity-`).concat(t,` {pointer-events: all;}
766`)},wPe=0,ex=[];function _Pe(t){var e=b.useRef([]),n=b.useRef([0,0]),r=b.useRef(),i=b.useState(wPe++)[0],s=b.useState(iae)[0],a=b.useRef(t);b.useEffect(function(){a.current=t},[t]),b.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var x=ECe([t.lockRef.current],(t.shards||[]).map(NH),!0).filter(Boolean);return x.forEach(function(y){return y.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),x.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var l=b.useCallback(function(x,y){if("touches"in x&&x.touches.length===2||x.type==="wheel"&&x.ctrlKey)return!a.current.allowPinchZoom;var g=ZN(x),w=n.current,v="deltaX"in x?x.deltaX:w[0]-g[0],N="deltaY"in x?x.deltaY:w[1]-g[1],S,_=x.target,j=Math.abs(v)>Math.abs(N)?"h":"v";if("touches"in x&&j==="h"&&_.type==="range")return!1;var A=window.getSelection(),C=A&&A.anchorNode,k=C?C===_||C.contains(_):!1;if(k)return!1;var M=_H(j,_);if(!M)return!0;if(M?S=j:(S=j==="v"?"h":"v",M=_H(j,_)),!M)return!1;if(!r.current&&"changedTouches"in x&&(v||N)&&(r.current=S),!S)return!0;var I=r.current||S;return yPe(I,y,x,I==="h"?v:N)},[]),c=b.useCallback(function(x){var y=x;if(!(!ex.length||ex[ex.length-1]!==s)){var g="deltaY"in y?SH(y):ZN(y),w=e.current.filter(function(S){return S.name===y.type&&(S.target===y.target||y.target===S.shadowParent)&&vPe(S.delta,g)})[0];if(w&&w.should){y.cancelable&&y.preventDefault();return}
vendor: 4,536 bytes, line 766
766if(!w){var v=(a.current.shards||[]).map(NH).filter(Boolean).filter(function(S){return S.contains(y.target)}),N=v.length>0?l(y,v[0]):!a.current.noIsolation;N&&y.cancelable&&y.preventDefault()}}},[]),u=b.useCallback(function(x,y,g,w){var v={name:x,delta:y,target:g,should:w,shadowParent:SPe(g)};e.current.push(v),setTimeout(function(){e.current=e.current.filter(function(N){return N!==v})},1)},[]),d=b.useCallback(function(x){n.current=ZN(x),r.current=void 0},[]),f=b.useCallback(function(x){u(x.type,SH(x),x.target,l(x,t.lockRef.current))},[]),h=b.useCallback(function(x){u(x.type,ZN(x),x.target,l(x,t.lockRef.current))},[]);b.useEffect(function(){return ex.push(s),t.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",c,Zg),document.addEventListener("touchmove",c,Zg),document.addEventListener("touchstart",d,Zg),function(){ex=ex.filter(function(x){return x!==s}),document.removeEventListener("wheel",c,Zg),document.removeEventListener("touchmove",c,Zg),document.removeEventListener("touchstart",d,Zg)}},[]);var p=t.removeScrollBar,m=t.inert;return b.createElement(b.Fragment,null,m?b.createElement(s,{styles:bPe(i)}):null,p?b.createElement(dPe,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function SPe(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const NPe=JMe(rae,_Pe);var kS=b.forwardRef(function(t,e){return b.createElement(NT,Fc({},t,{ref:e,sideCar:NPe}))});kS.classNames=NT.classNames;var jPe=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},tx=new WeakMap,ej=new WeakMap,tj={},yR=0,lae=function(t){return t&&(t.host||lae(t.parentNode))},CPe=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=lae(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},kPe=function(t,e,n,r){var i=CPe(e,Array.isArray(t)?t:[t]);tj[n]||(tj[n]=new WeakMap);var s=tj[n],a=[],l=new Set,c=new Set(i),u=function(f){!f||l.has(f)||(l.add(f),u(f.parentNode))};i.forEach(u);var d=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(h){if(l.has(h))d(h);else try{var p=h.getAttribute(r),m=p!==null&&p!=="false",x=(tx.get(h)||0)+1,y=(s.get(h)||0)+1;tx.set(h,x),s.set(h,y),a.push(h),x===1&&m&&ej.set(h,!0),y===1&&h.setAttribute(n,"true"),m||h.setAttribute(r,"true")}catch(g){console.error("aria-hidden: cannot operate on ",h,g)}})};return d(e),l.clear(),yR++,function(){a.forEach(function(f){var h=tx.get(f)-1,p=s.get(f)-1;tx.set(f,h),s.set(f,p),h||(ej.has(f)||f.removeAttribute(r),ej.delete(f)),p||f.removeAttribute(n)}),yR--,yR||(tx=new WeakMap,tx=new WeakMap,ej=new WeakMap,tj={})}},jT=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=jPe(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),kPe(r,i,n,"aria-hidden")):function(){return null}},CT="Dialog",[cae,uae]=BTe(CT),[EPe,yc]=cae(CT),dae=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:a=!0}=t,l=b.useRef(null),c=b.useRef(null),[u,d]=su({prop:r,defaultProp:i??!1,onChange:s,caller:CT});return o.jsx(EPe,{scope:e,triggerRef:l,contentRef:c,contentId:ys(),titleId:ys(),descriptionId:ys(),open:u,onOpenChange:d,onOpenToggle:b.useCallback(()=>d(f=>!f),[d]),modal:a,children:n})};dae.displayName=CT;var fae="DialogTrigger",hae=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=yc(fae,n),s=Pn(e,i.triggerRef);return o.jsx(CS.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Pz(i.open),...r,ref:s,onClick:at(t.onClick,i.onOpenToggle)})});hae.displayName=fae;var Tz="DialogPortal",[APe,pae]=cae(Tz,{forceMount:void 0}),mae=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:i}=t,s=yc(Tz,e);return o.jsx(APe,{scope:e,forceMount:n,children:b.Children.map(r,a=>o.jsx(Na,{present:n||s.open,children:o.jsx(Sg,{asChild:!0,container:i,children:a})}))})};mae.displayName=Tz;var e2="DialogOverlay",gae=b.forwardRef((t,e)=>{const n=pae(e2,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=yc(e2,t.__scopeDialog);return s.modal?o.jsx(Na,{present:r||s.open,children:o.jsx(MPe,{...i,ref:e})}):null});gae.displayName=e2;var TPe=tae("DialogOverlay.RemoveScroll"),MPe=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=yc(e2,n);return o.jsx(kS,{as:TPe,allowPinchZoom:!0,shards:[i.contentRef],children:o.jsx(CS.div,{"data-state":Pz(i.open
vendor: 4,539 bytes, lines 766-770
766),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),zm="DialogContent",xae=b.forwardRef((t,e)=>{const n=pae(zm,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=yc(zm,t.__scopeDialog);return o.jsx(Na,{present:r||s.open,children:s.modal?o.jsx(PPe,{...i,ref:e}):o.jsx(OPe,{...i,ref:e})})});xae.displayName=zm;var PPe=b.forwardRef((t,e)=>{const n=yc(zm,t.__scopeDialog),r=b.useRef(null),i=Pn(e,n.contentRef,r);return b.useEffect(()=>{const s=r.current;if(s)return jT(s)},[]),o.jsx(yae,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:at(t.onCloseAutoFocus,s=>{var a;s.preventDefault(),(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:at(t.onPointerDownOutside,s=>{const a=s.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0;(a.button===2||l)&&s.preventDefault()}),onFocusOutside:at(t.onFocusOutside,s=>s.preventDefault())})}),OPe=b.forwardRef((t,e)=>{const n=yc(zm,t.__scopeDialog),r=b.useRef(!1),i=b.useRef(!1);return o.jsx(yae,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var a,l;(a=t.onCloseAutoFocus)==null||a.call(t,s),s.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{var c,u;(c=t.onInteractOutside)==null||c.call(t,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const a=s.target;((u=n.triggerRef.current)==null?void 0:u.contains(a))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),yae=b.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,...a}=t,l=yc(zm,n),c=b.useRef(null),u=Pn(e,c);return ST(),o.jsxs(o.Fragment,{children:[o.jsx(jS,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:o.jsx(_g,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Pz(l.open),...a,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),o.jsxs(o.Fragment,{children:[o.jsx(IPe,{titleId:l.titleId}),o.jsx(LPe,{contentRef:c,descriptionId:l.descriptionId})]})]})}),Mz="DialogTitle",vae=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=yc(Mz,n);return o.jsx(CS.h2,{id:i.titleId,...r,ref:e})});vae.displayName=Mz;var bae="DialogDescription",wae=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=yc(bae,n);return o.jsx(CS.p,{id:i.descriptionId,...r,ref:e})});wae.displayName=bae;var _ae="DialogClose",Sae=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=yc(_ae,n);return o.jsx(CS.button,{type:"button",...r,ref:e,onClick:at(t.onClick,()=>i.onOpenChange(!1))})});Sae.displayName=_ae;function Pz(t){return t?"open":"closed"}var Nae="DialogTitleWarning",[RPe,jae]=zTe(Nae,{contentName:zm,titleName:Mz,docsSlug:"dialog"}),IPe=({titleId:t})=>{const e=jae(Nae),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
767
768If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
769
770For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return b.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},DPe="DialogDescriptionWarning",LPe=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${jae(DPe).contentName}}.`;return b.useEffect(()=>{var s;const i=(s=t.current)==null?void 0:s.getAttribute("aria-describedby");e&&i&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},Oz=dae,$Pe=hae,Rz=mae,kT=gae,ET=xae,Iz=vae,Dz=wae,Lz=Sae;const ur=Oz,FPe=Rz,Cae=b.forwardRef(({className:t,...e},n)=>o.jsx(kT,{ref:n,className:ne("fixed inset-0 z-50 bg-background/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));Cae.displayName=kT.displayName;const tr=b.forwardRef(({className:t,children:e,...n},r)=>o.jsxs(FPe,{children:[o.jsx(Cae,{}),o.jsxs(ET,{ref:r,className:ne("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-xl 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
770nded-lg",t),...n,children:[e,o.jsxs(Lz,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[o.jsx(mr,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));tr.displayName=ET.displayName;const dr=({className:t,...e})=>o.jsx("div",{className:ne("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});dr.displayName="DialogHeader";const Pr=({className:t,...e})=>o.jsx("div",{className:ne("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});Pr.displayName="DialogFooter";const fr=b.forwardRef(({className:t,...e},n)=>o.jsx(Iz,{ref:n,className:ne("text-lg font-semibold leading-none tracking-tight",t),...e}));fr.displayName=Iz.displayName;const hr=b.forwardRef(({className:t,...e},n)=>o.jsx(Dz,{ref:n,className:ne("text-sm text-muted-foreground",t),...e}));hr.displayName=Dz.displayName;var UPe=Symbol.for("react.lazy"),t2=YA[" use ".trim().toString()];function zPe(t){return typeof t=="object"&&t!==null&&"then"in t}function kae(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===UPe&&"_payload"in t&&zPe(t._payload)}function Eae(t){const e=VPe(t),n=b.forwardRef((r,i)=>{let{children:s,...a}=r;kae(s)&&typeof t2=="function"&&(s=t2(s._payload));const l=b.Children.toArray(s),c=l.find(WPe);if(c){const u=c.props.children,d=l.map(f=>f===c?b.Children.count(u)>1?b.Children.only(null):b.isValidElement(u)?u.props.children:null:f);return o.jsx(e,{...a,ref:i,children:b.isValidElement(u)?b.cloneElement(u,void 0,d):null})}return o.jsx(e,{...a,ref:i,children:s})});return n.displayName=`${t}.Slot`,n}var BPe=Eae("Slot");function VPe(t){const e=b.forwardRef((n,r)=>{let{children:i,...s}=n;if(kae(i)&&typeof t2=="function"&&(i=t2(i._payload)),b.isValidElement(i)){const a=qPe(i),l=GPe(s,i.props);return i.type!==b.Fragment&&(l.ref=r?Ir(r,a):a),b.cloneElement(i,l)}return b.Children.count(i)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var HPe=Symbol("radix.slottable");function WPe(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===HPe}function GPe(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...l)=>{const c=s(...l);return i(...l),c}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function qPe(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}const jH=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,CH=an,$z=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return CH(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:s}=e,a=Object.keys(i).map(u=>{const d=n==null?void 0:n[u],f=s==null?void 0:s[u];if(d===null)return null;const h=jH(d)||jH(f);return i[u][h]}),l=n&&Object.entries(n).reduce((u,d)=>{let[f,h]=d;return h===void 0||(u[f]=h),u},{}),c=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:f,className:h,...p}=d;return Object.entries(p).every(m=>{let[x,y]=m;return Array.isArray(y)?y.includes({...s,...l}[x]):{...s,...l}[x]===y})?[...u,f,h]:u},[]);return CH(t,a,c,n==null?void 0:n.class,n==null?void 0:n.className)},Fz=$z("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg text-sm font-medium 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",studio:"bg-primary/10 text-primary hover:bg-primary/20 border-0"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10",xs:"h-7 rounded-md px-2 text-xs"}},defaultVariants:{variant:"default",size:"default"}}),le=b.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...i},s)=>{const a=r?BPe:"button";return o.jsx(a,{className:ne(Fz({variant:e,size:n,className:t})),ref:s,...i})});le.displayName="Button";function AT(){return En({queryKey:["countries"],queryFn:()=>Ce.get("/public/countries"),staleTime:1e3*60*60})}function KPe(t){return En({queryKey:["timezones",t],queryFn:()=>Ce.get("/public/timezones"),staleTime:1e3*60*60})}function YPe(t){return En({queryKey:["locations","search",t],queryFn:()=>Ce.get(`/locations/search?q=${encodeURIComponent(t)}&limit=10`),enabled:t.length>=2,staleTime:1e3*60*5})}const gt=b.forwardRef(({className:t,type:e,...n},r)=>o.jsx("input",{type:e,className:ne("flex h-10 w-full rounded-lg border border-input bg-background px-3 py-2 text-sm r
vendor: 59,039 bytes, line 770
770ing-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",t),ref:r,...n}));gt.displayName="Input";var XPe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],_l=XPe.reduce((t,e)=>{const n=Eae(`Primitive.${e}`),r=b.forwardRef((i,s)=>{const{asChild:a,...l}=i,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),QPe="Label",Aae=b.forwardRef((t,e)=>o.jsx(_l.label,{...t,ref:e,onMouseDown:n=>{var i;n.target.closest("button, input, select, textarea")||((i=t.onMouseDown)==null||i.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Aae.displayName=QPe;var Tae=Aae;const JPe=$z("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),et=b.forwardRef(({className:t,...e},n)=>o.jsx(Tae,{ref:n,className:ne(JPe(),t),...e}));et.displayName=Tae.displayName;var kH=1,ZPe=.9,eOe=.8,tOe=.17,vR=.1,bR=.999,nOe=.9999,rOe=.99,iOe=/[\\\/_+.#"@\[\(\{&]/,sOe=/[\\\/_+.#"@\[\(\{&]/g,aOe=/[\s-]/,Mae=/[\s-]/g;function X4(t,e,n,r,i,s,a){if(s===e.length)return i===t.length?kH:rOe;var l=`${i},${s}`;if(a[l]!==void 0)return a[l];for(var c=r.charAt(s),u=n.indexOf(c,i),d=0,f,h,p,m;u>=0;)f=X4(t,e,n,r,u+1,s+1,a),f>d&&(u===i?f*=kH:iOe.test(t.charAt(u-1))?(f*=eOe,p=t.slice(i,u-1).match(sOe),p&&i>0&&(f*=Math.pow(bR,p.length))):aOe.test(t.charAt(u-1))?(f*=ZPe,m=t.slice(i,u-1).match(Mae),m&&i>0&&(f*=Math.pow(bR,m.length))):(f*=tOe,i>0&&(f*=Math.pow(bR,u-i))),t.charAt(u)!==e.charAt(s)&&(f*=nOe)),(f<vR&&n.charAt(u-1)===r.charAt(s+1)||r.charAt(s+1)===r.charAt(s)&&n.charAt(u-1)!==r.charAt(s))&&(h=X4(t,e,n,r,u+1,s+2,a),h*vR>f&&(f=h*vR)),f>d&&(d=f),u=n.indexOf(c,u+1);return a[l]=d,d}function EH(t){return t.toLowerCase().replace(Mae," ")}function oOe(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,X4(t,e,EH(t),EH(e),0,0,{})}var mb='[cmdk-group=""]',wR='[cmdk-group-items=""]',lOe='[cmdk-group-heading=""]',Pae='[cmdk-item=""]',AH=`${Pae}:not([aria-disabled="true"])`,Q4="cmdk-item-select",Lx="data-value",cOe=(t,e,n)=>oOe(t,e,n),Oae=b.createContext(void 0),ES=()=>b.useContext(Oae),Rae=b.createContext(void 0),Uz=()=>b.useContext(Rae),Iae=b.createContext(void 0),Dae=b.forwardRef((t,e)=>{let n=$x(()=>{var B,z;return{search:"",value:(z=(B=t.value)!=null?B:t.defaultValue)!=null?z:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=$x(()=>new Set),i=$x(()=>new Map),s=$x(()=>new Map),a=$x(()=>new Set),l=Lae(t),{label:c,children:u,value:d,onValueChange:f,filter:h,shouldFilter:p,loop:m,disablePointerSelection:x=!1,vimBindings:y=!0,...g}=t,w=ys(),v=ys(),N=ys(),S=b.useRef(null),_=bOe();Bm(()=>{if(d!==void 0){let B=d.trim();n.current.value=B,j.emit()}},[d]),Bm(()=>{_(6,R)},[]);let j=b.useMemo(()=>({subscribe:B=>(a.current.add(B),()=>a.current.delete(B)),snapshot:()=>n.current,setState:(B,z,H)=>{var W,G,K,ee;if(!Object.is(n.current[B],z)){if(n.current[B]=z,B==="search")I(),k(),_(1,M);else if(B==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let V=document.getElementById(N);V?V.focus():(W=document.getElementById(w))==null||W.focus()}if(_(7,()=>{var V;n.current.selectedItemId=(V=E())==null?void 0:V.id,j.emit()}),H||_(5,R),((G=l.current)==null?void 0:G.value)!==void 0){let V=z??"";(ee=(K=l.current).onValueChange)==null||ee.call(K,V);return}}j.emit()}},emit:()=>{a.current.forEach(B=>B())}}),[]),A=b.useMemo(()=>({value:(B,z,H)=>{var W;z!==((W=s.current.get(B))==null?void 0:W.value)&&(s.current.set(B,{value:z,keywords:H}),n.current.filtered.items.set(B,C(z,H)),_(2,()=>{k(),j.emit()}))},item:(B,z)=>(r.current.add(B),z&&(i.current.has(z)?i.current.get(z).add(B):i.current.set(z,new Set([B]))),_(3,()=>{I(),k(),n.current.value||M(),j.emit()}),()=>{s.current.delete(B),r.current.delete(B),n.current.filtered.items.delete(B);let H=E();_(4,()=>{I(),(H==null?void 0:H.getAttribute("id"))===B&&M(),j.emit()})}),group:B=>(i.current.has(B)||i.current.set(B,new Set),()=>{s.current.delete(B),i.current.delete(B)}),filter:()=>l.current.shouldFilter,label:c||t["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:w,inputId:N,labelId:v,listInnerRef:S}),[]);function C(B,z){var H,W;let G=(W=(H=l.current)==null?void 0:H.filter)!=null?W:cOe;return B?G(B,n.current.search,z):0}function k(){if(!n.current.search||l.current.shouldFilter===!1)return;let B=n.current.filtered.items,z=[];n.current.filtered.groups.forEach(W=>{let G=i.current.get(W),K=0;G.forEach(ee=>{let V=B.get(ee);K=Math.max(V,K)}),z.push([W,K])});let H=S.current;P().sort((W,G)=>{var K,ee;let V=W.getAttribute("id"),J=G.getAttribute("id");return((K=B.get(J))!=null?K:0)-((ee=B.get(V))!=null?ee:0)}).forEach(W=>{let G=W.closest(wR);G?G.appendChild(W.parentElement===G?W:W.closest(`${wR} > *`)):H.appendChild(W.parentElement===H?W:W.closest(`${wR} > *`))}),z.sort((W,G)=>G[1]-W[1]).forEach(W=>{var G;let K=(G=S.current)==null?void 0:G.querySelector(`${mb}[${Lx}="${encodeURIComponent(W[0])}"]`);K==null||K.parentElement.appendChild(K)})}function M(){let B=P().find(H=>H.getAttribute("aria-disabled")!=="true"),z=B==null?void 0:B.getAttribute(Lx);j.setState("value",z||void 0)}function I(){var B,z,H,W;if(!n.current.search||l.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let G=0;for(let K of r.current){let ee=(z=(B=s.current.get(K))==null?void 0:B.value)!=null?z:"",V=(W=(H=s.current.get(K))==null?void 0:H.keywords)!=null?W:[],J=C(ee,V);n.current.filtered.items.set(K,J),J>0&&G++}for(let[K,ee]of i.current)for(let V of ee)if(n.current.filtered.items.get(V)>0){n.current.filtered.groups.add(K);break}n.current.filtered.count=G}function R(){var B,z,H;let W=E();W&&(((B=W.parentElement)==null?void 0:B.firstChild)===W&&((H=(z=W.closest(mb))==null?void 0:z.querySelector(lOe))==null||H.scrollIntoView({block:"nearest"})),W.scrollIntoView({block:"nearest"}))}function E(){var B;return(B=S.current)==null?void 0:B.querySelector(`${Pae}[aria-selected="true"]`)}function P(){var B;return Array.from(((B=S.current)==null?void 0:B.querySelectorAll(AH))||[])}function O(B){let z=P()[B];z&&j.setState("value",z.getAttribute(Lx))}function L(B){var z;let H=E(),W=P(),G=W.findIndex(ee=>ee===H),K=W[G+B];(z=l.current)!=null&&z.loop&&(K=G+B<0?W[W.length-1]:G+B===W.length?W[0]:W[G+B]),K&&j.setState("value",K.getAttribute(Lx))}function T(B){let z=E(),H=z==null?void 0:z.closest(mb),W;for(;H&&!W;)H=B>0?yOe(H,mb):vOe(H,mb),W=H==null?void 0:H.querySelector(AH);W?j.setState("value",W.getAttribute(Lx)):L(B)}let D=()=>O(P().length-1),F=B=>{B.preventDefault(),B.metaKey?D():B.altKey?T(1):L(1)},q=B=>{B.preventDefault(),B.metaKey?O(0):B.altKey?T(-1):L(-1)};return b.createElement(_l.div,{ref:e,tabIndex:-1,...g,"cmdk-root":"",onKeyDown:B=>{var z;(z=g.onKeyDown)==null||z.call(g,B);let H=B.nativeEvent.isComposing||B.keyCode===229;if(!(B.defaultPrevented||H))switch(B.key){case"n":case"j":{y&&B.ctrlKey&&F(B);break}case"ArrowDown":{F(B);break}case"p":case"k":{y&&B.ctrlKey&&q(B);break}case"ArrowUp":{q(B);break}case"Home":{B.preventDefault(),O(0);break}case"End":{B.preventDefault(),D();break}case"Enter":{B.preventDefault();let W=E();if(W){let G=new Event(Q4);W.dispatchEvent(G)}}}}},b.createElement("label",{"cmdk-label":"",htmlFor:A.inputId,id:A.labelId,style:_Oe},c),TT(t,B=>b.createElement(Rae.Provider,{value:j},b.createElement(Oae.Provider,{value:A},B))))}),uOe=b.forwardRef((t,e)=>{var n,r;let i=ys(),s=b.useRef(null),a=b.useContext(Iae),l=ES(),c=Lae(t),u=(r=(n=c.current)==null?void 0:n.forceMount)!=null?r:a==null?void 0:a.forceMount;Bm(()=>{if(!u)return l.item(i,a==null?void 0:a.id)},[u]);let d=$ae(i,s,[t.value,t.children,s],t.keywords),f=Uz(),h=Ah(_=>_.value&&_.value===d.current),p=Ah(_=>u||l.filter()===!1?!0:_.search?_.filtered.items.get(i)>0:!0);b.useEffect(()=>{let _=s.current;if(!(!_||t.disabled))return _.addEventListener(Q4,m),()=>_.removeEventListener(Q4,m)},[p,t.onSelect,t.disabled]);function m(){var _,j;x(),(j=(_=c.current).onSelect)==null||j.call(_,d.current)}function x(){f.setState("value",d.current,!0)}if(!p)return null;let{disabled:y,value:g,onSelect:w,forceMount:v,keywords:N,...S}=t;return b.createElement(_l.div,{ref:Ir(s,e),...S,id:i,"cmdk-item":"",role:"option","aria-disabled":!!y,"aria-selected":!!h,"data-disabled":!!y,"data-selected":!!h,onPointerMove:y||l.getDisablePointerSelection()?void 0:x,onClick:y?void 0:m},t.children)}),dOe=b.forwardRef((t,e)=>{let{heading:n,children:r,forceMount:i,...s}=t,a=ys(),l=b.useRef(null),c=b.useRef(null),u=ys(),d=ES(),f=Ah(p=>i||d.filter()===!1?!0:p.search?p.filtered.groups.has(a):!0);Bm(()=>d.group(a),[]),$ae(a,l,[t.value,t.heading,c]);let h=b.useMemo(()=>({id:a,forceMount:i}),[i]);return b.createElement(_l.div,{ref:Ir(l,e),...s,"cmdk-group":"",role:"presentation",hidden:f?void 0:!0},n&&b.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:u},n),TT(t,p=>b.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},b.createElement(Iae.Provider,{value:h},p))))}),fOe=b.forwardRef((t,e)=>{let{alwaysRender:n,...r}=t,i=b.useRef(null),s=Ah(a=>!a.search);return!n&&!s?null:b.createElement(_l.div,{ref:Ir(i,e),...r,"cmdk-separator":"",role:"separator"})}),hOe=b.forwardRef((t,e)=>{let{onValueChange:n,...r}=t,i=t.value!=null,s=Uz(),a=Ah(u=>u.search),l=Ah(u=>u.selectedItemId),c=ES();return b.useEffect(()=>{t.value!=null&&s.setState("search",t.value)},[t.value]),b.createElement(_l.input,{ref:e,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":l,id:c.inputId,type:"text",value:i?t.value:a,onChange:u=>{i||s.setState("search",u.target.value),n==null||n(u.target.value)}})}),pOe=b.forwardRef((t,e)=>{let{children:n,label:r="Suggestions",...i}=t,s=b.useRef(null),a=b.useRef(null),l=Ah(u=>u.selectedItemId),c=ES();return b.useEffect(()=>{if(a.current&&s.current){let u=a.current,d=s.current,f,h=new ResizeObserver(()=>{f=requestAnimationFrame(()=>{let p=u.offsetHeight;d.style.setProperty("--cmdk-list-height",p.toFixed(1)+"px")})});return h.observe(u),()=>{cancelAnimationFrame(f),h.unobserve(u)}}},[]),b.createElement(_l.div,{ref:Ir(s,e),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":r,id:c.listId},TT(t,u=>b.createElement("div",{ref:Ir(a,c.listInnerRef),"cmdk-list-sizer":""},u)))}),mOe=b.forwardRef((t,e)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:s,container:a,...l}=t;return b.createElement(Oz,{open:n,onOpenChange:r},b.createElement(Rz,{container:a},b.createElement(kT,{"cmdk-overlay":"",className:i}),b.createElement(ET,{"aria-label":t.label,"cmdk-dialog":"",className:s},b.createElement(Dae,{ref:e,...l}))))}),gOe=b.forwardRef((t,e)=>Ah(n=>n.filtered.count===0)?b.createElement(_l.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),xOe=b.forwardRef((t,e)=>{let{progress:n,children:r,label:i="Loading...",...s}=t;return b.createElement(_l.div,{ref:e,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},TT(t,a=>b.createElement("div",{"aria-hidden":!0},a)))}),Qa=Object.assign(Dae,{List:pOe,Item:uOe,Input:hOe,Group:dOe,Separator:fOe,Dialog:mOe,Empty:gOe,Loading:xOe});function yOe(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function vOe(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function Lae(t){let e=b.useRef(t);return Bm(()=>{e.current=t}),e}var Bm=typeof window>"u"?b.useEffect:b.useLayoutEffect;function $x(t){let e=b.useRef();return e.current===void 0&&(e.current=t()),e}function Ah(t){let e=Uz(),n=()=>t(e.snapshot());return b.useSyncExternalStore(e.subscribe,n,n)}function $ae(t,e,n,r=[]){let i=b.useRef(),s=ES();return Bm(()=>{var a;let l=(()=>{var u;for(let d of n){if(typeof d=="string")return d.trim();if(typeof d=="object"&&"current"in d)return d.current?(u=d.current.textContent)==null?void 0:u.trim():i.current}})(),c=r.map(u=>u.trim());s.value(t,l,c),(a=e.current)==null||a.setAttribute(Lx,l),i.current=l}),i}var bOe=()=>{let[t,e]=b.useState(),n=$x(()=>new Map);return Bm(()=>{n.current.forEach(r=>r()),n.current=new Map},[t]),(r,i)=>{n.current.set(r,i),e({})}};function wOe(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function TT({asChild:t,children:e},n){return t&&b.isValidElement(e)?b.cloneElement(wOe(e),{ref:e.ref},n(e.props.children)):n(e)}var _Oe={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Kh=b.forwardRef(({className:t,...e},n)=>o.jsx(Qa,{ref:n,className:ne("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...e}));Kh.displayName=Qa.displayName;const Yh=b.forwardRef(({className:t,...e},n)=>o.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[o.jsx(Xa,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),o.jsx(Qa.Input,{ref:n,className:ne("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...e})]}));Yh.displayName=Qa.Input.displayName;const zz=b.forwardRef(({className:t,...e},n)=>o.jsx(Qa.List,{ref:n,className:ne("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...e}));zz.displayName=Qa.List.displayName;const Xh=b.forwardRef((t,e)=>o.jsx(Qa.Empty,{ref:e,className:"py-6 text-center text-sm",...t}));Xh.displayName=Qa.Empty.displayName;const _d=b.forwardRef(({className:t,...e},n)=>o.jsx(Qa.Group,{ref:n,className:ne("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...e}));_d.displayName=Qa.Group.displayName;const Fae=b.forwardRef(({className:t,...e},n)=>o.jsx(Qa.Separator,{ref:n,className:ne("-mx-1 h-px bg-border",t),...e}));Fae.displayName=Qa.Separator.displayName;const Sd=b.forwardRef(({className:t,...e},n)=>o.jsx(Qa.Item,{ref:n,className:ne("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t),...e}));Sd.displayName=Qa.Item.displayName;function SOe(t,e=[]){let n=[];function r(s,a){const l=b.createContext(a),c=n.length;n=[...n,a];const u=f=>{var g;const{scope:h,children:p,...m}=f,x=((g=h==null?void 0:h[t])==null?void 0:g[c])||l,y=b.useMemo(()=>m,Object.values(m));return o.jsx(x.Provider,{value:y,children:p})};u.displayName=s+"Provider";function d(f,h){var x;const p=((x=h==null?void 0:h[t])==null?void 0:x[c])||l,m=b.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[u,d]}const i=()=>{const s=n.map(a=>b.createContext(a));return function(l){const c=(l==null?void 0:l[t])||s;return b.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return i.scopeName=t,[r,NOe(i,...e)]}function NOe(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const a=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...l,...f}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return n.scopeName=e.scopeName,n}const jOe=["top","right","bottom","left"],Th=Math.min,uo=Math.max,n2=Math.round,nj=Math.floor,Yc=t=>({x:t,y:t}),COe={left:"right",right:"left",bottom:"top",top:"bottom"},kOe={start:"end",end:"start"};function J4(t,e,n){return uo(t,Th(e,n))}function Nd(t,e){return typeof t=="function"?t(e):t}function jd(t){return t.split("-")[0]}function E0(t){return t.split("-")[1]}function Bz(t){return t==="x"?"y":"x"}function Vz(t){return t==="y"?"height":"width"}const EOe=new Set(["top","bottom"]);function zc(t){return EOe.has(jd(t))?"y":"x"}function Hz(t){return Bz(zc(t))}function AOe(t,e,n){n===void 0&&(n=!1);const r=E0(t),i=Hz(t),s=Vz(i);let a=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(a=r2(a)),[a,r2(a)]}function TOe(t){const e=r2(t);return[Z4(t),e,Z4(e)]}function Z4(t){return t.replace(/start|end/g,e=>kOe[e])}const TH=["left","right"],MH=["right","left"],MOe=["top","bottom"],POe=["bottom","top"];function OOe(t,e,n){switch(t){case"top":case"bottom":return n?e?MH:TH:e?TH:MH;case"left":case"right":return e?MOe:POe;default:return[]}}function ROe(t,e,n,r){const i=E0(t);let s=OOe(jd(t),n==="start",r);return i&&(s=s.map(a=>a+"-"+i),e&&(s=s.concat(s.map(Z4)))),s}function r2(t){return t.replace(/left|right|bottom|top/g,e=>COe[e])}function IOe(t){return{top:0,right:0,bottom:0,left:0,...t}}function Uae(t){return typeof t!="number"?IOe(t):{top:t,right:t,bottom:t,left:t}}function i2(t){const{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function PH(t,e,n){let{reference:r,floating:i}=t;const s=zc(e),a=Hz(e),l=Vz(a),c=jd(e),u=s==="y",d=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,h=r[l]/2-i[l]/2;let p;switch(c){case"top":p={x:d,y:r.y-i.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-i.width,y:f};break;default:p={x:r.x,y:r.y}}switch(E0(e)){case"start":p[a]-=h*(n&&u?-1:1);break;case"end":p[a]+=h*(n&&u?-1:1);break}return p}const DOe=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:a}=n,l=s.filter(Boolean),c=await(a.isRTL==null?void 0:a.isRTL(e));let u=await a.getElementRects({reference:t,floating:e,strategy:i}),{x:d,y:f}=PH(u,r,c),h=r,p={},m=0;for(let x=0;x<l.length;x++){const{name:y,fn:g}=l[x],{x:w,y:v,data:N,reset:S}=await g({x:d,y:f,initialPlacement:r,placement:h,strategy:i,middlewareData:p,rects:u,platform:a,elements:{reference:t,floating:e}});d=w??d,f=v??f,p={...p,[y]:{...p[y],...N}},S&&m<=50&&(m++,typeof S=="object"&&(S.placement&&(h=S.placement),S.rects&&(u=S.rects===!0?await a.getElementRects({reference:t,floating:e,strategy:i}):S.rects),{x:d,y:f}=PH(u,h,c)),x=-1)}return{x:d,y:f,placement:h,strategy:i,middlewareData:p}};async function q1(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:s,rects:a,elements:l,strategy:c}=t,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:h=!1,padding:p=0}=Nd(e,t),m=Uae(p),y=l[h?f==="floating"?"reference":"floating":f],g=i2(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(y)))==null||n?y:y.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:c})),w=f==="floating"?{x:r,y:i,width:a.floating.width,height:a.floating.height}:a.reference,v=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),N=await(s.isElement==null?void 0:s.isElement(v))?await(s.getScale==null?void 0:s.getScale(v))||{x:1,y:1}:{x:1,y:1},S=i2(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:w,offsetParent:v,strategy:c}):w);return{top:(g.top-S.top+m.top)/N.y,bottom:(S.bottom-g.bottom+m.bottom)/N.y,left:(g.left-S.left+m.left)/N.x,right:(S.right-g.right+m.right)/N.x}}const LOe=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:s,platform:a,elements:l,middlewareData:c}=e,{element:u,padding:d=0}=Nd(t,e)||{};if(u==null)return{};const f=Uae(d),h={x:n,y:r},p=Hz(i),m=Vz(p),x=await a.getDimensions(u),y=p==="y",g=y?"top":"left",w=y?"bottom":"right",v=y?"clientHeight":"clientWidth",N=s.reference[m]+s.reference[p]-h[p]-s.floating[m],S=h[p]-s.reference[p],_=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u));let j=_?_[v]:0;(!j||!await(a.isElement==null?void 0:a.isElement(_)))&&(j=l.floating[v]||s.floating[m]);const A=N/2-S/2,C=j/2-x[m]/2-1,k=Th(f[g],C),M=Th(f[w],C),I=k,R=j-x[m]-M,E=j/2-x[m]/2+A,P=J4(I,E,R),O=!c.arrow&&E0(i)!=null&&E!==P&&s.reference[m]/2-(E<I?k:M)-x[m]/2<0,L=O?E<I?E-I:E-R:0;return{[p]:h[p]+L,data:{[p]:P,centerOffset:E-P-L,...O&&{alignmentOffset:L}},reset:O}}}),$Oe=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:i,middlewareData:s,rects:a,initialPlacement:l,platform:c,elements:u}=e,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:x=!0,...y}=Nd(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const g=jd(i),w=zc(l),v=jd(l)===l,N=await(c.isRTL==null?void 0:c.isRTL(u.floating)),S=h||(v||!x?[r2(l)]:TOe(l)),_=m!=="none";!h&&_&&S.push(...ROe(l,x,m,N));const j=[l,...S],A=await q1(e,y),C=[];let k=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&C.push(A[g]),f){const E=AOe(i,a,N);C.push(A[E[0]],A[E[1]])}if(k=[...k,{placement:i,overflows:C}],!C.every(E=>E<=0)){var M,I;const E=(((M=s.flip)==null?void 0:M.index)||0)+1,P=j[E];if(P&&(!(f==="alignment"?w!==zc(P):!1)||k.every(T=>zc(T.placement)===w?T.overflows[0]>0:!0)))return{data:{index:E,overflows:k},reset:{placement:P}};let O=(I=k.filter(L=>L.overflows[0]<=0).sort((L,T)=>L.overflows[1]-T.overflows[1])[0])==null?void 0:I.placement;if(!O)switch(p){case"bestFit":{var R;const L=(R=k.filter(T=>{if(_){const D=zc(T.placement);return D===w||D==="y"}return!0}).map(T=>[T.placement,T.overflows.filter(D=>D>0).reduce((D,F)=>D+F,0)]).sort((T,D)=>T[1]-D[1])[0])==null?void 0:R[0];L&&(O=L);break}case"initialPlacement":O=l;break}if(i!==O)return{reset:{placement:O}}}return{}}}};function OH(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function RH(t){return jOe.some(e=>t[e]>=0)}const FOe=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:r="referenceHidden",...i}=Nd(t,e);switch(r){case"referenceHidden":{const s=await q1(e,{...i,elementContext:"reference"}),a=OH(s,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:RH(a)}}}case"escaped":{const s=await q1(e,{...i,altBoundary:!0}),a=OH(s,n.floating);return{data:{escapedOffsets:a,escaped:RH(a)}}}default:return{}}}}},zae=new Set(["left","top"]);async function UOe(t,e){const{placement:n,platform:r,elements:i}=t,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),a=jd(n),l=E0(n),c=zc(n)==="y",u=zae.has(a)?-1:1,d=s&&c?-1:1,f=Nd(e,t);let{mainAxis:h,crossAxis:p,alignmentAxis:m}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof m=="number"&&(p=l==="end"?m*-1:m),c?{x:p*d,y:h*u}:{x:h*u,y:p*d}}const zOe=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:s,placement:a,middlewareData:l}=e,c=await UOe(e,t);return a===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:i+c.x,y:s+c.y,data:{...c,placement:a}}}}},BOe=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i}=e,{mainAxis:s=!0,crossAxis:a=!1,limiter:l={fn:y=>{let{x:g,y:w}=y;return{x:g,y:w}}},...c}=Nd(t,e),u={x:n,y:r},d=await q1(e,c),f=zc(jd(i)),h=Bz(f);let p=u[h],m=u[f];if(s){const y=h==="y"?"top":"left",g=h==="y"?"bottom":"right",w=p+d[y],v=p-d[g];p=J4(w,p,v)}if(a){const y=f==="y"?"top":"left",g=f==="y"?"bottom":"right",w=m+d[y],v=m-d[g];m=J4(w,m,v)}const x=l.fn({...e,[h]:p,[f]:m});return{...x,data:{x:x.x-n,y:x.y-r,enabled:{[h]:s,[f]:a}}}}}},VOe=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:i,rects:s,middlewareData:a}=e,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=Nd(t,e),d={x:n,y:r},f=zc(i),h=Bz(f);let p=d[h],m=d[f];const x=Nd(l,e),y=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:0,crossAxis:0,...x};if(c){const v=h==="y"?"height":"width",N=s.reference[h]-s.floating[v]+y.mainAxis,S=s.reference[h]+s.reference[v]-y.mainAxis;p<N?p=N:p>S&&(p=S)}if(u){var g,w;const v=h==="y"?"width":"height",N=zae.has(jd(i)),S=s.reference[f]-s.floating[v]+(N&&((g=a.offset)==null?void 0:g[f])||0)+(N?0:y.crossAxis),_=s.reference[f]+s.reference[v]+(N?0:((w=a.offset)==null?void 0:w[f])||0)-(N?y.crossAxis:0);m<S?m=S:m>_&&(m=_)}return{[h]:p,[f]:m}}}},HOe=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:i,rects:s,platform:a,elements:l}=e,{apply:c=()=>{},...u}=Nd(t,e),d=await q1(e,u),f=jd(i),h=E0(i),p=zc(i)==="y",{width:m,height:x}=s.floating;let y,g;f==="top"||f==="bottom"?(y=f,g=h===(await(a.isRTL==null?void 0:a.isRTL(l.floating))?"start":"end")?"left":"right"):(g=f,y=h==="end"?"top":"bottom");const w=x-d.top-d.bottom,v=m-d.left-d.right,N=Th(x-d[y],w),S=Th(m-d[g],v),_=!e.middlewareData.shift;let j=N,A=S;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(A=v),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(j=w),_&&!h){const k=uo(d.left,0),M=uo(d.right,0),I=uo(d.top,0),R=uo(d.bottom,0);p?A=m-2*(k!==0||M!==0?k+M:uo(d.left,d.right)):j=x-2*(I!==0||R!==0?I+R:uo(d.top,d.bottom))}await c({...e,availableWidth:A,availableHeight:j});const C=await a.getDimensions(l.floating);return m!==C.width||x!==C.height?{reset:{rects:!0}}:{}}}};function MT(){return typeof window<"u"}function A0(t){return Bae(t)?(t.nodeName||"").toLowerCase():"#document"}function wo(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function gu(t){var e;return(e=(Bae(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Bae(t){return MT()?t instanceof Node||t instanceof wo(t).Node:!1}function fc(t){return MT()?t instanceof Element||t instanceof wo(t).Element:!1}function au(t){return MT()?t instanceof HTMLElement||t instanceof wo(t).HTMLElement:!1}function IH(t){return!MT()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof wo(t).ShadowRoot}const WOe=new Set(["inline","contents"]);function AS(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=hc(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!WOe.has(i)}const GOe=new Set(["table","td","th"]);function qOe(t){return GOe.has(A0(t))}const KOe=[":popover-open",":modal"];function PT(t){return KOe.some(e=>{try{return t.matches(e)}catch{return!1}})}const YOe=["transform","translate","scale","rotate","perspective"],XOe=["transform","translate","scale","rotate","perspective","filter"],QOe=["paint","layout","strict","content"];function Wz(t){const e=Gz(),n=fc(t)?hc(t):t;return YOe.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||XOe.some(r=>(n.willChange||"").includes(r))||QOe.some(r=>(n.contain||"").includes(r))}function JOe(t){let e=Mh(t);for(;au(e)&&!uv(e);){if(Wz(e))return e;if(PT(e))return null;e=Mh(e)}return null}function Gz(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const ZOe=new Set(["html","body","#document"]);function uv(t){return ZOe.has(A0(t))}function hc(t){return wo(t).getComputedStyle(t)}function OT(t){return fc(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Mh(t){if(A0(t)==="html")return t;const e=t.assignedSlot||t.parentNode||IH(t)&&t.host||gu(t);return IH(e)?e.host:e}function Vae(t){const e=Mh(t);return uv(e)?t.ownerDocument?t.ownerDocument.body:t.body:au(e)&&AS(e)?e:Vae(e)}function K1(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=Vae(t),s=i===((r=t.ownerDocument)==null?void 0:r.body),a=wo(i);if(s){const l=eL(a);return e.concat(a,a.visualViewport||[],AS(i)?i:[],l&&n?K1(l):[])}return e.concat(i,K1(i,[],n))}function eL(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Hae(t){const e=hc(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=au(t),s=i?t.offsetWidth:n,a=i?t.offsetHeight:r,l=n2(n)!==s||n2(r)!==a;return l&&(n=s,r=a),{width:n,height:r,$:l}}function qz(t){return fc(t)?t:t.contextElement}function Cy(t){const e=qz(t);if(!au(e))return Yc(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:s}=Hae(e);let a=(s?n2(n.width):n.width)/r,l=(s?n2(n.height):n.height)/i;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const eRe=Yc(0);function Wae(t){const e=wo(t);return!Gz()||!e.visualViewport?eRe:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function tRe(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==wo(t)?!1:e}function Vm(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),s=qz(t);let a=Yc(1);e&&(r?fc(r)&&(a=Cy(r)):a=Cy(t));const l=tRe(s,n,r)?Wae(s):Yc(0);let c=(i.left+l.x)/a.x,u=(i.top+l.y)/a.y,d=i.width/a.x,f=i.height/a.y;if(s){const h=wo(s),p=r&&fc(r)?wo(r):r;let m=h,x=eL(m);for(;x&&r&&p!==m;){const y=Cy(x),g=x.getBoundingClientRect(),w=hc(x),v=g.left+(x.clientLeft+parseFloat(w.paddingLeft))*y.x,N=g.top+(x.clientTop+parseFloat(w.paddingTop))*y.y;c*=y.x,u*=y.y,d*=y.x,f*=y.y,c+=v,u+=N,m=wo(x),x=eL(m)}}return i2({width:d,height:f,x:c,y:u})}function RT(t,e){const n=OT(t).scrollLeft;return e?e.left+n:Vm(gu(t)).left+n}function Gae(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-RT(t,n),i=n.top+e.scrollTop;return{x:r,y:i}}function nRe(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const s=i==="fixed",a=gu(r),l=e?PT(e.floating):!1;if(r===a||l&&s)return n;let c={scrollLeft:0,scrollTop:0},u=Yc(1);const d=Yc(0),f=au(r);if((f||!f&&!s)&&((A0(r)!=="body"||AS(a))&&(c=OT(r)),au(r))){const p=Vm(r);u=Cy(r),d.x=p.x+r.clientLeft,d.y=p.y+r.clientTop}const h=a&&!f&&!s?Gae(a,c):Yc(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x+h.x,y:n.y*u.y-c.scrollTop*u.y+d.y+h.y}}function rRe(t){return Array.from(t.getClientRects())}function iRe(t){const e=gu(t),n=OT(t),r=t.ownerDocument.body,i=uo(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=uo(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+RT(t);const l=-n.scrollTop;return hc(r).direction==="rtl"&&(a+=uo(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:a,y:l}}const DH=25;function sRe(t,e){const n=wo(t),r=gu(t),i=n.visualViewport;let s=r.clientWidth,a=r.clientHeight,l=0,c=0;if(i){s=i.width,a=i.height;const d=Gz();(!d||d&&e==="fixed")&&(l=i.offsetLeft,c=i.offsetTop)}const u=RT(r);if(u<=0){const d=r.ownerDocument,f=d.body,h=getComputedStyle(f),p=d.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,m=Math.abs(r.clientWidth-f.clientWidth-p);m<=DH&&(s-=m)}else u<=DH&&(s+=u);return{width:s,height:a,x:l,y:c}}const aRe=new Set(["absolute","fixed"]);function oRe(t,e){const n=Vm(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,s=au(t)?Cy(t):Yc(1),a=t.clientWidth*s.x,l=t.clientHeight*s.y,c=i*s.x,u=r*s.y;return{width:a,height:l,x:c,y:u}}function LH(t,e,n){let r;if(e==="viewport")r=sRe(t,n);else if(e==="document")r=iRe(gu(t));else if(fc(e))r=oRe(e,n);else{const i=Wae(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return i2(r)}function qae(t,e){const n=Mh(t);return n===e||!fc(n)||uv(n)?!1:hc(n).position==="fixed"||qae(n,e)}function lRe(t,e){const n=e.get(t);if(n)return n;let r=K1(t,[],!1).filter(l=>fc(l)&&A0(l)!=="body"),i=null;const s=hc(t).position==="fixed";let a=s?Mh(t):t;for(;fc(a)&&!uv(a);){const l=hc(a),c=Wz(a);!c&&l.position==="fixed"&&(i=null),(s?!c&&!i:!c&&l.position==="static"&&!!i&&aRe.has(i.position)||AS(a)&&!c&&qae(t,a))?r=r.filter(d=>d!==a):i=l,a=Mh(a)}return e.set(t,r),r}function cRe(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const a=[...n==="clippingAncestors"?PT(e)?[]:lRe(e,this._c):[].concat(n),r],l=a[0],c=a.reduce((u,d)=>{const f=LH(e,d,i);return u.top=uo(f.top,u.top),u.right=Th(f.right,u.right),u.bottom=Th(f.bottom,u.bottom),u.left=uo(f.left,u.left),u},LH(e,l,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function uRe(t){const{width:e,height:n}=Hae(t);return{width:e,height:n}}function dRe(t,e,n){const r=au(e),i=gu(e),s=n==="fixed",a=Vm(t,!0,s,e);let l={scrollLeft:0,scrollTop:0};const c=Yc(0);function u(){c.x=RT(i)}if(r||!r&&!s)if((A0(e)!=="body"||AS(i))&&(l=OT(e)),r){const p=Vm(e,!0,s,e);c.x=p.x+e.clientLeft,c.y=p.y+e.clientTop}else i&&u();s&&!r&&i&&u();const d=i&&!r&&!s?Gae(i,l):Yc(0),f=a.left+l.scrollLeft-c.x-d.x,h=a.top+l.scrollTop-c.y-d.y;return{x:f,y:h,width:a.width,height:a.height}}function _R(t){return hc(t).position==="static"}function $H(t,e){if(!au(t)||hc(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return gu(t)===n&&(n=n.ownerDocument.body),n}function Kae(t,e){const n=wo(t);if(PT(t))return n;if(!au(t)){let i=Mh(t);for(;i&&!uv(i);){if(fc(i)&&!_R(i))return i;i=Mh(i)}return n}let r=$H(t,e);for(;r&&qOe(r)&&_R(r);)r=$H(r,e);return r&&uv(r)&&_R(r)&&!Wz(r)?n:r||JOe(t)||n}const fRe=async function(t){const e=this.getOffsetParent||Kae,n=this.getDimensions,r=await n(t.floating);return{reference:dRe(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function hRe(t){return hc(t).direction==="rtl"}const pRe={convertOffsetParentRelativeRectToViewportRelativeRect:nRe,getDocumentElement:gu,getClippingRect:cRe,getOffsetParent:Kae,getElementRects:fRe,getClientRects:rRe,getDimensions:uRe,getScale:Cy,isElement:fc,isRTL:hRe};function Yae(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function mRe(t,e){let n=null,r;const i=gu(t);function s(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function a(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),s();const u=t.getBoundingClientRect(),{left:d,top:f,width:h,height:p}=u;if(l||e(),!h||!p)return;const m=nj(f),x=nj(i.clientWidth-(d+h)),y=nj(i.clientHeight-(f+p)),g=nj(d),v={rootMargin:-m+"px "+-x+"px "+-y+"px "+-g+"px",threshold:uo(0,Th(1,c))||1};let N=!0;function S(_){const j=_[0].intersectionRatio;if(j!==c){if(!N)return a();j?a(!1,j):r=setTimeout(()=>{a(!1,1e-7)},1e3)}j===1&&!Yae(u,t.getBoundingClientRect())&&a(),N=!1}try{n=new IntersectionObserver(S,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(S,v)}n.observe(t)}return a(!0),s}function gRe(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=qz(t),d=i||s?[...u?K1(u):[],...K1(e)]:[];d.forEach(g=>{i&&g.addEventListener("scroll",n,{passive:!0}),s&&g.addEventListener("resize",n)});const f=u&&l?mRe(u,n):null;let h=-1,p=null;a&&(p=new ResizeObserver(g=>{let[w]=g;w&&w.target===u&&p&&(p.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var v;(v=p)==null||v.observe(e)})),n()}),u&&!c&&p.observe(u),p.observe(e));let m,x=c?Vm(t):null;c&&y();function y(){const g=Vm(t);x&&!Yae(x,g)&&n(),x=g,m=requestAnimationFrame(y)}return n(),()=>{var g;d.forEach(w=>{i&&w.removeEventListener("scroll",n),s&&w.removeEventListener("resize",n)}),f==null||f(),(g=p)==null||g.disconnect(),p=null,c&&cancelAnimationFrame(m)}}const xRe=zOe,yRe=BOe,vRe=$Oe,bRe=HOe,wRe=FOe,FH=LOe,_Re=VOe,SRe=(t,e,n)=>{const r=new Map,i={platform:pRe,...n},s={...i.platform,_c:r};return DOe(t,e,{...i,platform:s})};var NRe=typeof document<"u",jRe=function(){},qC=NRe?b.useLayoutEffect:jRe;function s2(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!s2(t[r],e[r]))return!1;return!0}if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&t.$$typeof)&&!s2(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function Xae(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function UH(t,e){const n=Xae(t);return Math.round(e*n)/n}function SR(t){const e=b.useRef(t);return qC(()=>{e.current=t}),e}function CRe(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:a}={},transform:l=!0,whileElementsMounted:c,open:u}=t,[d,f]=b.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[h,p]=b.useState(r);s2(h,r)||p(r);const[m,x]=b.useState(null),[y,g]=b.useState(null),w=b.useCallback(T=>{T!==_.current&&(_.current=T,x(T))},[]),v=b.useCallback(T=>{T!==j.current&&(j.current=T,g(T))},[]),N=s||m,S=a||y,_=b.useRef(null),j=b.useRef(null),A=b.useRef(d),C=c!=null,k=SR(c),M=SR(i),I=SR(u),R=b.useCallback(()=>{if(!_.current||!j.current)return;const T={placement:e,strategy:n,middleware:h};M.current&&(T.platform=M.current),SRe(_.current,j.current,T).then(D=>{const F={...D,isPositioned:I.current!==!1};E.current&&!s2(A.current,F)&&(A.current=F,wl.flushSync(()=>{f(F)}))})},[h,e,n,M,I]);qC(()=>{u===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,f(T=>({...T,isPositioned:!1})))},[u]);const E=b.useRef(!1);qC(()=>(E.current=!0,()=>{E.current=!1}),[]),qC(()=>{if(N&&(_.current=N),S&&(j.current=S),N&&S){if(k.current)return k.current(N,S,R);R()}},[N,S,R,k,C]);const P=b.useMemo(()=>({reference:_,floating:j,setReference:w,setFloating:v}),[w,v]),O=b.useMemo(()=>({reference:N,floating:S}),[N,S]),L=b.useMemo(()=>{const T={position:n,left:0,top:0};if(!O.floating)return T;const D=UH(O.floating,d.x),F=UH(O.floating,d.y);return l?{...T,transform:"translate("+D+"px, "+F+"px)",...Xae(O.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:D,top:F}},[n,l,O.floating,d.x,d.y]);return b.useMemo(()=>({...d,update:R,refs:P,elements:O,floatingStyles:L}),[d,R,P,O,L])}const kRe=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:i}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?FH({element:r.current,padding:i}).fn(n):{}:r?FH({element:r,padding:i}).fn(n):{}}}},ERe=(t,e)=>({...xRe(t),options:[t,e]}),ARe=(t,e)=>({...yRe(t),options:[t,e]}),TRe=(t,e)=>({..._Re(t),options:[t,e]}),MRe=(t,e)=>({...vRe(t),options:[t,e]}),PRe=(t,e)=>({...bRe(t),options:[t,e]}),ORe=(t,e)=>({...wRe(t),options:[t,e]}),RRe=(t,e)=>({...kRe(t),options:[t,e]});function IRe(t){const e=DRe(t),n=b.forwardRef((r,i)=>{const{children:s,...a}=r,l=b.Children.toArray(s),c=l.find($Re);if(c){const u=c.props.children,d=l.map(f=>f===c?b.Children.count(u)>1?b.Children.only(null):b.isValidElement(u)?u.props.children:null:f);return o.jsx(e,{...a,ref:i,children:b.isValidElement(u)?b.cloneElement(u,void 0,d):null})}return o.jsx(e,{...a,ref:i,children:s})});return n.displayName=`${t}.Slot`,n}function DRe(t){const e=b.forwardRef((n,r)=>{const{children:i,...s}=n;if(b.isValidElement(i)){const a=URe(i),l=FRe(s,i.props);return i.type!==b.Fragment&&(l.ref=r?Ir(r,a):a),b.cloneElement(i,l)}return b.Children.count(i)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var LRe=Symbol("radix.slottable");function $Re(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===LRe}function FRe(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...l)=>{const c=s(...l);return i(...l),c}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function URe(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var zRe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],BRe=zRe.reduce((t,e)=>{const n=IRe(`Primitive.${e}`),r=b.forwardRef((i,s)=>{const{asChild:a,...l}=i,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),VRe="Arrow",Qae=b.forwardRef((t,e)=>{const{children:n,width:r=10,height:i=5,...s}=t;return o.jsx(BRe.svg,{...s,ref:e,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:o.jsx("polygon",{points:"0,0 30,0 15,10"})})});Qae.displayName=VRe;var HRe=Qae;function WRe(t,e=[]){let n=[];function r(s,a){const l=b.createContext(a),c=n.length;n=[...n,a];const u=f=>{var g;const{scope:h,children:p,...m}=f,x=((g=h==null?void 0:h[t])==null?void 0:g[c])||l,y=b.useMemo(()=>m,Object.values(m));return o.jsx(x.Provider,{value:y,children:p})};u.displayName=s+"Provider";function d(f,h){var x;const p=((x=h==null?void 0:h[t])==null?void 0:x[c])||l,m=b.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[u,d]}const i=()=>{const s=n.map(a=>b.createContext(a));return function(l){const c=(l==null?void 0:l[t])||s;return b.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return i.scopeName=t,[r,GRe(i,...e)]}function GRe(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const a=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...l,...f}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return n.scopeName=e.scopeName,n}function qRe(t){const e=KRe(t),n=b.forwardRef((r,i)=>{const{children:s,...a}=r,l=b.Children.toArray(s),c=l.find(XRe);if(c){const u=c.props.children,d=l.map(f=>f===c?b.Children.count(u)>1?b.Children.only(null):b.isValidElement(u)?u.props.children:null:f);return o.jsx(e,{...a,ref:i,children:b.isValidElement(u)?b.cloneElement(u,void 0,d):null})}return o.jsx(e,{...a,ref:i,children:s})});return n.displayName=`${t}.Slot`,n}function KRe(t){const e=b.forwardRef((n,r)=>{const{children:i,...s}=n;if(b.isValidElement(i)){const a=JRe(i),l=QRe(s,i.props);return i.type!==b.Fragment&&(l.ref=r?Ir(r,a):a),b.cloneElement(i,l)}return b.Children.count(i)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var YRe=Symbol("radix.slottable");function XRe(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===YRe}function QRe(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...l)=>{const c=s(...l);return i(...l),c}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function JRe(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var ZRe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Jae=ZRe.reduce((t,e)=>{const n=qRe(`Primitive.${e}`),r=b.forwardRef((i,s)=>{const{asChild:a,...l}=i,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function Zae(t){const[e,n]=b.useState(void 0);return ts(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let a,l;if("borderBoxSize"in s){const c=s.borderBoxSize,u=Array.isArray(c)?c[0]:c;a=u.inlineSize,l=u.blockSize}else a=t.offsetWidth,l=t.offsetHeight;n({width:a,height:l})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var Kz="Popper",[eoe,xu]=WRe(Kz),[eIe,toe]=eoe(Kz),noe=t=>{const{__scopePopper:e,children:n}=t,[r,i]=b.useState(null);return o.jsx(eIe,{scope:e,anchor:r,onAnchorChange:i,children:n})};noe.displayName=Kz;var roe="PopperAnchor",ioe=b.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...i}=t,s=toe(roe,n),a=b.useRef(null),l=Pn(e,a),c=b.useRef(null);return b.useEffect(()=>{const u=c.current;c.current=(r==null?void 0:r.current)||a.current,u!==c.current&&s.onAnchorChange(c.current)}),r?null:o.jsx(Jae.div,{...i,ref:l})});ioe.displayName=roe;var Yz="PopperContent",[tIe,nIe]=eoe(Yz),soe=b.forwardRef((t,e)=>{var K,ee,V,J,Y,$;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:a=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:m,...x}=t,y=toe(Yz,n),[g,w]=b.useState(null),v=Pn(e,fe=>w(fe)),[N,S]=b.useState(null),_=Zae(N),j=(_==null?void 0:_.width)??0,A=(_==null?void 0:_.height)??0,C=r+(s!=="center"?"-"+s:""),k=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},M=Array.isArray(u)?u:[u],I=M.length>0,R={padding:k,boundary:M.filter(iIe),altBoundary:I},{refs:E,floatingStyles:P,placement:O,isPositioned:L,middlewareData:T}=CRe({strategy:"fixed",placement:C,whileElementsMounted:(...fe)=>gRe(...fe,{animationFrame:p==="always"}),elements:{reference:y.anchor},middleware:[ERe({mainAxis:i+A,alignmentAxis:a}),c&&ARe({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?TRe():void 0,...R}),c&&MRe({...R}),PRe({...R,apply:({elements:fe,rects:ce,availableWidth:ve,availableHeight:X})=>{const{width:de,height:Te}=ce.reference,Pe=fe.floating.style;Pe.setProperty("--radix-popper-available-width",`${ve}px`),Pe.setProperty("--radix-popper-available-height",`${X}px`),Pe.setProperty("--radix-popper-anchor-width",`${de}px`),Pe.setProperty("--radix-popper-anchor-height",`${Te}px`)}}),N&&RRe({element:N,padding:l}),sIe({arrowWidth:j,arrowHeight:A}),h&&ORe({strategy:"referenceHidden",...R})]}),[D,F]=loe(O),q=dc(m);ts(()=>{L&&(q==null||q())},[L,q]);const B=(K=T.arrow)==null?void 0:K.x,z=(ee=T.arrow)==null?void 0:ee.y,H=((V=T.arrow)==null?void 0:V.centerOffset)!==0,[W,G]=b.useState();return ts(()=>{g&&G(window.getComputedStyle(g).zIndex)},[g]),o.jsx("div",{ref:E.setFloating,"data-radix-popper-content-wrapper":"",style:{...P,transform:L?P.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:W,"--radix-popper-transform-origin":[(J=T.transformOrigin)==null?void 0:J.x,(Y=T.transformOrigin)==null?void 0:Y.y].join(" "),...(($=T.hide)==null?void 0:$.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:o.jsx(tIe,{scope:n,placedSide:D,onArrowChange:S,arrowX:B,arrowY:z,shouldHideArrow:H,children:o.jsx(Jae.div,{"data-side":D,"data-align":F,...x,ref:v,style:{...x.style,animation:L?void 0:"none"}})})})});soe.displayName=Yz;var aoe="PopperArrow",rIe={top:"bottom",right:"left",bottom:"top",left:"right"},ooe=b.forwardRef(function(e,n){const{__scopePopper:r,...i}=e,s=nIe(aoe,r),a=rIe[s.placedSide];return o.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:o.jsx(HRe,{...i,ref:n,style:{...i.style,display:"block"}})})});ooe.displayName=aoe;function iIe(t){return t!==null}var sIe=t=>({name:"transformOrigin",options:t,fn(e){var y,g,w;const{placement:n,rects:r,middlewareData:i}=e,a=((y=i.arrow)==null?void 0:y.centerOffset)!==0,l=a?0:t.arrowWidth,c=a?0:t.arrowHeight,[u,d]=loe(n),f={start:"0%",center:"50%",end:"100%"}[d],h=(((g=i.arrow)==null?void 0:g.x)??0)+l/2,p=(((w=i.arrow)==null?void 0:w.y)??0)+c/2;let m="",x="";return u==="bottom"?(m=a?f:`${h}px`,x=`${-c}px`):u==="top"?(m=a?f:`${h}px`,x=`${r.floating.height+c}px`):u==="right"?(m=`${-c}px`,x=a?f:`${p}px`):u==="left"&&(m=`${r.floating.width+c}px`,x=a?f:`${p}px`),{data:{x:m,y:x}}}});function loe(t){const[e,n="center"]=t.split("-");return[e,n]}var TS=noe,T0=ioe,MS=soe,PS=ooe;function coe(t){const e=aIe(t),n=b.forwardRef((r,i)=>{const{children:s,...a}=r,l=b.Children.toArray(s),c=l.find(lIe);if(c){const u=c.props.children,d=l.map(f=>f===c?b.Children.count(u)>1?b.Children.only(null):b.isValidElement(u)?u.props.children:null:f);return o.jsx(e,{...a,ref:i,children:b.isValidElement(u)?b.cloneElement(u,void 0,d):null})}return o.jsx(e,{...a,ref:i,children:s})});return n.displayName=`${t}.Slot`,n}function aIe(t){const e=b.forwardRef((n,r)=>{const{children:i,...s}=n;if(b.isValidElement(i)){const a=uIe(i),l=cIe(s,i.props);return i.type!==b.Fragment&&(l.ref=r?Ir(r,a):a),b.cloneElement(i,l)}return b.Children.count(i)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var oIe=Symbol("radix.slottable");function lIe(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===oIe}function cIe(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...l)=>{const c=s(...l);return i(...l),c}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function uIe(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var dIe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],uoe=dIe.reduce((t,e)=>{const n=coe(`Primitive.${e}`),r=b.forwardRef((i,s)=>{const{asChild:a,...l}=i,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),IT="Popover",[doe]=SOe(IT,[xu]),OS=xu(),[fIe,Qh]=doe(IT),foe=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:a=!1}=t,l=OS(e),c=b.useRef(null),[u,d]=b.useState(!1),[f,h]=su({prop:r,defaultProp:i??!1,onChange:s,caller:IT});return o.jsx(TS,{...l,children:o.jsx(fIe,{scope:e,contentId:ys(),triggerRef:c,open:f,onOpenChange:h,onOpenToggle:b.useCallback(()=>h(p=>!p),[h]),hasCustomAnchor:u,onCustomAnchorAdd:b.useCallback(()=>d(!0),[]),onCustomAnchorRemove:b.useCallback(()=>d(!1),[]),modal:a,children:n})})};foe.displayName=IT;var hoe="PopoverAnchor",hIe=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=Qh(hoe,n),s=OS(n),{onCustomAnchorAdd:a,onCustomAnchorRemove:l}=i;return b.useEffect(()=>(a(),()=>l()),[a,l]),o.jsx(T0,{...s,...r,ref:e})});hIe.displayName=hoe;var poe="PopoverTrigger",moe=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=Qh(poe,n),s=OS(n),a=Pn(e,i.triggerRef),l=o.jsx(uoe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":boe(i.open),...r,ref:a,onClick:at(t.onClick,i.onOpenToggle)});return i.hasCustomAnchor?l:o.jsx(T0,{asChild:!0,...s,children:l})});moe.displayName=poe;var Xz="PopoverPortal",[pIe,mIe]=doe(Xz,{forceMount:void 0}),goe=t=>{const{__scopePopover:e,forceMount:n,children:r,container:i}=t,s=Qh(Xz,e);return o.jsx(pIe,{scope:e,forceMount:n,children:o.jsx(Na,{present:n||s.open,children:o.jsx(Sg,{asChild:!0,container:i,children:r})})})};goe.displayName=Xz;var dv="PopoverContent",xoe=b.forwardRef((t,e)=>{const n=mIe(dv,t.__scopePopover),{forceMount:r=n.forceMount,...i}=t,s=Qh(dv,t.__scopePopover);return o.jsx(Na,{present:r||s.open,children:s.modal?o.jsx(xIe,{...i,ref:e}):o.jsx(yIe,{...i,ref:e})})});xoe.displayName=dv;var gIe=coe("PopoverContent.RemoveScroll"),xIe=b.forwardRef((t,e)=>{const n=Qh(dv,t.__scopePopover),r=b.useRef(null),i=Pn(e,r),s=b.useRef(!1);return b.useEffect(()=>{const a=r.current;if(a)return jT(a)},[]),o.jsx(kS,{as:gIe,allowPinchZoom:!0,children:o.jsx(yoe,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:at(t.onCloseAutoFocus,a=>{var l;a.preventDefault(),s.current||(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:at(t.onPointerDownOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;s.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:at(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),yIe=b.forwardRef((t,e)=>{const n=Qh(dv,t.__scopePopover),r=b.useRef(!1),i=b.useRef(!1);return o.jsx(yoe,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var a,l;(a=t.onCloseAutoFocus)==null||a.call(t,s),s.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{var c,u;(c=t.onInteractOutside)==null||c.call(t,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const a=s.target;((u=n.triggerRef.current)==null?void 0:u.contains(a))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),yoe=b.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onInteractOutside:d,...f}=t,h=Qh(dv,n),p=OS(n);return ST(),o.jsx(jS,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:o.jsx(_g,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:d,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onDismiss:()=>h.onOpenChange(!1),children:o.jsx(MS,{"data-state":boe(h.open),role:"dialog",id:h.contentId,...p,...f,ref:e,style:{...f.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)"}})})})}),voe="PopoverClose",vIe=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=Qh(voe,n);return o.jsx(uoe.button,{type:"button",...r,ref:e,onClick:at(t.onClick,()=>i.onOpenChange(!1))})});vIe.displayName=voe;var bIe="PopoverArrow",wIe=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=OS(n);return o.jsx(PS,{...i,...r,ref:e})});wIe.displayName=bIe;function boe(t){return t?"open":"closed"}var _Ie=foe,SIe=moe,NIe=goe,woe=xoe;const ou=_Ie,lu=SIe,pc=b.forwardRef(({className:t,align:e="center",sideOffset:n=4,...r},i)=>o.jsx(NIe,{children:o.jsx(woe,{ref:i,align:e,sideOffset:n,className:ne("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...r})}));pc.displayName=woe.displayName;function jIe(t,e=[]){let n=[];function r(s,a){const l=b.createContext(a);l.displayName=s+"Context";const c=n.length;n=[...n,a];const u=f=>{var g;const{scope:h,children:p,...m}=f,x=((g=h==null?void 0:h[t])==null?void 0:g[c])||l,y=b.useMemo(()=>m,Object.values(m));return o.jsx(x.Provider,{value:y,children:p})};u.displayName=s+"Provider";function d(f,h){var x;const p=((x=h==null?void 0:h[t])==null?void 0:x[c])||l,m=b.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[u,d]}const i=()=>{const s=n.map(a=>b.createContext(a));return function(l){const c=(l==null?void 0:l[t])||s;return b.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return i.scopeName=t,[r,CIe(i,...e)]}function CIe(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const a=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...l,...f}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return n.scopeName=e.scopeName,n}function kIe(){return hT.useSyncExternalStore(EIe,()=>!0,()=>!1)}function EIe(){return()=>{}}var Qz="Avatar",[AIe]=jIe(Qz),[TIe,_oe]=AIe(Qz),Soe=b.forwardRef((t,e)=>{const{__scopeAvatar:n,...r}=t,[i,s]=b.useState("idle");return o.jsx(TIe,{scope:n,imageLoadingStatus:i,onImageLoadingStatusChange:s,children:o.jsx(_l.span,{...r,ref:e})})});Soe.displayName=Qz;var Noe="AvatarImage",joe=b.forwardRef((t,e)=>{const{__scopeAvatar:n,src:r,onLoadingStatusChange:i=()=>{},...s}=t,a=_oe(Noe,n),l=MIe(r,s),c=dc(u=>{i(u),a.onImageLoadingStatusChange(u)});return ts(()=>{l!=="idle"&&c(l)},[l,c]),l==="loaded"?o.jsx(_l.img,{...s,ref:e,src:r}):null});joe.displayName=Noe;var Coe="AvatarFallback",koe=b.forwardRef((t,e)=>{const{__scopeAvatar:n,delayMs:r,...i}=t,s=_oe(Coe,n),[a,l]=b.useState(r===void 0);return b.useEffect(()=>{if(r!==void 0){const c=window.setTimeout(()=>l(!0),r);return()=>window.clearTimeout(c)}},[r]),a&&s.imageLoadingStatus!=="loaded"?o.jsx(_l.span,{...i,ref:e}):null});koe.displayName=Coe;function zH(t,e){return t?e?(t.src!==e&&(t.src=e),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function MIe(t,{referrerPolicy:e,crossOrigin:n}){const r=kIe(),i=b.useRef(null),s=r?(i.current||(i.current=new window.Image),i.current):null,[a,l]=b.useState(()=>zH(s,t));return ts(()=>{l(zH(s,t))},[s,t]),ts(()=>{const c=f=>()=>{l(f)};if(!s)return;const u=c("loaded"),d=c("error");return s.addEventListener("load",u),s.addEventListener("error",d),e&&(s.referrerPolicy=e),typeof n=="string"&&(s.crossOrigin=n),()=>{s.removeEventListener("load",u),s.removeEventListener("error",d)}},[s,n,e]),a}var Eoe=Soe,Aoe=joe,Toe=koe;const RS=b.forwardRef(({className:t,...e},n)=>o.jsx(Eoe,{ref:n,className:ne("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...e}));RS.displayName=Eoe.displayName;const IS=b.forwardRef(({className:t,...e},n)=>o.jsx(Aoe,{ref:n,className:ne("aspect-square h-full w-full",t),...e}));IS.displayName=Aoe.displayName;const DS=b.forwardRef(({className:t,...e},n)=>o.jsx(Toe,{ref:n,className:ne("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...e}));DS.displayName=Toe.displayName;function PIe(){var N,S;const{user:t,profile:e,refreshProfile:n}=Rr(),[r,i]=b.useState(!1),[s,a]=b.useState(!1),[l,c]=b.useState(!1),[u,d]=b.useState(""),f=b.useRef(null),[h,p]=b.useState({fullName:"",timezone:"Europe/Berlin"});b.useEffect(()=>{e&&p({fullName:e.fullName||"",timezone:e.timezone||"Europe/Berlin"})},[e]);const{data:m=[]}=KPe(),x=b.useMemo(()=>{const _=u.toLowerCase();return _?m.filter(j=>j.id.toLowerCase().includes(_)||j.label.toLowerCase().includes(_)):m.slice(0,20)},[u,m]),y=async()=>
770{if(!h.fullName.trim()){ge.error("Full name is required");return}i(!0);try{await Ce.patch("/users/me",{fullName:h.fullName.trim(),timezone:h.timezone}),await n(),ge.success("Profile updated successfully")}catch(_){ge.error(_.message||"Failed to update profile")}finally{i(!1)}},g=async _=>{var A;const j=(A=_.target.files)==null?void 0:A[0];if(j){if(!j.type.startsWith("image/")){ge.error("Please select an image file");return}if(j.size>5*1024*1024){ge.error("Image must be less than 5MB");return}a(!0);try{const C=new FileReader,k=new Promise((I,R)=>{C.onload=()=>I(C.result),C.onerror=R});C.readAsDataURL(j);const M=await k;await Ce.post("/users/me/avatar",{image:M}),await n(),ge.success("Avatar updated successfully")}catch(C){ge.error(C.message||"Failed to upload avatar")}finally{a(!1),f.current&&(f.current.value="")}}},w=h.fullName!==((e==null?void 0:e.fullName)||"")||h.timezone!==((e==null?void 0:e.timezone)||"Europe/Berlin"),v=((N=e==null?void 0:e.fullName)==null?void 0:N.split(" ").map(_=>_[0]).join("").toUpperCase().slice(0,2))||"U";return o.jsxs("div",{children:[o.jsxs("div",{className:"space-y-4 px-6 py-3 border-b",children:[o.jsx(et,{children:"Profile Photo"}),o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsxs(RS,{className:"h-20 w-20",children:[o.jsx(IS,{src:(e==null?void 0:e.avatarUrl)||void 0,alt:(e==null?void 0:e.fullName)||"User"}),o.jsx(DS,{className:"text-lg",children:v})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("input",{ref:f,type:"file",accept:"image/*",onChange:g,className:"hidden"}),o.jsxs(le,{variant:"outline",size:"sm",onClick:()=>{var _;return(_=f.current)==null?void 0:_.click()},disabled:s,children:[s?o.jsx(Me,{className:"mr-2 h-4 w-4 animate-spin"}):o.jsx(G1,{className:"mr-2 h-4 w-4"}),"Upload Photo"]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"JPG, PNG or GIF. Max 5MB."})]})]})]}),o.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 border-b px-6 py-3",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{htmlFor:"firstName",children:"First Name"}),o.jsx(gt,{id:"firstName",value:h.fullName.split(" ")[0]||"",onChange:_=>{const j=h.fullName.split(" ").slice(1).join(" ");p({...h,fullName:`${_.target.value}${j?" "+j:""}`})},placeholder:"John"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{htmlFor:"lastName",children:"Last Name"}),o.jsx(gt,{id:"lastName",value:h.fullName.split(" ").slice(1).join(" ")||"",onChange:_=>{const j=h.fullName.split(" ")[0]||"";p({...h,fullName:`${j}${_.target.value?" "+_.target.value:""}`})},placeholder:"Doe"})]})]}),o.jsxs("div",{className:"space-y-2 px-6 py-3 border-b",children:[o.jsx(et,{children:"Email"}),o.jsx(gt,{value:(t==null?void 0:t.email)||"",disabled:!0}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Contact support to change your email"})]}),o.jsxs("div",{className:"space-y-2 px-6 py-3 border-b",children:[o.jsx(et,{children:"Password"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(gt,{type:"password",value:"••••••••",disabled:!0,className:"flex-1"}),o.jsx(le,{variant:"outline",size:"sm",disabled:!0,children:"Change"})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Password change coming soon"})]}),o.jsxs("div",{className:"space-y-2 px-6 py-3 border-b",children:[o.jsx(et,{children:"Timezone"}),o.jsxs(ou,{open:l,onOpenChange:c,children:[o.jsx(lu,{asChild:!0,children:o.jsxs(le,{variant:"outline",role:"combobox","aria-expanded":l,className:"w-full justify-between font-normal",children:[((S=m.find(_=>_.id===h.timezone))==null?void 0:S.label)||h.timezone||"Select timezone...",o.jsx(bg,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),o.jsx(pc,{className:"w-full p-0",align:"start",children:o.jsxs(Kh,{children:[o.jsx(Yh,{placeholder:"Search timezone...",value:u,onValueChange:d}),o.jsx(Xh,{children:"No timezone found."}),o.jsx(_d,{className:"max-h-64 overflow-y-auto",children:x.map(_=>o.jsxs(Sd,{value:_.id,onSelect:j=>{p({...h,timezone:j}),c(!1),d("")},children:[o.jsx(Sn,{className:ne("mr-2 h-4 w-4",h.timezone===_.id?"opacity-100":"opacity-0")}),_.label]},_.id))})]})})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Used for scheduling and time display"})]}),o.jsx("div",{className:"flex justify-end px-6 py-3",children:o.jsxs(le,{onClick:y,disabled:r||!w,children:[r?o.jsx(Me,{className:"mr-2 h-4 w-4 animate-spin"}):o.jsx(W1,{className:"mr-2 h-4 w-4"}),"Save changes"]})})]})}function OIe(t,e=[]){let n=[];function r(s,a){const l=b.createContext(a),c=n.length;n=[...n,a];const u=f=>{var g;const{scope:h,children:p,...m}=f,x=((g=h==null?void 0:h[t])==null?void 0:g[c])||l,y=b.useMemo(()=>m,Object.values(m));return o.jsx(x.Provider,{value:y,children:p})};u.displayName=s+"Provider";function d(f,h){var x;const p=((x=h==null?void 0:h[t])==null?void 0:x[c])||l,m=b.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[u,d]}const i=()=>{const s=n.map(a=>b.createContext(a));return function(l){const c=(l==null?void 0:l[t])||s;return b.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return i.scopeName=t,[r,RIe(i,...e)]}function RIe(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));
vendor: 4,543 bytes, line 770
770return function(s){const a=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...l,...f}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return n.scopeName=e.scopeName,n}function Moe(t){const e=b.useRef({value:t,previous:t});return b.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}function IIe(t){const e=DIe(t),n=b.forwardRef((r,i)=>{const{children:s,...a}=r,l=b.Children.toArray(s),c=l.find($Ie);if(c){const u=c.props.children,d=l.map(f=>f===c?b.Children.count(u)>1?b.Children.only(null):b.isValidElement(u)?u.props.children:null:f);return o.jsx(e,{...a,ref:i,children:b.isValidElement(u)?b.cloneElement(u,void 0,d):null})}return o.jsx(e,{...a,ref:i,children:s})});return n.displayName=`${t}.Slot`,n}function DIe(t){const e=b.forwardRef((n,r)=>{const{children:i,...s}=n;if(b.isValidElement(i)){const a=UIe(i),l=FIe(s,i.props);return i.type!==b.Fragment&&(l.ref=r?Ir(r,a):a),b.cloneElement(i,l)}return b.Children.count(i)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var LIe=Symbol("radix.slottable");function $Ie(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===LIe}function FIe(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...l)=>{const c=s(...l);return i(...l),c}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function UIe(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var zIe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Poe=zIe.reduce((t,e)=>{const n=IIe(`Primitive.${e}`),r=b.forwardRef((i,s)=>{const{asChild:a,...l}=i,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),DT="Switch",[BIe]=OIe(DT),[VIe,HIe]=BIe(DT),Ooe=b.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:i,defaultChecked:s,required:a,disabled:l,value:c="on",onCheckedChange:u,form:d,...f}=t,[h,p]=b.useState(null),m=Pn(e,v=>p(v)),x=b.useRef(!1),y=h?d||!!h.closest("form"):!0,[g,w]=su({prop:i,defaultProp:s??!1,onChange:u,caller:DT});return o.jsxs(VIe,{scope:n,checked:g,disabled:l,children:[o.jsx(Poe.button,{type:"button",role:"switch","aria-checked":g,"aria-required":a,"data-state":Loe(g),"data-disabled":l?"":void 0,disabled:l,value:c,...f,ref:m,onClick:at(t.onClick,v=>{w(N=>!N),y&&(x.current=v.isPropagationStopped(),x.current||v.stopPropagation())})}),y&&o.jsx(Doe,{control:h,bubbles:!x.current,name:r,value:c,checked:g,required:a,disabled:l,form:d,style:{transform:"translateX(-100%)"}})]})});Ooe.displayName=DT;var Roe="SwitchThumb",Ioe=b.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,i=HIe(Roe,n);return o.jsx(Poe.span,{"data-state":Loe(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:e})});Ioe.displayName=Roe;var WIe="SwitchBubbleInput",Doe=b.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...i},s)=>{const a=b.useRef(null),l=Pn(a,s),c=Moe(n),u=Zae(e);return b.useEffect(()=>{const d=a.current;if(!d)return;const f=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(f,"checked").set;if(c!==n&&p){const m=new Event("click",{bubbles:r});p.call(d,n),d.dispatchEvent(m)}},[c,n,r]),o.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:l,style:{...i.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Doe.displayName=WIe;function Loe(t){return t?"checked":"unchecked"}var $oe=Ooe,GIe=Ioe;const Zi=b.forwardRef(({className:t,...e},n)=>o.jsx($oe,{className:ne("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...e,ref:n,children:o.jsx(GIe,{className:ne("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")})}
770));Zi.displayName=$oe.displayName;function qIe(){const[t,e]=b.useState(!1),[n,r]=b.useState([{id:"rank_changes",title:"Rank Changes",description:"When your brand's position changes significantly",enabled:!0},{id:"new_competitors",title:"New Competitors",description:"When a new competitor is discovered",enabled:!0},{id:"mention_changes",title:"Mention Changes",description:"When your brand starts or stops being mentioned",enabled:!1},{id:"weekly_digest",title:"Weekly Digest",description:"A weekly summary of your AI visibility performance",enabled:!0},{id:"product_updates",title:"Product Updates",description:"News about new features and improvements",enabled:!0,comingSoon:!0},{id:"marketing_emails",title:"Marketing Emails",description:"Tips, best practices, and promotional content",enabled:!1,comingSoon:!0}]),i=a=>{r(l=>l.map(c=>c.id===a?{...c,enabled:!c.enabled}:c))},s=async()=>{e(!0);try{await new Promise(a=>setTimeout(a,500)),ge.success("Notification preferences saved")}catch(a){ge.error(a.message||"Failed to save preferences")}finally{e(!1)}};return o.jsxs("div",{className:"",children:[o.jsxs("div",{className:"space-y-4 px-6 py-3 border-b",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-sm font-medium",children:"Email Notifications"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose which events trigger email notifications"})]}),o.jsx("div",{className:"space-y-4",children:n.slice(0,4).map(a=>o.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-4",children:[o.jsxs("div",{className:"space-y-0.5 pr-4",children:[o.jsx(et,{htmlFor:a.id,className:"font-medium cursor-pointer",children:a.title}),o.jsx("p",{className:"text-sm text-muted-foreground",children:a.description})]}),o.jsx(Zi,{id:a.id,checked:a.enabled,onCheckedChange:()=>i(a.id),disabled:a.comingSoon})]},a.id))})]}),o.jsxs("div",{className:"space-y-4 px-6 py-3 border-b",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-sm font-medium",children:"Product Notifications"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Updates about the platform and marketing communications"})]}),o.jsx("div",{className:"space-y-4",children:n.slice(4).map(a=>o.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-4",children:[o.jsxs("div",{className:"space-y-0.5 pr-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(et,{htmlFor:a.id,className:"font-medium cursor-pointer",children:a.title}),a.comingSoon&&o.jsx("span",{className:"text-xs text-muted-foreground bg-muted px-2 py-0.5 rounded",children:"Coming soon"})]}),o.jsx("p",{className:"text-sm text-muted-foreground",children:a.description})]}),o.jsx(Zi,{id:a.id,checked:a.enabled,onCheckedChange:()=>i(a.id),disabled:a.comingSoon})]},a.id))})]}),o.jsx("div",{className:"flex justify-end pt-4 px-6 py-3",children:o.jsxs(le,{onClick:s,disabled:t,children:[t?o.jsx(Me,{className:"mr-2 h-4 w-4 animate-spin"}):o.jsx(W1,{className:"mr-2 h-4 w-4"}),"Save preferences"]})})]})}const NR=new Map;function Hn({src:t,alt:e,className:n,...r}){const[i,s]=b.useState(null),[a,l]=b.useState(!1),c=b.useRef(null),u=t==null?void 0:t.toLowerCase().endsWith(".svg");return b.useEffect(()=>{if(!u||!t)return;if(s(null),l(!1),NR.has(t)){s(NR.get(t));return}let d=!1;return fetch(t).then(f=>{if(!f.ok)throw new Error(`Failed to fetch SVG: ${f.status}`);return f.text()}).then(f=>{d||(NR.set(t,f),s(f))}).catch(()=>{d||l(!0)}),()=>{d=!0}},[t,u]),b.useEffect(()=>{if(!i||!c.current)return;const d=c.current.querySelector("svg");if(d){if(d.removeAttribute("width"),d.removeAttribute("height"),!d.getAttribute("viewBox")&&d.hasAttribute("width")&&d.hasAttribute("height")){const f=d.getAttribute("width"),h=d.getAttribute("height");f&&h&&d.setAttribute("viewBox",`0 0 ${f} ${h}`)}if(n){const f=n.split(/\s+/).filter(Boolean);d.classList.add(...f)}e?(d.setAttribute("role","img"),d.setAttribute("aria-label",e)):d.setAttribute("aria-hidden","true")}},[i,n,e]),!u||!t?o.jsx("img",{src:t,alt:e,className:n,...r}):a?o.jsx("img",{src:t,alt:e,className:n,...r}):i?o.jsx("span",{ref:c,className:"inline-flex items-center justify-center leading-[0] text-foreground",dangerouslySetInnerHTML:{__html:i}}):o.jsx("span",{className:ne("text-foreground",n)})}const Ct=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:ne("bg-card text-card-foreground",t),...e}));
770Ct.displayName="Card";const Lt=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:ne("flex flex-col space-y-1.5 p-6",t),...e}));Lt.displayName="CardHeader";const $t=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:ne("text-lg font-semibold leading-none tracking-tight",t),...e}));$t.displayName="CardTitle";const hh=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:ne("text-sm text-muted-foreground",t),...e}));hh.displayName="CardDescription";const Et=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:ne("p-6 pt-0",t),...e}));Et.displayName="CardContent";const KIe=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:ne("flex items-center p-6 pt-0",t),...e}));KIe.displayName="CardFooter";const YIe=$z("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 Ge({className:t,variant:e,...n}){return o.jsx("div",{className:ne(YIe({variant:e}),t),...n})}const BH=3.5,XIe=[10,25,50,100],VH=(t,e)=>new Intl.NumberFormat("en-US",{style:"currency",currency:e.toUpperCase(),minimumFractionDigits:0,maximumFractionDigits:0}).format(t),gb=t=>t.toLowerCase().replace(/[^a-z0-9]/g,""),QIe=t=>{const e=[];e.push({text:`${t.promptLimit} prompts/day`,included:!0});const n=t.promptLimit*30*3;return e.push({text:`${n.toLocaleString()} runs/month`,included:!0}),e.push({text:t.tokensPerMonth>0?`${t.tokensPerMonth} extra run tokens`:"No manual runs",included:t.tokensPerMonth>0}),e},JIe=t=>t.features.map(e=>{const n=e.value!==null&&e.value!==!1&&e.value!==0&&e.value!=="";return e.valueType==="boolean"?{text:e.name,included:e.value===!0}:e.valueType==="number"?{text:n?`${e.value} ${e.name}`:e.name,included:n}:e.valueType==="text"?{text:n?`${e.name}: ${e.value}`:e.name,included:n}:{text:e.name,included:!1}});function ZIe(){const{profile:t,refreshProfile:e}=Rr(),[n,r]=b.useState([]),[i,s]=b.useState(null),[a,l]=b.useState([]),[c,u]=b.useState(!0),[d,f]=b.useState(!1),[h,p]=b.useState(!1),[m,x]=b.useState("10"),[y,g]=b.useState(null),[w,v]=b.useState(!1),[N,S]=b.useState(!1);b.useEffect(()=>{_()},[]);const _=async()=>{try{const[T,D,F]=await Promise.all([Ce.get("/billing/plans"),Ce.get("/billing/subscription"),Ce.get("/public/platform-defaults")]);r(T),s(D),l(F)}catch(T){ge.error(T.message||"Failed to fetch billing data")}finally{u(!1)}},j=(T,D)=>{g({targetPlan:T,isDowngrade:D})},A=()=>{g(null),v(!1)},C=async()=>{if(!y)return;const{targetPlan:T,isDowngrade:D}=y,F=gb(T.name);v(!0);try{if(i!=null&&i.hasActiveSubscription)await Ce.post("/billing/update-subscription",{planId:F}),ge.success(D?"Plan downgraded successfully!":"Plan upgraded successfully!"),e(),_(),A();else{const q=await Ce.post("/billing/create-checkout",{planId:F,successUrl:`${window.location.origin}${window.location.pathname}?settings=billing&checkout=success`,cancelUrl:`${window.location.origin}${window.location.pathname}?settings=billing&checkout=canceled`});q.checkoutUrl&&(window.location.href=q.checkoutUrl)}}catch(q){ge.error(q.message||"Failed to update subscription"),v(!1)}},k=async(T,D)=>{if(T==="free")return;const F=n.find(q=>gb(q.name)===T);F&&j(F,D)},M=()=>{const T=(t==null?void 0:t.subscriptionTier)||"free",D=n.find(F=>gb(F.name)===T);return(D==null?void 0:D.price)??0},I=()=>{const T=(t==null?void 0:t.subscriptionTier)||"free",D=n.find(F=>gb(F.name)===T);return(D==null?void 0:D.tokensPerMonth)??0},R=async()=>{p(!0);try{const T=await Ce.post("/billing/create-portal");T.portalUrl&&(window.location.href=T.portalUrl)}catch(T){ge.error(T.message||"Failed to open billing portal"),p(!1)}},E=async T=>{const D=parseInt(m,10);if(isNaN(D)||D<1){ge.error("Please enter a valid amount");return}f(!0);try{const F=await Ce.post("/billing/purchase-tokens",{tokens:D,successUrl:`${window.location.origin}${window.location.pathname}?settings=billing&tokens=success`,cancelUrl:`${window.location.origin}${window.location.pathname}?settings=billing&tokens=canceled`});F.checkoutUrl&&(window.location.href=F.checkoutUrl)}catch(F){ge.error(F.message||"Failed to start checkout"),f(!1)}},P=(()=>{const T=parseInt(m,10);return isNaN(T)||T<1?0:T*BH})();if(b.useEffect(()=>{const T=new URLSearchParams(window.location.search);T.get("checkout")==="success"?(ge.success("Subscription updated successfully!"),e(),T.delete("checkout"),window.history.replaceState({},"",`${window.location.pathname}?${T.toString()}
770`)):T.get("checkout")==="canceled"?(ge.info("Checkout was canceled"),T.delete("checkout"),window.history.replaceState({},"",`${window.location.pathname}?${T.toString()}`)):T.get("tokens")==="success"?(ge.success("Tokens purchased successfully!"),e(),T.delete("tokens"),window.history.replaceState({},"",`${window.location.pathname}?${T.toString()}`)):T.get("tokens")==="canceled"&&(ge.info("Token purchase was canceled"),T.delete("tokens"),window.history.replaceState({},"",`${window.location.pathname}?${T.toString()}`))},[]),c)return o.jsx("div",{className:"flex h-64 items-center justify-center",children:o.jsx(Me,{className:"h-8 w-8 animate-spin text-muted-foreground"})});const O=(t==null?void 0:t.subscriptionTier)||"free",L=i?Math.round(i.promptsUsed/i.promptsLimit*100):0;return o.jsxs("div",{className:"",children:[o.jsxs("div",{className:"grid gap-[1px] bg-border sm:grid-cols-2 border-b",children:[o.jsxs(Ct,{className:"py-3 px-6",children:[o.jsx(Lt,{className:"!p-0 !pb-3",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx($t,{className:"text-base",children:"Current Plan"}),o.jsx(Ge,{variant:"outline",className:"capitalize",children:O})]})}),o.jsxs(Et,{className:"space-y-2 p-0",children:[((i==null?void 0:i.promptsLimit)??0)>0?o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between text-sm mb-2.5",children:[o.jsx("span",{className:"text-muted-foreground",children:"Prompts"}),o.jsxs("span",{className:"font-medium",children:[(i==null?void 0:i.promptsUsed)||0," / ",(i==null?void 0:i.promptsLimit)||0]})]}),o.jsx("div",{className:"h-2 w-full rounded-full bg-muted",children:o.jsx("div",{className:`h-2 rounded-full transition-all ${L>=100?"bg-destructive":L>=80?"bg-yellow-500":"bg-primary"}`,style:{width:`${Math.min(L,100)}%`}})})]}):o.jsxs("div",{className:"flex items-center justify-between text-sm",children:[o.jsx("span",{className:"text-muted-foreground",children:"Prompts"}),o.jsx("span",{className:"font-medium text-muted-foreground",children:"No prompts available"})]}),o.jsxs("div",{className:"flex items-center justify-between text-sm",children:[o.jsx("span",{className:"text-muted-foreground",children:"LLM models"}),o.jsx("span",{className:`font-medium ${((i==null?void 0:i.llmsLimit)??0)===0?"text-muted-foreground":""}`,children:((i==null?void 0:i.llmsLimit)??0)>0?`${i==null?void 0:i.llmsLimit} included`:"No LLM models available"})]}),O!=="free"&&o.jsxs("div",{className:"flex items-center justify-between text-sm",children:[o.jsx("span",{className:"text-muted-foreground",children:"Billing cycle"}),o.jsx("span",{className:"font-medium",children:i!=null&&i.periodEnd?`Renews ${new Date(i.periodEnd).toLocaleDateString()}`:"Monthly"})]}),O==="free"&&o.jsx("div",{className:"rounded-lg bg-muted/50 p-3 text-sm text-muted-foreground",children:"You're on the free plan. Upgrade to unlock prompts, LLM models, and more features."}),O!=="free"&&o.jsxs(le,{variant:"outline",size:"sm",className:"w-full mt-2",onClick:R,disabled:h,children:[h?o.jsx(Me,{className:"mr-2 h-4 w-4 animate-spin"}):o.jsx(Wr,{className:"mr-2 h-4 w-4"}),"Manage Subscription"]})]})]}),o.jsxs(Ct,{className:"py-3 px-6",children:[o.jsx(Lt,{className:"!p-0 !pb-3",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx($t,{className:"text-base flex items-center gap-2",children:"Run Tokens"}),o.jsxs(Ge,{variant:"outline",className:"px-2 py-0.5",children:[(t==null?void 0:t.tokenBalance)??0," available"]})]})}),o.jsxs(Et,{className:"space-y-3 p-0",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"Tokens are used for manual prompt runs, article generation, image creation and more."}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{htmlFor:"token-amount",className:"text-sm",children:"Amount to purchase"}),o.jsxs("div",{className:"flex gap-2 mt-2",children:[o.jsxs("div",{className:"relative flex-1",children:[o.jsx(gt,{id:"token-amount",type:"number",min:"1",value:m,onChange:T=>x(T.target.value),className:"flex-1 h-9",placeholder:"Enter amount"}),o.jsx("span",{className:"absolute right-0 top-0 bottom-0 flex items-center justify-center pr-2 text-sm text-muted-foreground",children:P.toLocaleStr
770ing("da-DK",{style:"currency",currency:"DKK"})})]}),o.jsx(le,{size:"sm",onClick:()=>E(),disabled:d||P<=0,children:d?o.jsx(Me,{className:"h-4 w-4 animate-spin"}):"Buy"})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Quick select"}),o.jsx("div",{className:"flex gap-2",children:XIe.map(T=>o.jsx(Ge,{variant:m===String(T)?"secondary":"outline",className:"cursor-pointer hover:bg-accent text-xs rounded-md",onClick:()=>x(String(T)),children:T},T))}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:[BH.toLocaleString("da-DK",{style:"currency",currency:"DKK"})," per token"]})]})]})]})]}),o.jsxs("div",{children:[o.jsx("h3",{className:"mb-3 text-sm font-medium h-12 border-b flex items-center px-6",children:"Available Plans"}),o.jsx("div",{className:"grid gap-[1px] bg-border sm:grid-cols-2",children:n.map(T=>{const D=gb(T.name),F=O===D,q=QIe(T),B=JIe(T),z=T.stripePriceId&&T.price>0,H=M(),W=T.price<H,G=T.price>H;return o.jsxs(Ct,{className:"bg-background relative",children:[T.isFeatured&&o.jsx("div",{className:"absolute top-2 right-2",children:o.jsxs(Ge,{className:"gap-1 bg-primary text-xs",children:[o.jsx(bo,{className:"h-3 w-3"}),"Popular"]})}),o.jsxs(Lt,{className:"pb-2 pt-4",children:[o.jsx($t,{className:"text-sm",children:T.name}),o.jsxs(hh,{children:[o.jsx("span",{className:"text-xl font-bold text-foreground",children:T.price===0?"Free":VH(T.price,T.priceCurrency)}),T.price>0&&o.jsxs("span",{className:"text-muted-foreground text-xs",children:["/",T.billingInterval]})]})]}),o.jsxs(Et,{className:"pt-0",children:[o.jsxs("ul",{className:"space-y-1.5 mb-3 text-xs",children:[q.map(K=>o.jsxs("li",{className:"flex items-start gap-2",children:[K.included?o.jsx(Sn,{className:"mt-0.5 h-3 w-3 shrink-0 text-primary"}):o.jsx(mr,{className:"mt-0.5 h-3 w-3 shrink-0 text-destructive"}),o.jsx("span",{className:K.included?"":"text-muted-foreground",children:K.text})]},K.text)),o.jsxs("li",{className:"flex items-center gap-2",children:[o.jsx(Sn,{className:"h-3 w-3 shrink-0 text-primary"}),o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx("span",{className:"flex items-center -space-x-1",children:a.slice(0,3).map(K=>K.logoUrl?o.jsx(Hn,{src:K.logoUrl,alt:K.displayName,className:"h-3 w-3 object-contain rounded-full bg-background ring-1 ring-background"},K.id):o.jsx("div",{className:"h-3 w-3 rounded-full bg-muted flex items-center justify-center ring-1 ring-background",children:o.jsx(ga,{className:"h-2 w-2 text-muted-foreground"})},K.id))}),o.jsx("span",{children:"AI models"})]})]})]}),o.jsx(le,{className:"w-full",size:"sm",variant:F?"outline":W?"secondary":"default",disabled:F||!z,onClick:()=>k(D,W),children:F?"Current Plan":z?W?"Downgrade":G?"Upgrade":"Subscribe":T.price===0?"Free Forever":"Contact Sales"}),o.jsx(le,{variant:"outline",size:"sm",className:"w-full mt-2",onClick:()=>S(!N),children:"View features"}),B.length>0&&N&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"my-3"}),o.jsx("ul",{className:"space-y-1.5 mb-3 text-xs",children:B.map(K=>o.jsxs("li",{className:"flex items-start gap-2",children:[K.included?o.jsx(Sn,{className:"mt-0.5 h-3 w-3 shrink-0 text-primary"}):o.jsx(mr,{className:"mt-0.5 h-3 w-3 shrink-0 text-muted-foreground/50"}),o.jsx("span",{className:K.included?"":"text-muted-foreground",children:K.text})]},K.text))})]})]})]},T.id)})})]}),o.jsx(ur,{open:!!y,onOpenChange:T=>!T&&A(),children:o.jsxs(tr,{className:"sm:max-w-md",children:[o.jsxs(dr,{children:[o.jsx(fr,{className:"flex items-center gap-2",children:y!=null&&y.isDowngrade?o.jsxs(o.Fragment,{children:[o.jsx(Ase,{className:"h-5 w-5 text-destructive"}),"Confirm Downgrade"]}):o.jsxs(o.Fragment,{children:[o.jsx(Tse,{className:"h-5 w-5 text-primary"}),"Confirm Upgrade"]})}),o.jsx(hr,{children:y!=null&&y.isDowngrade?"You are about to downgrade your plan. Some features may become unavailable.":"You are about to upgrade your plan. Your new features will be available immediately."})]}),y&&o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"flex items-center justify-between rounded-lg bg-muted/50 p-3",children:[o.jsx("span",{className:"text-sm font-medium",children:"Plan"}),o.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[o.jsx("span",{className:"text-muted-foreground capitalize",children:O}),o.jsx(Ai,{className:"h-4 w-4 text-muted-foreground"}),o.jsx("span",{className:"font-medium",children:y.targetPlan.name})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between py-2 border-b",children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:"Prompts per day"}),o.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[o.jsx("span",{className:y.isDowngrade?"text-muted-foreground":"",children:(i==null?void 0:i.promptsLimit)??0}),o.jsx(Ai,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:`font-medium ${y.targetPlan.promptLimit>((i==null?void 0:i.promptsLimit)??0)?"text-primary":y.targetPlan.promptLimit<((i==null?void 0:i.promptsLimit)??0)?"text-destructive":""}`,children:y.targetPlan.promptLimit})]})]}),o.jsxs("div",{className:"flex items-center justify-between py-2 border-b",children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:"Total runs/month"}),o.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[o.jsx("span",{className:y.isDowngrade?"text-muted-foreground":"",children:(((i==null?void 0:i.promptsLimit)??0)*30*3).toLocaleStr
770ing()}),o.jsx(Ai,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:`font-medium ${y.targetPlan.promptLimit>((i==null?void 0:i.promptsLimit)??0)?"text-primary":y.targetPlan.promptLimit<((i==null?void 0:i.promptsLimit)??0)?"text-destructive":""}`,children:(y.targetPlan.promptLimit*30*3).toLocaleString()})]})]}),o.jsxs("div",{className:"flex items-center justify-between py-2 border-b",children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:"AI Models"}),o.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[o.jsx("div",{className:"flex items-center gap-1",children:a.slice(0,3).map(T=>T.logoUrl?o.jsx(Hn,{src:T.logoUrl,alt:T.displayName,className:"h-4 w-4 object-contain"},T.id):o.jsx("div",{className:"h-4 w-4 rounded-full bg-muted flex items-center justify-center",children:o.jsx(ga,{className:"h-2.5 w-2.5 text-muted-foreground"})},T.id))}),o.jsx(Ai,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("div",{className:"flex items-center gap-1",children:a.slice(0,3).map(T=>T.logoUrl?o.jsx(Hn,{src:T.logoUrl,alt:T.displayName,className:"h-4 w-4 object-contain"},T.id):o.jsx("div",{className:"h-4 w-4 rounded-full bg-muted flex items-center justify-center",children:o.jsx(ga,{className:"h-2.5 w-2.5 text-muted-foreground"})},T.id))})]})]}),o.jsxs("div",{className:"flex items-center justify-between py-2",children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:"Monthly run tokens"}),o.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[o.jsx("span",{className:y.isDowngrade?"text-muted-foreground":"",children:I()}),o.jsx(Ai,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:`font-medium ${y.targetPlan.tokensPerMonth>I()?"text-primary":y.targetPlan.tokensPerMonth<I()?"text-destructive":""}`,children:y.targetPlan.tokensPerMonth})]})]})]}),o.jsxs("div",{className:"flex items-center justify-between rounded-lg bg-muted/50 p-3",children:[o.jsx("span",{className:"text-sm font-medium",children:"New price"}),o.jsxs("span",{className:"text-lg font-bold",children:[VH(y.targetPlan.price,y.targetPlan.priceCurrency),o.jsxs("span",{className:"text-sm font-normal text-muted-foreground",children:["/",y.targetPlan.billingInterval]})]})]}),y.isDowngrade&&o.jsx("p",{className:"text-xs text-muted-foreground",children:"Your plan will be downgraded immediately. Any prorated credit will be applied to your next billing cycle."}),!y.isDowngrade&&(i==null?void 0:i.hasActiveSubscription)&&o.jsx("p",{className:"text-xs text-muted-foreground",children:"Your plan will be upgraded immediately. A prorated charge will be applied to your payment method."})]}),o.jsx(Pr,{className:"gap-2 sm:gap-0",children:y!=null&&y.isDowngrade?o.jsxs(o.Fragment,{children:[o.jsx(le,{variant:"outline",onClick:A,disabled:w,children:"Cancel"}),o.jsxs(le,{variant:"destructive",onClick:C,disabled:w,children:[w&&o.jsx(Me,{className:"mr-2 h-4 w-4 animate-spin"}),"Confirm Downgrade"]})]}):o.jsxs(o.Fragment,{children:[o.jsx(le,{variant:"outline",onClick:A,disabled:w,children:"Cancel"}),o.jsxs(le,{onClick:C,disabled:w,children:[w&&o.jsx(Me,{className:"mr-2 h-4 w-4 animate-spin"}),i!=null&&i.hasActiveSubscription?"Confirm Upgrade":"Subscribe Now"]})]})})]})})]})}const e3e=[{id:"google-analytics",name:"Google Analytics",description:"Connect your GA4 property to track AI-driven traffic and conversions.",logoUrl:"https://www.gstatic.com/analytics-suite/header/suite/v2/ic_analytics.svg",status:"coming_soon",category:"analytics"},{id:"google-search-console",name:"Google Search Console",description:"Import search performance data and monitor your website's presence in Google.",logoUrl:"https://ssl.gstatic.com/search-console/scfe/search_console-64.png",status:"coming_soon",category:"analytics"}
770,{id:"slack",name:"Slack",description:"Receive real-time notifications about rank changes and new opportunities.",logoUrl:"https://a.slack-edge.com/80588/marketing/img/icons/icon_slack_hash_colored.png",status:"coming_soon",category:"communication"},{id:"wordpress",name:"WordPress",description:"Automatically publish AI-optimized content directly to your WordPress site.",logoUrl:"https://s.w.org/style/images/about/WordPress-logotype-standard.png",status:"coming_soon",category:"cms"}];function t3e(){const[t,e]=b.useState(null),n=async s=>{if(s.status==="coming_soon"){ge.info(`${s.name} integration coming soon!`);return}e(s.id);try{await new Promise(a=>setTimeout(a,1e3)),ge.success(`Connected to ${s.name}`)}catch(a){ge.error(a.message||`Failed to connect to ${s.name}`)}finally{e(null)}},r=async s=>{e(s.id);try{await new Promise(a=>setTimeout(a,1e3)),ge.success(`Disconnected from ${s.name}`)}catch(a){ge.error(a.message||`Failed to disconnect from ${s.name}`)}finally{e(null)}},i=s=>{switch(s.status){case"connected":return{text:"Disconnect",variant:"outline",onClick:()=>r(s)};case"coming_soon":return{text:"Coming Soon",variant:"outline",onClick:()=>n(s),disabled:!0};default:return{text:"Connect",variant:"default",onClick:()=>n(s)}}};return o.jsxs("div",{className:"",children:[o.jsx("div",{className:"px-6 py-3 border-b",children:o.jsx("p",{className:"text-sm text-muted-foreground",children:"Connect third-party services to enhance your AI visibility tracking and automate workflows."})}),o.jsx("div",{className:"",children:e3e.map(s=>{const a=i(s),l=t===s.id;return o.jsxs("div",{className:"flex items-center gap-4 border-b px-6 py-3",children:[o.jsx("div",{className:"flex h-12 w-12 shrink-0 items-center justify-center rounded-lg bg-accent",children:o.jsx("img",{src:s.logoUrl,alt:s.name,className:"h-8 w-8 object-contain",onError:c=>{c.currentTarget.style.display="none"}})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("h4",{className:"font-medium text-sm",children:s.name}),s.status==="connected"&&o.jsx(Ge,{variant:"secondary",className:"text-xs",children:"Connected"})]}),o.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:s.description})]}),o.jsx(le,{variant:a.variant,size:"sm",onClick:a.onClick,disabled:a.disabled||l,className:"shrink-0",children:l?o.jsx(Me,{className:"h-4 w-4 animate-spin"}):a.text})]},s.id)})}),o.jsxs("div",{className:"px-6 py-3",children:[o.jsx("h4",{className:"text-sm font-medium mb-1",children:"Need a different integration?"}),o.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"We're always looking to add new integrations that our users find useful. Let us know what you need by starting a chat."})]})]})}const n3e=[{title:"USER",items:[{id:"profile",label:"Profile",icon:Az},{id:"notifications",label:"Notifications",icon:Mse}]},{title:"PROJECTS",items:[{id:"billing",label:"Billing",icon:Ise},{id:"integrations",label:"Integrations",icon:ETe}]}],r3e={profile:PIe,notifications:qIe,billing:ZIe,integrations:t3e},i3e={profile:"Profile",notifications:"Notifications",billing:"Billing",integrations:"Integrations"};function s3e(){const t=Nr(),{profile:e,logout:n}=Rr(),{isOpen:r,activeTab:i,closeSettings:s,setActiveTab:a}=kse(),l=r3e[i],c=()=>{s(),t("/admin")},u=async()=>{s(),await n(),t("/login")};return o.jsx(ur,{open:r,onOpenChange:d=>!d&&s(),children:o.jsxs(tr,{className:"max-w-4xl p-0 gap-0 overflow-hidden flex flex-row h-[min(85vh,700px)]",children:[o.jsxs("div",{className:"w-56 shrink-0 border-r bg-muted/30 flex flex-col",children:[o.jsx("div",{className:"p-6 pt-4 pb-4",children:o.jsx("h2",{className:"text-lg font-semibold",children:"Account"})}),o.jsx("nav",{className:"flex-1 px-3 pb-6 pt-3",children:n3e.map((d,f)=>o.jsxs("div",{className:ne(f>0&&"mt-6"),children:[o.jsx("div",{className:"px-3 mb-2 text-xs font-medium tracking-wider text-muted-foreground",children:d.title}),o.jsx("div",{className:"space-y-1",children:d.items.map(h=>{const p=i===h.id;return o.jsxs("button",{onClick:()=>a(h.id),className:ne("w-full flex items-center gap-3 rounded-lg px-3 py-2 text-sm transition-colors text-left border border-transparent",p?"bg-background text-foreground border-border":"hover:text-foreground"),children:[o.jsx(h.icon,{className:"h-4 w-4"}),o.jsx("span",{children:h.label})]}
770,h.id)})})]},d.title))}),o.jsxs("div",{className:"shrink-0 border-t p-3 space-y-1",children:[o.jsxs(le,{variant:"ghost",className:"w-full justify-start gap-3 text-sm font-normal",onClick:u,children:[o.jsx(Gse,{className:"h-4 w-4"}),o.jsx("span",{className:"flex-1 text-left",children:"Log out"})]}),(e==null?void 0:e.isAdmin)&&o.jsxs(le,{variant:"ghost",className:"w-full justify-start gap-3 text-sm font-normal",onClick:c,children:[o.jsx(G4,{className:"h-4 w-4"}),o.jsx("span",{className:"flex-1 text-left",children:"Admin Dashboard"}),o.jsx(Wr,{className:"h-3 w-3 text-muted-foreground"})]})]})]}),o.jsxs("div",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:[o.jsx("div",{className:"shrink-0 px-6 py-4 border-b",children:o.jsx("h3",{className:"text-lg font-semibold",children:i3e[i]})}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:o.jsx(l,{})})]})]})})}const Yr=b.forwardRef(({className:t,indeterminate:e,checked:n,...r},i)=>{const s=b.useRef(null);return b.useImperativeHandle(i,()=>s.current),b.useEffect(()=>{s.current&&(s.current.indeterminate=e??!1)},[e]),o.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[o.jsx("input",{type:"checkbox",ref:s,checked:n,className:"sr-only peer",...r}),o.jsx("div",{className:ne("h-4 w-4 shrink-0 rounded border border-input bg-background ring-offset-background transition-colors","peer-focus-visible:outline-none peer-focus-visible:ring-2 peer-focus-visible:ring-ring peer-focus-visible:ring-offset-2","peer-disabled:cursor-not-allowed peer-disabled:opacity-50","peer-checked:bg-primary peer-checked:border-primary peer-checked:text-primary-foreground","flex items-center justify-center",t),children:e?o.jsx(kz,{className:"h-3 w-3 text-primary-foreground"}):n?o.jsx(Sn,{className:"h-3 w-3 text-primary-foreground"}):null})]})});Yr.displayName="Checkbox";const jR=[{key:"analyzing",label:"Analyzing company",icon:pr},{key:"gathering_info",label:"AI information gathering",icon:To},{key:"fetching_logo",label:"Gathering company logo",icon:NS},{key:"enabling_llms",label:"Enabling default AI models",icon:jz},{key:"completed",label:"Setup complete",icon:wg}];function Foe({open:t,onOpenChange:e}){const n=Nr(),{createCompany:r,fetchCompanies:i}=Ri(),[s,a]=b.useState(""),[l,c]=b.useState("Denmark"),[u,d]=b.useState(!1),[f,h]=b.useState(""),[p,m]=b.useState("form"),[x,y]=b.useState(!1),[g,w]=b.useState(null),[v,N]=b.useState(""),[S,_]=b.useState(""),[j,A]=b.useState([]),[C,k]=b.useState(""),M=b.useRef(null),[I,R]=b.useState("analyzing"),[E,P]=b.useState({}),[O,L]=b.useState(null),[T,D]=b.useState([]),[F,q]=b.useState([]),[B,z]=b.useState(!1),[H,W]=b.useState(new Set),[G,K]=b.useState(!1),[ee,V]=b.useState("pending"),{profile:J}=Rr(),Y=(J==null?void 0:J.promptsLimit)||5,$=(J==null?void 0:J.promptsUsed)||0,fe=Math.max(0,Y-$),{data:ce=[]}=AT(),ve=b.useMemo(()=>{const pe=f.toLowerCase();return pe?ce.filter(je=>je.name.toLowerCase().includes(pe)):ce.slice(0,20)},[f,ce]),X=pe=>{R(pe.step),pe.data&&P(je=>({...je,...pe.data})),pe.step==="completed"&&setTimeout(()=>{i(),m("prompts"),de(pe.companyId)},1e3)},de=async pe=>{z(!0);try{const je=await Ce.get(`/companies/${pe}/onboarding/prompt-suggestions`);q(je.suggestions),V(je.status)}catch(je){console.error("Failed to fetch prompt suggestions",je)}finally{z(!1)}};b.useEffect(()=>{const pe=Um();if(!pe)return;const je=ae=>{O?ae.companyId===O&&X(ae):p==="creating"&&D(we=>[...we,ae])};return pe.on("company:onboarding_progress",je),()=>{pe.off("company:onboarding_progress",je)}},[O,p,n,e,i]),b.useEffect(()=>{const pe=Um();if(!pe)return;const je=ae=>{ae.companyId===O&&ae.count>0&&de(O)};return pe.on("onboarding:prompts_ready",je),()=>{pe.off("onboarding:prompts_ready",je)}},[O]),b.useEffect(()=>{if(O&&T.length>0){const pe=T.filter(je=>je.companyId===O);if(pe.length>0){const je=pe[pe.length-1];X(je)}D([])}},[O,T]),b.useEffect(()=>{if(!O||I==="completed"||p==="prompts")return;const pe=setTimeout(async()=>{try{const je=await Ce.get(`/companies/${O}`);je!=null&&je.id&&(R("completed"),setTimeout(()=>{i(),m("prompts"),de(O)},500))}catch{}},1e4);return()=>clearTimeout(pe)},[O,I,p,i]);const Te=()=>{a(""),c("Denmark"),m("form"),w(null),N(""),_(""),A([]),k(""),R("analyzing"),P({}),L(null),D([]),y(!1),q([]),z(!1),W(new Set),K(!1),V("pending")},Pe=async pe=>{if(pe.preventDefault(),!s.trim()){ge.error("Please enter a company name");return}if(!l){ge.error("Please select a country");return}y(!0),m("analyzing");try{const je=await Ce.post("/companies/preview",{name:s.trim(),country:l});w(je),N(je.brandName),_(je.website||""),A(je.alternateNames||[]),m("review")}catch(je){ge.error(je.message||"Failed to analyze company"),m("form")}finally{y(!1)}},se=async()=>{m("creating"),R("enabling_llms");try{const pe=await r({name:s.trim(),brandName:v.trim(),website:S.trim()||void 0,alternateNames:j.filter(je=>je.trim()),country:l});L(pe.id)}catch(pe){ge.error(pe.message||"Failed to create company"),m("review")}},U=()=>{var je;const pe=C.trim();if(pe){if(j.some(ae=>ae.toLowerCase()===pe.toLowerCase())){ge.error("This name already exists");return}if(pe.toLowerCase()===v.toLowerCase()){ge.error("Cannot add the brand name as an alternate");return}
770A([...j,pe]),k(""),(je=M.current)==null||je.focus()}},Q=pe=>{A(j.filter(je=>je!==pe))},oe=pe=>{pe.key==="Enter"?(pe.preventDefault(),U()):pe.key==="Backspace"&&!C&&j.length>0&&A(j.slice(0,-1))},_e=pe=>{W(je=>{const ae=new Set(je);if(ae.has(pe))ae.delete(pe);else{if(ae.size>=fe)return ge.error(`You can only select up to ${fe} prompts with your current plan`),je;ae.add(pe)}return ae})},ye=async()=>{if(!O||H.size===0){ge.error("Please select at least one prompt");return}K(!0);try{await Ce.post(`/companies/${O}/onboarding/create-prompts`,{suggestionIds:Array.from(H)}),ge.success(`Created ${H.size} prompts! Starting AI analysis...`),e(!1),Te(),n(`/company/${O}?welcome=true`)}catch(pe){ge.error(pe.message||"Failed to create prompts"),K(!1)}},re=()=>{ge.info("You can add prompts anytime from the Queries page"),e(!1),Te(),n(`/company/${O}`)},he=pe=>{const je=jR.findIndex(we=>we.key===pe),ae=jR.findIndex(we=>we.key===I);return je<ae?"completed":je===ae?"active":"pending"};if(p==="analyzing")return o.jsx(ur,{open:t,onOpenChange:()=>{},children:o.jsxs(tr,{className:"sm:max-w-md",onPointerDownOutside:pe=>pe.preventDefault(),children:[o.jsxs(dr,{children:[o.jsxs(fr,{className:"flex items-center gap-2",children:[o.jsx(pr,{className:"h-5 w-5 text-primary animate-pulse"}),"Analyzing your company"]}),o.jsx(hr,{children:"Using AI to find company details and alternate names..."})]}),o.jsxs("div",{className:"py-8 flex flex-col items-center gap-4",children:[o.jsx(Me,{className:"h-10 w-10 animate-spin text-primary"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"This usually takes a few seconds"})]})]})});if(p==="review"&&g){const pe=S?`https://www.google.com/s2/favicons?domain=${new URL(S.startsWith("http")?S:`https://${S}`).hostname}&sz=128`:g.logoUrl;return o.jsx(ur,{open:t,onOpenChange:je=>{je||Te(),e(je)},children:o.jsxs(tr,{className:"sm:max-w-lg",children:[o.jsxs(dr,{children:[o.jsxs(fr,{className:"flex items-center gap-2",children:[o.jsx(wg,{className:"h-5 w-5 text-success"}),"Review company details"]}),o.jsx(hr,{children:"We found the following information. Feel free to edit before creating."})]}),o.jsxs("div",{className:"space-y-4 py-2",children:[o.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/50",children:[pe?o.jsx("img",{src:pe,alt:"",className:"h-10 w-10 rounded object-contain bg-background p-1"}):o.jsx("div",{className:"h-10 w-10 rounded bg-primary/10 flex items-center justify-center",children:o.jsx("span",{className:"text-lg font-bold text-primary",children:v.charAt(0).toUpperCase()})}),o.jsxs("div",{children:[o.jsx("p",{className:"font-medium",children:v}),o.jsx("p",{className:"text-sm text-muted-foreground",children:s})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{htmlFor:"brandName",children:"Brand Name"}),o.jsx(gt,{id:"brandName",value:v,onChange:je=>N(je.target.value),placeholder:"Brand name for tracking"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"This is the name we'll track in AI responses"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{htmlFor:"website",children:"Website"}),o.jsx(gt,{id:"website",value:S,onChange:je=>_(je.target.value),placeholder:"https://example.com"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Ez,{className:"h-4 w-4 text-muted-foreground"}),o.jsx(et,{children:"Alternate Names"})]}),o.jsxs("div",{className:ne("flex flex-wrap items-center gap-2 p-2.5 min-h-[44px] rounded-md border bg-background cursor-text","focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2"),onClick:()=>{var je;return(je=M.current)==null?void 0:je.focus()},children:[j.map(je=>o.jsxs(Ge,{variant:"outline",className:"gap-1 h-6 text-xs pr-1 bg-muted/50",children:[je,o.jsx("button",{type:"button",onClick:ae=>{ae.stopPropagation(),Q(je)},className:"ml-0.5 hover:bg-muted-foreground/20 rounded-full p-0.5 transition-colors",children:o.jsx(mr,{className:"h-2.5 w-2.5"})})]},je)),o.jsx("input",{ref:M,type:"text",value:C,onChange:je=>k(je.target.value),onKeyDown:oe,placeholder:j.length===0?"Add alternate names...":"Add more...",className:"flex-1 min-w-[100px] bg-transparent outline-none text-sm placeholder:text-muted-foreground"})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Other names your company is known by (press Enter to add)"})]})]}),o.jsxs(Pr,{className:"gap-2 sm:gap-0",children:[o.jsx(le,{type:"button",variant:"outline",onClick:()=>{Te(),e(!1)},children:"Cancel"}),o.jsxs(le,{type:"button",variant:"ghost",onClick:()=>m("form"),children:[o.jsx(cv,{className:"h-4 w-4"}),"Back to Edit"]}),o.jsx(le,{onClick:se,disabled:!v.trim(),children:"Create Company"})]})]})})}return p==="creating"?o.jsx(ur,{open:t,onOpenChange:()=>{},children:o.jsxs(tr,{className:"sm:max-w-md",onPointerDownOutside:pe=>pe.preventDefault(),children:[o.jsxs(dr,{children:[o.jsxs(fr,{className:"flex items-center gap-2",children:[o.jsx(pr,{className:"h-5 w-5 text-primary"}),"Setting up your company"]}),o.jsx(hr,{children:"Creating your company and enabling AI models..."})]}),o.jsx("div",{className:"py-6 space-y-4",children:jR.filter(pe=>pe.key==="enabling_llms"||pe.key==="completed").map(pe=>{const je=he(pe.key),ae=pe.icon;return o.jsxs("div",{className:ne("flex items-center gap-3 p-3 rounded-lg transition-all",je==="active"&&"bg-primary/10 border border-primary/20",je==="completed"&&"bg-muted/50",je==="pending"&&"opacity-50"),children:[o.jsx("div",{className:ne("flex h-8 w-8 items-center justify-center rounded-full",je==="active"&&"bg-primary text-primary-foreground",je==="completed"&&"bg-primary/20 text-primary",je==="pending"&&"bg-muted text-muted-foreground"),children:je==="active"?o.jsx(Me,{className:"h-4 w-4 animate-spin"}):je==="completed"?o.jsx(Sn,{className:"h-4 w-4"}):o.jsx(ae,{className:"h-4 w-4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:ne("font-medium text-sm",je==="active"&&"text-foreground",je==="completed"&&"text-muted-foreground",je==="pending"&&"text-muted-foreground"),children:pe.label}),je==="completed"&&pe.key==="enabling_llms"&&(E==null?void 0:E.llmsEnabled)&&o.jsxs("p",{className:"text-xs text-muted-foreground",children:[E.llmsEnabled," AI models enabled"]})]})]}
770,pe.key)})}),I==="completed"&&o.jsx("div",{className:"text-center text-sm text-muted-foreground",children:"Loading prompt suggestions..."})]})}):p==="prompts"?o.jsx(ur,{open:t,onOpenChange:()=>{},children:o.jsxs(tr,{className:"sm:max-w-xl",onPointerDownOutside:pe=>pe.preventDefault(),children:[o.jsxs(dr,{children:[o.jsxs(fr,{className:"flex items-center gap-2",children:[o.jsx(Mo,{className:"h-5 w-5 text-primary"}),"Choose prompts to track"]}),o.jsx(hr,{children:"Let's get started by choosing the prompts you want to track."})]}),o.jsxs("div",{className:"py-4",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:"Select prompts to track in AI responses"}),o.jsxs(Ge,{variant:"outline",className:"h-7",children:[H.size," / ",fe," selected"]})]}),B||ee==="pending"&&F.length===0?o.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[o.jsx(Me,{className:"h-8 w-8 animate-spin text-primary mb-4"}),o.jsx("p",{className:"text-muted-foreground text-sm",children:"Generating prompt suggestions..."})]}):F.length===0?o.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[o.jsx(Mo,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),o.jsx("p",{className:"text-muted-foreground",children:"No suggestions available yet. You can add prompts manually from the Queries page."})]}):o.jsx("div",{className:"space-y-2 max-h-[300px] overflow-y-auto pr-2",children:F.map(pe=>{const je=H.has(pe.id),ae=!je&&H.size>=fe;return o.jsxs("div",{className:ne("flex items-start gap-3 p-3 rounded-lg border cursor-pointer transition-all",je&&"bg-primary/5 border-primary",!je&&!ae&&"hover:bg-muted/50",ae&&"opacity-50 cursor-not-allowed"),onClick:()=>!ae&&_e(pe.id),children:[o.jsx(Yr,{checked:je,disabled:ae,className:"mt-0.5"}),o.jsx("p",{className:"text-sm flex-1",children:pe.promptText})]},pe.id)})})]}),o.jsxs(Pr,{className:"gap-2 sm:gap-0",children:[o.jsx(le,{variant:"outline",onClick:re,disabled:G,children:"Skip for now"}),o.jsx(le,{onClick:ye,disabled:H.size===0||G,children:G?o.jsxs(o.Fragment,{children:[o.jsx(Me,{className:"h-4 w-4 animate-spin"}),"Creating..."]}):o.jsxs(o.Fragment,{children:["Start Tracking",o.jsx(Ai,{className:"h-4 w-4"})]})})]})]})}):o.jsx(ur,{open:t,onOpenChange:pe=>{pe||Te(),e(pe)},children:o.jsxs(tr,{children:[o.jsxs(dr,{children:[o.jsx(fr,{children:"Add a company"}),o.jsx(hr,{children:"Track your brand mentions across AI assistants like ChatGPT, Claude, and Gemini."})]}),o.jsxs("form",{onSubmit:Pe,className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{htmlFor:"companyName",children:"What's your company name?"}),o.jsx(gt,{id:"companyName",placeholder:"e.g., Acme Corporation",value:s,onChange:pe=>a(pe.target.value),autoFocus:!0}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"We'll use AI to find your website, brand name, and alternate names"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{children:"Country"}),o.jsxs(ou,{open:u,onOpenChange:d,children:[o.jsx(lu,{asChild:!0,children:o.jsxs(le,{variant:"outline",role:"combobox","aria-expanded":u,className:"w-full justify-between font-normal",children:[l||"Select country...",o.jsx(bg,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),o.jsx(pc,{className:"w-full p-0",align:"start",children:o.jsxs(Kh,{children:[o.jsx(Yh,{placeholder:"Search country...",value:f,onValueChange:h}),o.jsx(Xh,{children:"No country found."}),o.jsx(_d,{className:"max-h-64 overflow-y-auto",children:ve.map(pe=>o.jsxs(Sd,{value:pe.name,onSelect:je=>{c(je===l?"":je),d(!1),h("")},children:[o.jsx(Sn,{className:ne("mr-2 h-4 w-4",l===pe.name?"opacity-100":"opacity-0")}),pe.name]},pe.code))})]})})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Helps us find the right company and tailor AI queries"})]}),o.jsxs(Pr,{children:[o.jsx(le,{type:"button",variant:"outline",onClick:()=>e(!1),children:"Cancel"}),o.jsxs(le,{type:"submit",disabled:x||!s.trim(),children:[x&&o.jsx(Me,{className:"mr-2 h-4 w-4 animate-spin"}),o.jsx(pr,{className:"h-4 w-4"}),"Analyze & Continue"]})]})]})]})})}function a3e(){const t=Nr(),{companies:e,currentCompanyId:n,setCurrentCompany:r}
770=Ri(),[i,s]=b.useState(!1),[a,l]=b.useState(!1),c=e.find(f=>f.id===n),u=f=>{r(f),s(!1),t(`/company/${f}`)},d=f=>{if(f.logoUrl)return f.logoUrl;if(f.website)try{const h=f.website.startsWith("http")?f.website:`https://${f.website}`;return`https://www.google.com/s2/favicons?domain=${new URL(h).hostname}&sz=32`}catch{return null}return null};return o.jsxs(o.Fragment,{children:[o.jsxs(ou,{open:i,onOpenChange:s,children:[o.jsx(lu,{asChild:!0,children:o.jsxs(le,{variant:"outline",role:"combobox","aria-expanded":i,className:"w-full justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2 truncate",children:[c&&d(c)?o.jsx("img",{src:d(c),alt:"",className:"h-5 w-5 rounded object-contain border"}):o.jsx(lv,{className:"h-4 w-4 text-muted-foreground"}),o.jsx("span",{className:"truncate",children:(c==null?void 0:c.name)||"Select company..."})]}),o.jsx(bg,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),o.jsx(pc,{className:"w-56 p-0",align:"start",children:o.jsxs(Kh,{children:[o.jsx(Yh,{placeholder:"Search company..."}),o.jsxs(zz,{children:[o.jsx(Xh,{children:"No company found."}),o.jsx(_d,{children:e.map(f=>o.jsxs(Sd,{value:f.id,onSelect:()=>u(f.id),className:"cursor-pointer",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[d(f)?o.jsx("img",{src:d(f),alt:"",className:"h-5 w-5 rounded object-contain"}):o.jsx(lv,{className:"h-4 w-4 text-muted-foreground"}),o.jsx("span",{className:"truncate",children:f.name})]}),o.jsx(Sn,{className:ne("ml-auto h-4 w-4",n===f.id?"opacity-100":"opacity-0")})]},f.id))}),o.jsx(Fae,{}),o.jsx(_d,{children:o.jsxs(Sd,{onSelect:()=>{s(!1),l(!0)},className:"cursor-pointer",children:[o.jsx(yi,{className:"h-4 w-4"}),"Create company"]})})]})]})})]}),o.jsx(Foe,{open:a,onOpenChange:l})]})}const o3e=[{icon:Bse,label:"Dashboard",path:"",processKey:null},{icon:Cz,label:"Opportunities",path:"/opportunities",hasBadge:!0,processKey:"opportunities"},{icon:Ao,label:"Content",path:"/content",processKey:null},{icon:xTe,label:"Research",path:"/research",processKey:"research"}],l3e=[{icon:Mo,label:"Prompts",path:"/prompts"},{icon:uc,label:"Competitors",path:"/competitors"}],c3e=[{icon:Zu,label:"Site Health",path:"/site-health",processKey:"siteHealth"},{icon:ll,label:"Issues",path:"/issues",processKey:"issues"}],u3e=[{icon:Eh,label:"Visibility",path:"/analytics/visibility"},{icon:uTe,label:"Mentions",path:"/analytics/mentions"},{icon:iu,label:"Sources",path:"/analytics/sources"},{icon:Ud,label:"Traffic",path:"/analytics/traffic"}],d3e=[{icon:Rse,label:"Team",path:"/team"},{icon:wT,label:"Settings",path:"/settings"}];function HH(t){if(!(!t||t==="null"||t==="undefined"))return t}function f3e(){var m,x;const t=Ya(),{companyId:e}=Gr(),{currentCompanyId:n,companies:r}=Ri(),{user:i,profile:s}=Rr(),{newCount:a,setNewCount:l}=V4(),{openSettings:c}=kse(),u=HH(e)||HH(n),d=!(s!=null&&s.onboardingCompletedAt)||r.length===0,f=_S(u),h=y=>{if(!y||!(f.isSetupRunning||f.isInitialLoad))return!1;switch(y){case"opportunities":return!f.hasOpportunitiesData;case"research":return!f.hasResearchData;case"siteHealth":return!f.hasSiteHealthData;case"issues":return!f.hasSiteAuditData;default:return!1}},{data:p}=En({queryKey:["opportunity-new-count",u],queryFn:async()=>(await Ce.get(`/opportunities/${u}/new-count`)).count,enabled:!!u,refetchInterval:6e4});return b.useEffect(()=>{p!==void 0&&l(p)},[p,l]),o.jsxs("aside",{className:"flex w-64 flex-col border-r border-border bg-card/50",children:[o.jsx("div",{className:"border-b border-border px-4 h-16 flex items-center shrink-0",children:d?o.jsxs(Mt,{to:"/onboarding",className:"w-full flex items-center gap-2 px-3 py-2 rounded-lg border border-chart-1/50 bg-chart-1/10 hover:bg-chart-1/20 transition-colors",children:[o.jsx(pr,{className:"h-4 w-4 text-chart-1"}),o.jsx("span",{className:"flex-1 text-chart-1 font-medium text-xs",children:"Onboarding"}),o.jsx(Ai,{className:"h-4 w-4 text-chart-1"})]}):o.jsx(a3e,{})}),o.jsxs("nav",{className:"flex-1 overflow-y-auto p-4",children:[o.jsx("div",{className:"space-y-1",children:o3e.map(y=>{const g=d?"#":`/company/${u}${y.path}`,w=!d&&(y.path===""?t.pathname===g:t.pathname.startsWith(g)),v=!d&&y.hasBadge&&a>0,N=!d&&h(y.processKey);return o.jsxs(Mt,{to:g,onClick:d?S=>S.preventDefault():void 0,className:ne("flex items-center gap-3 rounded-lg px-3 py-1.5 text-sm transition-colors",d&&"pointer-events-none text-muted-foreground
770/50",!d&&(w?"bg-accent/50 text-primary":"text-foreground hover:bg-accent")),children:[N?o.jsx(Me,{className:"h-4 w-4 animate-spin text-primary"}):o.jsx(y.icon,{className:"h-4 w-4"}),o.jsx("span",{className:"flex-1",children:y.label}),v&&!N&&o.jsx(Ge,{variant:"secondary",className:"h-5 min-w-5 flex items-center justify-center rounded-full px-1.5 text-xs",children:a>99?"99+":a})]},y.path)})}),o.jsx("div",{className:"mt-4",children:(()=>{const y=d?"#":`/company/${u}/agent`,g=!d&&t.pathname.startsWith(`/company/${u}/agent`);return o.jsxs(Mt,{to:y,onClick:d?w=>w.preventDefault():void 0,className:ne("flex items-center gap-3 rounded-lg px-3 py-1.5 text-sm transition-colors",d&&"pointer-events-none text-muted-foreground/50 border",!d&&(g?"bg-primary/15 border border-primary/50":"border hover:bg-accent")),children:[o.jsx("img",{src:"/images/logo/logo-icon-current-color.svg",alt:"",className:"h-4 w-4 p-0.25"}),o.jsx("span",{className:"flex-1",children:"Agent"}),o.jsx(pr,{className:"h-3 w-3"})]})})()}),o.jsxs("div",{className:"space-y-1 mt-6",children:[o.jsx("div",{className:"mb-2 px-3 text-xs font-medium tracking-wider text-muted-foreground",children:"Tracking"}),l3e.map(y=>{const g=d?"#":`/company/${u}${y.path}`,w=!d&&(t.pathname===g||t.pathname.startsWith(g));return o.jsxs(Mt,{to:g,onClick:d?v=>v.preventDefault():void 0,className:ne("flex items-center gap-3 rounded-lg px-3 py-1.5 text-sm transition-colors",d&&"pointer-events-none text-muted-foreground/50",!d&&(w?"bg-accent/50 text-primary":"text-foreground hover:bg-accent")),children:[o.jsx(y.icon,{className:"h-4 w-4"}),o.jsx("span",{children:y.label})]},y.path)})]}),o.jsxs("div",{className:"space-y-1 mt-6",children:[o.jsx("div",{className:"mb-2 px-3 text-xs font-medium tracking-wider text-muted-foreground",children:"Your Website"}),c3e.map(y=>{const g=d?"#":`/company/${u}${y.path}`,w=!d&&(t.pathname===g||t.pathname.startsWith(g)),v=!d&&h(y.processKey);return o.jsxs(Mt,{to:g,onClick:d?N=>N.preventDefault():void 0,className:ne("flex items-center gap-3 rounded-lg px-3 py-1.5 text-sm transition-colors",d&&"pointer-events-none text-muted-foreground/50",!d&&(w?"bg-accent/50 text-primary":"text-foreground hover:bg-accent")),children:[v?o.jsx(Me,{className:"h-4 w-4 animate-spin text-primary"}):o.jsx(y.icon,{className:"h-4 w-4"}),o.jsx("span",{children:y.label})]},y.path)})]}),o.jsxs("div",{className:"space-y-1 mt-6",children:[o.jsx("div",{className:"mb-2 px-3 text-xs font-medium tracking-wider text-muted-foreground",children:"Analytics"}),u3e.map(y=>{const g=d?"#":`/company/${u}${y.path}`,w=!d&&(t.pathname===g||t.pathname.startsWith(g));return o.jsxs(Mt,{to:g,onClick:d?v=>v.preventDefault():void 0,className:ne("flex items-center gap-3 rounded-lg px-3 py-1.5 text-sm transition-colors",d&&"pointer-events-none text-muted-foreground/50",!d&&(w?"bg-accent/50 text-primary":"text-foreground hover:bg-accent")),children:[o.jsx(y.icon,{className:"h-4 w-4"}),o.jsx("span",{children:y.label})]},y.path)})]})]}),o.jsx("div",{className:"shrink-0 border-t border-border",children:o.jsx("div",{className:"flex",children:d3e.map(y=>{const g=d?"#":`/company/${u}${y.path}`,w=!d&&t.pathname===g;return o.jsxs(Mt,{to:g,onClick:d?v=>v.preventDefault():void 0,className:ne("flex flex-1 items-center gap-3 p-3 justify-center text-sm transition-colors border-r last:border-r-0",d&&"pointer-events-none text-muted-foreground/50",!d&&(w?"bg-accent/50 text-primary":"text-foreground hover:bg-accent")),children:[o.jsx(y.icon,{className:"h-4 w-4"}),o.jsx("span",{children:y.label})]},y.path)})})}),o.jsx("div",{className:"border-t border-border",children:o.jsx(le,{variant:"ghost",className:"w-full justify-start h-auto rounded-none px-6 py-4 cursor-pointer",onClick:()=>c("profile"),children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs(RS,{className:"h-8 w-8",children:[o.jsx(IS,{src:(s==null?void 0:s.avatarUrl)||void 0,alt:(s==null?void 0:s.fullName)||"User"}),o.jsx(DS,{className:"bg-primary/10 text-primary text-sm font-medium",children:((x=(m=s==null?void 0:s.fullName)==null?void 0:m.charAt(0))==null?void 0:x.toUpperCase())||"U"})]}),o.jsxs("div",{className:"text-left",children:[o.jsx("p",{className:"text-sm font-medium truncate max-w-[120px]",children:(s==null?void 0:s.fullName)||"User"}),o.jsx("p",{className:"text-xs text-muted-foreground truncate max-w-[120px]",children:i==null?void 0:i.email})]})]})})})]})}const Uoe=$d((t,e)=>({notifications:[],unreadCount:0,isLoading:!1,fetchNotifications:async()=>{t({isLoading:!0});try{const n=await Ce.get("/notifications"),r=n.filter(i=>!i.isRead).length;t({notifications:n,unreadCount:r})}finally{t({isLoading:!1})}},markAsRead:async n=>{await Ce.patch(`/notifications/${n}/read`),t(r=>({notifications:r.notifications.map(i=>i.id===n?{...i,isRead:!0}:i),unreadCount:Math.max(0,r.unreadCount-1)}))},markAllAsRead:async()=>{await Ce.post("/notifications/mark-all-read"),t(n=>({notifications:n.notifications.map(r=>({...r,isRead:!0})),unreadCount:0}))},addNotification:n=>{t(r=>({notifications:[n,...r.notifications],unreadCount:r.unreadCount+(n.isRead?0:1)}))},setupSocketListeners:()=>{const n=Um();n&&n.on("notification:new",({notification:r})=>{e().addNotification(r)})}}));function h3e(){const t=Nr(),{notifications:e,unreadCount:n,markAsRead:r,markAllAsRead:i}=Uoe(),[s,a]=b.useState(!1),l=u=>{u.isRead||r(u.id),u.companyId&&u.queryId?(t(`/company/${u.companyId}/prompts/${u.queryId}`),a(!1)):u.companyId&&(t(`/company/${u.companyId}`),a(!1))},c=u=>!!(u.companyId&&u.queryId)||!!u.companyId;return o.jsxs(ou,{open:s,onOpenChange:a,children:[o.jsx(lu,{asChild:!0,children:o.jsxs(le,{variant:"outline",size:"icon",className:"relative",children:[o.jsx(Mse,{className:"h-5 w-5"}),n>0&&o.jsx("span",{className:"absolute -right-1 -top-1 flex h-5 w-fit px-1.5 items-center justify-center rounded-full bg-primary text-[10px] text-primary-foreground",children:n>9?"9+":n})]})}),o.jsxs(pc,{align:"end",className:"w-80 p-0",children:[o.jsxs("div",{className:"flex items-center justify-between border-b border-border p-4",children:[o.jsx("h4",{className:"font-semibold",children:"Notifications"}),n>0&&o.jsx("button",{onClick:()=>i(),className:"text-xs text-primary hover:underline",children:"Mark all read"})]}),o.jsx("div",{className:"max-h-96 overflow-auto",children:e.length===0?o.jsx("div",{className:"p-8 text-center text-sm text-muted-foreground",children:"No notifications yet"}):e.slice(0,10).map(u=>o.jsx("button",{onClick:()=>l(u),className:`w-full border-b border-border p-4 text-left transition-colors hover:bg-accent ${u.isRead?"":"bg-primary/5"} ${c(u)?"cursor-pointer":""}`,children:o.jsxs("div",{className:"flex items-start gap-3",children:[!u.isRead&&o.jsx("div",{className:"mt-1.5 h-2 w-2 shrink-0 rounded-full bg-primary"}),o.jsxs("div",{className:`flex-1 ${u.isRead?"ml-5":""}`,children:[o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsx("p",{className:"text-sm font-medium",children:u.title}),c(u)&&o.jsx(Wr,{className:"h-3 w-3 shrink-0 text-muted-foreground mt-0.5"})]}),u.message&&o.jsx("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-2",children:u.message}),o.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:QAe(u.createdAt)})]})]})},u.id))})]})]})}function p3e(t,e=[]){let n=[];function r(s,a){const l=b.createContext(a),c=n.length;n=[...n,a];const u=f=>{var g;const{scope:h,children:p,...m}=f,x=((g=h==null?void 0:h[t])==null?void 0:g[c])||l,y=b.useMemo(()=>m,Object.values(m));return o.jsx(x.Provider,{value:y,children:p})};u.displayName=s+"Provider";function d(f,h){var x;const p=((x=h==null?void 0:h[t])==null?void 0:x[c])||l,m=b.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[u,d]}const i=()=>{const s=n.map(a=>b.createContext(a));return function(l){const c=(l==null?void 0:l[t])||s;return b.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return i.scopeName=t,[r,m3e(i,...e)]}function m3e(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));
vendor: 4,186 bytes, line 770
770return function(s){const a=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...l,...f}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return n.scopeName=e.scopeName,n}function g3e(t){const e=x3e(t),n=b.forwardRef((r,i)=>{const{children:s,...a}=r,l=b.Children.toArray(s),c=l.find(v3e);if(c){const u=c.props.children,d=l.map(f=>f===c?b.Children.count(u)>1?b.Children.only(null):b.isValidElement(u)?u.props.children:null:f);return o.jsx(e,{...a,ref:i,children:b.isValidElement(u)?b.cloneElement(u,void 0,d):null})}return o.jsx(e,{...a,ref:i,children:s})});return n.displayName=`${t}.Slot`,n}function x3e(t){const e=b.forwardRef((n,r)=>{const{children:i,...s}=n;if(b.isValidElement(i)){const a=w3e(i),l=b3e(s,i.props);return i.type!==b.Fragment&&(l.ref=r?Ir(r,a):a),b.cloneElement(i,l)}return b.Children.count(i)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var zoe=Symbol("radix.slottable");function y3e(t){const e=({children:n})=>o.jsx(o.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=zoe,e}function v3e(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===zoe}function b3e(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...l)=>{const c=s(...l);return i(...l),c}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function w3e(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var _3e=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],S3e=_3e.reduce((t,e)=>{const n=g3e(`Primitive.${e}`),r=b.forwardRef((i,s)=>{const{asChild:a,...l}=i,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function N3e(t){const e=j3e(t),n=b.forwardRef((r,i)=>{const{children:s,...a}=r,l=b.Children.toArray(s),c=l.find(k3e);if(c){const u=c.props.children,d=l.map(f=>f===c?b.Children.count(u)>1?b.Children.only(null):b.isValidElement(u)?u.props.children:null:f);return o.jsx(e,{...a,ref:i,children:b.isValidElement(u)?b.cloneElement(u,void 0,d):null})}return o.jsx(e,{...a,ref:i,children:s})});return n.displayName=`${t}.Slot`,n}function j3e(t){const e=b.forwardRef((n,r)=>{const{children:i,...s}=n;if(b.isValidElement(i)){const a=A3e(i),l=E3e(s,i.props);return i.type!==b.Fragment&&(l.ref=r?Ir(r,a):a),b.cloneElement(i,l)}return b.Children.count(i)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var C3e=Symbol("radix.slottable");function k3e(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===C3e}function E3e(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...l)=>{const c=s(...l);return i(...l),c}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function A3e(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var T3e=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],M3e=T3e.reduce((t,e)=>{const n=N3e(`Primitive.${e}`),r=b.forwardRef((i,s)=>{const{asChild:a,...l}=i,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),Boe=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"}),P3e="VisuallyHidden",Voe=b.forwardRef((t,e)=>o.jsx(M3e.span,{...t,ref:e,style:{...Boe,...t.style}}));
vendor: 8,237 bytes, line 770
770Voe.displayName=P3e;var O3e=Voe,[LT]=p3e("Tooltip",[xu]),$T=xu(),Hoe="TooltipProvider",R3e=700,tL="tooltip.open",[I3e,Jz]=LT(Hoe),Woe=t=>{const{__scopeTooltip:e,delayDuration:n=R3e,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:s}=t,a=b.useRef(!0),l=b.useRef(!1),c=b.useRef(0);return b.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),o.jsx(I3e,{scope:e,isOpenDelayedRef:a,delayDuration:n,onOpen:b.useCallback(()=>{window.clearTimeout(c.current),a.current=!1},[]),onClose:b.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>a.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:b.useCallback(u=>{l.current=u},[]),disableHoverableContent:i,children:s})};Woe.displayName=Hoe;var Y1="Tooltip",[D3e,LS]=LT(Y1),Goe=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:a,delayDuration:l}=t,c=Jz(Y1,t.__scopeTooltip),u=$T(e),[d,f]=b.useState(null),h=ys(),p=b.useRef(0),m=a??c.disableHoverableContent,x=l??c.delayDuration,y=b.useRef(!1),[g,w]=su({prop:r,defaultProp:i??!1,onChange:j=>{j?(c.onOpen(),document.dispatchEvent(new CustomEvent(tL))):c.onClose(),s==null||s(j)},caller:Y1}),v=b.useMemo(()=>g?y.current?"delayed-open":"instant-open":"closed",[g]),N=b.useCallback(()=>{window.clearTimeout(p.current),p.current=0,y.current=!1,w(!0)},[w]),S=b.useCallback(()=>{window.clearTimeout(p.current),p.current=0,w(!1)},[w]),_=b.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{y.current=!0,w(!0),p.current=0},x)},[x,w]);return b.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),o.jsx(TS,{...u,children:o.jsx(D3e,{scope:e,contentId:h,open:g,stateAttribute:v,trigger:d,onTriggerChange:f,onTriggerEnter:b.useCallback(()=>{c.isOpenDelayedRef.current?_():N()},[c.isOpenDelayedRef,_,N]),onTriggerLeave:b.useCallback(()=>{m?S():(window.clearTimeout(p.current),p.current=0)},[S,m]),onOpen:N,onClose:S,disableHoverableContent:m,children:n})})};Goe.displayName=Y1;var nL="TooltipTrigger",qoe=b.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=LS(nL,n),s=Jz(nL,n),a=$T(n),l=b.useRef(null),c=Pn(e,l,i.onTriggerChange),u=b.useRef(!1),d=b.useRef(!1),f=b.useCallback(()=>u.current=!1,[]);return b.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),o.jsx(T0,{asChild:!0,...a,children:o.jsx(S3e.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:c,onPointerMove:at(t.onPointerMove,h=>{h.pointerType!=="touch"&&!d.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),d.current=!0)}),onPointerLeave:at(t.onPointerLeave,()=>{i.onTriggerLeave(),d.current=!1}),onPointerDown:at(t.onPointerDown,()=>{i.open&&i.onClose(),u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:at(t.onFocus,()=>{u.current||i.onOpen()}),onBlur:at(t.onBlur,i.onClose),onClick:at(t.onClick,i.onClose)})})});qoe.displayName=nL;var Zz="TooltipPortal",[L3e,$3e]=LT(Zz,{forceMount:void 0}),Koe=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:i}=t,s=LS(Zz,e);return o.jsx(L3e,{scope:e,forceMount:n,children:o.jsx(Na,{present:n||s.open,children:o.jsx(Sg,{asChild:!0,container:i,children:r})})})};Koe.displayName=Zz;var fv="TooltipContent",Yoe=b.forwardRef((t,e)=>{const n=$3e(fv,t.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...s}=t,a=LS(fv,t.__scopeTooltip);return o.jsx(Na,{present:r||a.open,children:a.disableHoverableContent?o.jsx(Xoe,{side:i,...s,ref:e}):o.jsx(F3e,{side:i,...s,ref:e})})}),F3e=b.forwardRef((t,e)=>{const n=LS(fv,t.__scopeTooltip),r=Jz(fv,t.__scopeTooltip),i=b.useRef(null),s=Pn(e,i),[a,l]=b.useState(null),{trigger:c,onClose:u}=n,d=i.current,{onPointerInTransitChange:f}=r,h=b.useCallback(()=>{l(null),f(!1)},[f]),p=b.useCallback((m,x)=>{const y=m.currentTarget,g={x:m.clientX,y:m.clientY},w=V3e(g,y.getBoundingClientRect()),v=H3e(g,w),N=W3e(x.getBoundingClientRect()),S=q3e([...v,...N]);l(S),f(!0)},[f]);return b.useEffect(()=>()=>h(),[h]),b.useEffect(()=>{if(c&&d){const m=y=>p(y,d),x=y=>p(y,c);return c.addEventListener("pointerleave",m),d.addEventListener("pointerleave",x),()=>{c.removeEventListener("pointerleave",m),d.removeEventListener("pointerleave",x)}}},[c,d,p,h]),b.useEffect(()=>{if(a){const m=x=>{const y=x.target,g={x:x.clientX,y:x.clientY},w=(c==null?void 0:c.contains(y))||(d==null?void 0:d.contains(y)),v=!G3e(g,a);w?h():v&&(h(),u())};return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[c,d,a,u,h]),o.jsx(Xoe,{...t,ref:s})}),[U3e,z3e]=LT(Y1,{isInside:!1}),B3e=y3e("TooltipContent"),Xoe=b.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:a,...l}=t,c=LS(fv,n),u=$T(n),{onClose:d}=c;return b.useEffect(()=>(document.addEventListener(tL,d),()=>document.removeEventListener(tL,d)),[d]),b.useEffect(()=>{if(c.trigger){const f=h=>{const p=h.target;p!=null&&p.contains(c.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,d]),o.jsx(_g,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:o.jsxs(MS,{"data-state":c.stateAttribute,...u,...l,ref:e,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[o.jsx(B3e,{children:r}),o.jsx(U3e,{scope:n,isInside:!0,children:o.jsx(O3e,{id:c.contentId,role:"tooltip",children:i||r})})]})})});Yoe.displayName=fv;var Qoe="TooltipArrow",Joe=b.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=$T(n);return z3e(Qoe,n).isInside?null:o.jsx(PS,{...i,...r,ref:e})});Joe.displayName=Qoe;function V3e(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),i=Math.abs(e.right-t.x),s=Math.abs(e.left-t.x);switch(Math.min(n,r,i,s)){case s:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function H3e(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}function W3e(t){const{top:e,right:n,bottom:r,left:i}=t;return[{x:i,y:e},{x:n,y:e},{x:n,y:r},{x:i,y:r}]}function G3e(t,e){const{x:n,y:r}=t;let i=!1;for(let s=0,a=e.length-1;s<e.length;a=s++){const l=e[s],c=e[a],u=l.x,d=l.y,f=c.x,h=c.y;d>r!=h>r&&n<(f-u)*(r-d)/(h-d)+u&&(i=!i)}return i}function q3e(t){const e=t.slice();return e.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),K3e(e)}function K3e(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r<t.length;r++){const i=t[r];for(;e.length>=2;){const s=e[e.length-1],a=e[e.length-2];if((s.x-a.x)*(i.y-a.y)>=(s.y-a.y)*(i.x-a.x))e.pop();else break}e.push(i)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const i=t[r];for(;n.length>=2;){const s=n[n.length-1],a=n[n.length-2];if((s.x-a.x)*(i.y-a.y)>=(s.y-a.y)*(i.x-a.x))n.pop();else break}n.push(i)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var Y3e=Woe,X3e=Goe,Q3e=qoe,J3e=Koe,Z3e=Yoe,eDe=Joe;function on({delayDuration:t=0,...e}){return o.jsx(Y3e,{"data-slot":"tooltip-provider",delayDuration:t,...e})}function Ft({...t}){return o.jsx(on,{children:o.jsx(X3e,{"data-slot":"tooltip",...t})})}function Ut({...t}){return o.jsx(Q3e,{"data-slot":"tooltip-trigger",...t})}function zt({className:t,sideOffset:e=0,children:n,...r}){return o.jsx(J3e,{children:o.jsxs(Z3e,{"data-slot":"tooltip-content",sideOffset:e,className:ne("bg-foreground text-background 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
770de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",t),...r,children:[n,o.jsx(eDe,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const tDe=t=>t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/plan$/i," Plan").split(/[\s_-]+/).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ").trim();function nDe(){const{profile:t}=Rr(),{currentCompanyId:e}=Ri(),{chatBudget:n,fetchChatBudget:r}=ca(),[i,s]=b.useState([]);b.useEffect(()=>{Ce.get("/billing/plans").then(s).catch(()=>{})},[]),b.useEffect(()=>{e&&r(e)},[e,r]);const a=()=>{const l=(t==null?void 0:t.subscriptionTier)||"free",c=d=>d.toLowerCase().replace(/[^a-z0-9]/g,""),u=i.find(d=>c(d.name)===l);return u?u.name:tDe(l)};return o.jsxs("header",{className:"flex h-16 items-center justify-between border-b border-border bg-card/50 px-4",children:[o.jsx("div",{}),o.jsxs("div",{className:"flex items-center gap-3",children:[t&&o.jsx(on,{delayDuration:300,children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(Ft,{children:[o.jsx(Ut,{asChild:!0,children:o.jsxs(Mt,{to:"/settings/billing",className:"flex items-center rounded-md overflow-hidden text-sm cursor-pointer border p-0",children:[o.jsx("span",{className:"flex h-6 items-center justify-center px-2 border-r",children:o.jsx(Mo,{className:"h-3 w-3 text-muted-foreground"})}),o.jsxs("span",{className:"text-muted-foreground px-2",children:[t.promptsUsed,o.jsxs("span",{className:"text-muted-foreground/60",children:[" / ",t.promptsLimit]})]})]})}),o.jsx(zt,{children:o.jsx("p",{children:"Prompts used"})})]}),o.jsxs(Ft,{children:[o.jsx(Ut,{asChild:!0,children:o.jsxs(Mt,{to:"/settings/billing",className:"flex items-center border p-0 text-sm cursor-pointer rounded-md overflow-hidden",children:[o.jsx("span",{className:"flex h-6 items-center justify-center px-2 border-r",children:o.jsx(SS,{className:"h-3 w-3 text-muted-foreground "})}),o.jsx("span",{className:"text-muted-foreground px-2",children:t.tokenBalance})]})}),o.jsx(zt,{children:o.jsx("p",{children:"Run tokens"})})]}),n&&o.jsxs(Ft,{children:[o.jsx(Ut,{asChild:!0,children:o.jsxs(Mt,{to:"/settings/billing",className:"flex items-center border p-0 text-sm cursor-pointer rounded-md overflow-hidden",children:[o.jsx("span",{className:"flex h-6 items-center justify-center px-2 border-r",children:o.jsx(ga,{className:"h-3 w-3 text-muted-foreground"})}),o.jsxs("span",{className:"text-muted-foreground px-2",children:[n.usedThisMonth,o.jsxs("span",{className:"text-muted-foreground/60",children:[" / ",n.monthlyLimit]})]})]})}),o.jsx(zt,{children:o.jsx("p",{children:"Agent chats this month"})})]}),o.jsxs(Ft,{children:[o.jsx(Ut,{asChild:!0,children:o.jsx(Mt,{to:"/settings/billing",className:"rounded-md bg-primary/10 px-2.5 py-0.5 hover:bg-primary/20 border transition-colors",children:o.jsx("span",{className:"font-medium text-primary text-sm",children:a()})})}),o.jsx(zt,{children:o.jsx("p",{children:"Manage subscription"})})]})]})}),o.jsx(h3e,{})]})]})}function rDe(){const{isOpen:t,toggleOpen:e}=ca();return o.jsx("button",{onClick:e,className:ne("fixed bottom-5 right-5 z-50 flex h-10 w-10 cursor-pointer hover:bg-muted items-center justify-center rounded-lg border-2 border-primary ring-1 ring-primary/10 ring-offset-2 ring-offset-background shadow-lg","bg-background text-primary hover:ring-primary/30 rotate-0",t&&"rotate-90 rounded-full text-muted-foreground hover:ring-destructive/30 border-border ring-border/50 hover:text-destructive"),children:t?o.jsx(mr,{className:"h-4 w-4"}):o.jsx(Hn,{src:"/images/logo/logo-icon-current-color.svg",alt:"AI Agent",className:"h-4 w-4 text-primary"})})}function iDe(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const sDe=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,aDe=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,oDe={};function WH(t,e){return(oDe.jsx?aDe:sDe).test(t)}const lDe=/[ \t\n\f\r]/g;function cDe(t){return typeof t=="object"?t.type==="text"?GH(t.value):!1:GH(t)}function GH(t){return t.replace(lDe,"")===""}let $S=class{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}};$S.prototype.normal={};$S.prototype.property={};$S.prototype.space=void 0;function Zoe(t,e){const n={},r={};for(const i of t)Object.assign(n,i.property),Object.assign(r,i.normal);return new $S(n,r,e)}function rL(t){return t.toLowerCase()}class Ja{constructor(e,n){this.attribute=n,this.property=e}}Ja.prototype.attribute="";Ja.prototype.booleanish=!1;Ja.prototype.boolean=!1;Ja.prototype.commaOrSpaceSeparated=!1;Ja.prototype.commaSeparated=!1;Ja.prototype.defined=!1;Ja.prototype.mustUseProperty=!1;Ja.prototype.number=!1;Ja.prototype.overloadedBoolean=!1;Ja.prototype.property="";Ja.prototype.spaceSeparated=!1;Ja.prototype.space=void 0;let uDe=0;const mn=Ng(),Si=Ng(),iL=Ng(),Ze=Ng(),kr=Ng(),ky=Ng(),io=Ng();function Ng(){return 2**++uDe}const sL=Object.freeze(Object.defineProperty({__proto__:null,boolean:mn,booleanish:Si,commaOrSpaceSeparated:io,commaSeparated:ky,number:Ze,overloadedBoolean:iL,spaceSeparated:kr},Symbol.toStringTag,{value:"Module"})),CR=Object.keys(sL);class e6 extends Ja{constructor(e,n,r,i){let s=-1;if(super(e,n),qH(this,"space",i),typeof r=="number")for(;++s<CR.length;){const a=CR[s];qH(this,CR[s],(r&sL[a])===sL[a])}}}e6.prototype.defined=!0;function qH(t,e,n){n&&(t[e]=n)}function M0(t){const e={},n={};for(const[r,i]of Object.entries(t.properties)){const s=new e6(r,t.transform(t.attributes||{},r),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),e[r]=s,n[rL(r)]=r,n[rL(s.attribute)]=r}return new $S(e,n,t.space)}const ele=M0({properties:{ariaActiveDescendant:null,ariaAtomic:Si,ariaAutoComplete:null,ariaBusy:Si,ariaChecked:Si,ariaColCount:Ze,ariaColIndex:Ze,ariaColSpan:Ze,ariaControl
vendor: 5,440 bytes, line 770
770s:kr,ariaCurrent:null,ariaDescribedBy:kr,ariaDetails:null,ariaDisabled:Si,ariaDropEffect:kr,ariaErrorMessage:null,ariaExpanded:Si,ariaFlowTo:kr,ariaGrabbed:Si,ariaHasPopup:null,ariaHidden:Si,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:kr,ariaLevel:Ze,ariaLive:null,ariaModal:Si,ariaMultiLine:Si,ariaMultiSelectable:Si,ariaOrientation:null,ariaOwns:kr,ariaPlaceholder:null,ariaPosInSet:Ze,ariaPressed:Si,ariaReadOnly:Si,ariaRelevant:null,ariaRequired:Si,ariaRoleDescription:kr,ariaRowCount:Ze,ariaRowIndex:Ze,ariaRowSpan:Ze,ariaSelected:Si,ariaSetSize:Ze,ariaSort:null,ariaValueMax:Ze,ariaValueMin:Ze,ariaValueNow:Ze,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function tle(t,e){return e in t?t[e]:e}function nle(t,e){return tle(t,e.toLowerCase())}const dDe=M0({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ky,acceptCharset:kr,accessKey:kr,action:null,allow:null,allowFullScreen:mn,allowPaymentRequest:mn,allowUserMedia:mn,alt:null,as:null,async:mn,autoCapitalize:null,autoComplete:kr,autoFocus:mn,autoPlay:mn,blocking:kr,capture:null,charSet:null,checked:mn,cite:null,className:kr,cols:Ze,colSpan:null,content:null,contentEditable:Si,controls:mn,controlsList:kr,coords:Ze|ky,crossOrigin:null,data:null,dateTime:null,decoding:null,default:mn,defer:mn,dir:null,dirName:null,disabled:mn,download:iL,draggable:Si,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:mn,formTarget:null,headers:kr,height:Ze,hidden:iL,high:Ze,href:null,hrefLang:null,htmlFor:kr,httpEquiv:kr,id:null,imageSizes:null,imageSrcSet:null,inert:mn,inputMode:null,integrity:null,is:null,isMap:mn,itemId:null,itemProp:kr,itemRef:kr,itemScope:mn,itemType:kr,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:mn,low:Ze,manifest:null,max:null,maxLength:Ze,media:null,method:null,min:null,minLength:Ze,multiple:mn,muted:mn,name:null,nonce:null,noModule:mn,noValidate:mn,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:mn,optimum:Ze,pattern:null,ping:kr,placeholder:null,playsInline:mn,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:mn,referrerPolicy:null,rel:kr,required:mn,reversed:mn,rows:Ze,rowSpan:Ze,sandbox:kr,scope:null,scoped:mn,seamless:mn,selected:mn,shadowRootClonable:mn,shadowRootDelegatesFocus:mn,shadowRootMode:null,shape:null,size:Ze,sizes:null,slot:null,span:Ze,spellCheck:Si,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ze,step:null,style:null,tabIndex:Ze,target:null,title:null,translate:null,type:null,typeMustMatch:mn,useMap:null,value:Si,width:Ze,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:kr,axis:null,background:null,bgColor:null,border:Ze,borderColor:null,bottomMargin:Ze,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:mn,declare:mn,event:null,face:null,frame:null,frameBorder:null,hSpace:Ze,leftMargin:Ze,link:null,longDesc:null,lowSrc:null,marginHeight:Ze,marginWidth:Ze,noResize:mn,noHref:mn,noShade:mn,noWrap:mn,object:null,profile:null,prompt:null,rev:null,rightMargin:Ze,rules:null,scheme:null,scrolling:Si,standby:null,summary:null,text:null,topMargin:Ze,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ze,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:mn,disableRemotePlayback:mn,prefix:null,property:null,results:Ze,security:null,unselectable:null},space:"html",transform:nle}),fDe=M0({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRen
770dering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:io,accentHeight:Ze,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ze,amplitude:Ze,arabicForm:null,ascent:Ze,attributeName:null,attributeType:null,azimuth:Ze,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ze,by:null,calcMode:null,capHeight:Ze,className:kr,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRen
770dering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Ze,diffuseConstant:Ze,direction:null,display:null,dur:null,divisor:Ze,dominantBaseline:null,download:mn,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ze,enableBackground:null,end:null,event:null,exponent:Ze,externalResourcesRequired:null,fill:null,fillOpacity:Ze,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ky,g2:ky,glyphName:ky,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ze,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ze,horizOriginX:Ze,horizOriginY:Ze,id:null,ideographic:Ze,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ze,k:Ze,k1:Ze,k2:Ze,k3:Ze,k4:Ze,kernelMatrix:io,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ze,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Ze,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Ze,overlineThickness:Ze,paintOrder:null,panose1:null,path:null,pathLength:Ze,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:kr,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ze,pointsAtY:Ze,pointsAtZ:Ze,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:io,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:io,rev:io,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:io,requiredFeatures:io,requiredFonts:io,requiredFormats:io,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Ze,specularExponent:Ze,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ze,strikethroughThickness:Ze,string:null,stroke:null,strokeDashArray:io,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ze,strokeOpacity:Ze,strokeWidth:null,style:null,surfaceScale:Ze,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:io,tabIndex:Ze,tableValues:null,target:null,targetX:Ze,targetY:Ze,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:io,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ze,underlineThickness:Ze,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ze,values:null,vAlphabetic:Ze,vMathematical:Ze,vectorEffect:null,vHanging:Ze,vIdeographic:Ze,version:null,vertAdvY:Ze,vertOriginX:Ze,vertOriginY:Ze,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ze,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:tle}),rle=M0({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}
vendor: 4,837 bytes, lines 770-771
770,space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),ile=M0({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:nle}),sle=M0({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),hDe={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},pDe=/[A-Z]/g,KH=/-[a-z]/g,mDe=/^data[-\w.:]+$/i;function gDe(t,e){const n=rL(e);let r=e,i=Ja;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&mDe.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(KH,yDe);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!KH.test(s)){let a=s.replace(pDe,xDe);a.charAt(0)!=="-"&&(a="-"+a),e="data"+a}}i=e6}return new i(r,e)}function xDe(t){return"-"+t.toLowerCase()}function yDe(t){return t.charAt(1).toUpperCase()}const vDe=Zoe([ele,dDe,rle,ile,sle],"html"),t6=Zoe([ele,fDe,rle,ile,sle],"svg");function bDe(t){return t.join(" ").trim()}var n6={},YH=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,wDe=/\n/g,_De=/^\s*/,SDe=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,NDe=/^:\s*/,jDe=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,CDe=/^[;\s]*/,kDe=/^\s+|\s+$/g,EDe=`
771`,XH="/",QH="*",Up="",ADe="comment",TDe="declaration";function MDe(t,e){if(typeof t!="string")throw new TypeError("First argument must be a string");if(!t)return[];e=e||{};var n=1,r=1;function i(m){var x=m.match(wDe);x&&(n+=x.length);var y=m.lastIndexOf(EDe);r=~y?m.length-y:r+m.length}function s(){var m={line:n,column:r};return function(x){return x.position=new a(m),u(),x}}function a(m){this.start=m,this.end={line:n,column:r},this.source=e.source}a.prototype.content=t;function l(m){var x=new Error(e.source+":"+n+":"+r+": "+m);if(x.reason=m,x.filename=e.source,x.line=n,x.column=r,x.source=t,!e.silent)throw x}function c(m){var x=m.exec(t);if(x){var y=x[0];return i(y),t=t.slice(y.length),x}}function u(){c(_De)}function d(m){var x;for(m=m||[];x=f();)x!==!1&&m.push(x);return m}function f(){var m=s();if(!(XH!=t.charAt(0)||QH!=t.charAt(1))){for(var x=2;Up!=t.charAt(x)&&(QH!=t.charAt(x)||XH!=t.charAt(x+1));)++x;if(x+=2,Up===t.charAt(x-1))return l("End of comment missing");var y=t.slice(2,x-2);return r+=2,i(y),t=t.slice(x),r+=2,m({type:ADe,comment:y})}}function h(){var m=s(),x=c(SDe);if(x){if(f(),!c(NDe))return l("property missing ':'");var y=c(jDe),g=m({type:TDe,property:JH(x[0].replace(YH,Up)),value:y?JH(y[0].replace(YH,Up)):Up});return c(CDe),g}}function p(){var m=[];d(m);for(var x;x=h();)x!==!1&&(m.push(x),d(m));return m}return u(),p()}function JH(t){return t?t.replace(kDe,Up):Up}var PDe=MDe,ODe=Vf&&Vf.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(n6,"__esModule",{value:!0});n6.default=IDe;const RDe=ODe(PDe);function IDe(t,e){let n=null;if(!t||typeof t!="string")return n;const r=(0,RDe.default)(t),i=typeof e=="function";return r.forEach(s=>{if(s.type!=="declaration")return;const{property:a,value:l}=s;i?e(a,l,s):l&&(n=n||{},n[a]=l)}),n}var FT={};Object.defineProperty(FT,"__esModule",{value:!0});FT.camelCase=void 0;var DDe=/^--[a-zA-Z0-9_-]+$/,LDe=/-([a-z])/g,$De=/^[^-]+$/,FDe=/^-(webkit|moz|ms|o|khtml)-/,UDe=/^-(ms)-/,zDe=function(t){return!t||$De.test(t)||DDe.test(t)},BDe=function(t,e){return e.toUpperCase()},ZH=function(t,e){return"".concat(e,"-")},VDe=function(t,e){return e===void 0&&(e={}),zDe(t)?t:(t=t.toLowerCase(),e.reactCompat?t=t.replace(UDe,ZH):t=t.replace(FDe,ZH),t.replace(LDe,BDe))};FT.camelCase=VDe;var HDe=Vf&&Vf.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},WDe=HDe(n6),GDe=FT;function aL(t,e){var n={};return!t||typeof t!="string"||(0,WDe.default)(t,function(r,i){r&&i&&(n[(0,GDe.camelCase)(r,e)]=i)}),n}aL.default=aL;var qDe=aL;const KDe=An(qDe),ale=ole("end"),r6=ole("start");function ole(t){return e;function e(n){const r=n&&n.position&&n.position[t]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function YDe(t){const e=r6(t),n=ale(t);if(e&&n)return{start:e,end:n}}function $w(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?eW(t.position):"start"in t||"end"in t?eW(t):"line"in t||"column"in t?oL(t):""}function oL(t){return tW(t&&t.line)+":"+tW(t&&t.column)}function eW(t){return oL(t&&t.start)+"-"+oL(t&&t.end)}function tW(t){return t&&typeof t=="number"?t:1}
vendor: 1,928 bytes, line 771
771class Js extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},a=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof e=="string"?i=e:!s.cause&&e&&(a=!0,i=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?s.ruleId=r:(s.source=r.slice(0,c),s.ruleId=r.slice(c+1))}if(!s.place&&s.ancestors&&s.ancestors){const c=s.ancestors[s.ancestors.length-1];c&&(s.place=c.position)}const l=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=l?l.line:void 0,this.name=$w(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=a&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Js.prototype.file="";Js.prototype.name="";Js.prototype.reason="";Js.prototype.message="";Js.prototype.stack="";Js.prototype.column=void 0;Js.prototype.line=void 0;Js.prototype.ancestors=void 0;Js.prototype.cause=void 0;Js.prototype.fatal=void 0;Js.prototype.place=void 0;Js.prototype.ruleId=void 0;Js.prototype.source=void 0;const i6={}.hasOwnProperty,XDe=new Map,QDe=/[A-Z]/g,JDe=new Set(["table","tbody","thead","tfoot","tr"]),ZDe=new Set(["td","th"]),lle="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function e4e(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let r;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=l4e(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");
vendor: 6,360 bytes, line 771
771if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=o4e(n,e.jsx,e.jsxs)}const i={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:r,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?t6:vDe,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=cle(i,t,void 0);return s&&typeof s!="string"?s:i.create(t,i.Fragment,{children:s||void 0},void 0)}function cle(t,e,n){if(e.type==="element")return t4e(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return n4e(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return i4e(t,e,n);if(e.type==="mdxjsEsm")return r4e(t,e);if(e.type==="root")return s4e(t,e,n);if(e.type==="text")return a4e(t,e)}function t4e(t,e,n){const r=t.schema;let i=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=t6,t.schema=i),t.ancestors.push(e);const s=dle(t,e.tagName,!1),a=c4e(t,e);let l=a6(t,e);return JDe.has(e.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!cDe(c):!0})),ule(t,a,s,e),s6(a,l),t.ancestors.pop(),t.schema=r,t.create(e,s,a,n)}function n4e(t,e){if(e.data&&e.data.estree&&t.evaluater){const r=e.data.estree.body[0];return r.type,t.evaluater.evaluateExpression(r.expression)}X1(t,e.position)}function r4e(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);X1(t,e.position)}function i4e(t,e,n){const r=t.schema;let i=r;e.name==="svg"&&r.space==="html"&&(i=t6,t.schema=i),t.ancestors.push(e);const s=e.name===null?t.Fragment:dle(t,e.name,!0),a=u4e(t,e),l=a6(t,e);return ule(t,a,s,e),s6(a,l),t.ancestors.pop(),t.schema=r,t.create(e,s,a,n)}function s4e(t,e,n){const r={};return s6(r,a6(t,e)),t.create(e,t.Fragment,r,n)}function a4e(t,e){return e.value}function ule(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function s6(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function o4e(t,e,n){return r;function r(i,s,a,l){const u=Array.isArray(a.children)?n:e;return l?u(s,a,l):u(s,a)}}function l4e(t,e){return n;function n(r,i,s,a){const l=Array.isArray(s.children),c=r6(r);return e(i,s,a,l,{columnNumber:c?c.column-1:void 0,fileName:t,lineNumber:c?c.line:void 0},void 0)}}function c4e(t,e){const n={};let r,i;for(i in e.properties)if(i!=="children"&&i6.call(e.properties,i)){const s=d4e(t,i,e.properties[i]);if(s){const[a,l]=s;t.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&ZDe.has(e.tagName)?r=l:n[a]=l}}if(r){const s=n.style||(n.style={});s[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function u4e(t,e){const n={};for(const r of e.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&t.evaluater){const s=r.data.estree.body[0];s.type;const a=s.expression;a.type;const l=a.properties[0];l.type,Object.assign(n,t.evaluater.evaluateExpression(l.argument))}else X1(t,e.position);else{const i=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&t.evaluater){const l=r.value.data.estree.body[0];l.type,s=t.evaluater.evaluateExpression(l.expression)}else X1(t,e.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function a6(t,e){const n=[];let r=-1;const i=t.passKeys?new Map:XDe;for(;++r<e.children.length;){const s=e.children[r];let a;if(t.passKeys){const c=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(c){const u=i.get(c)||0;a=c+"-"+u,i.set(c,u+1)}}const l=cle(t,s,a);l!==void 0&&n.push(l)}return n}function d4e(t,e,n){const r=gDe(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?iDe(n):bDe(n)),r.property==="style"){let i=typeof n=="object"?n:f4e(t,String(n));return t.stylePropertyNameCase==="css"&&(i=h4e(i)),["style",i]}return[t.elementAttributeNameCase==="react"&&r.space?hDe[r.property]||r.property:r.attribute,n]}}function f4e(t,e){try{return KDe(e,{reactCompat:!0})}catch(n){if(t.ignoreInvalidStyle)return{};const r=n,i=new Js("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=t.filePath||void 0,i.url=lle+"#cannot-parse-style-attribute",i}}function dle(t,e,n){let r;if(!n)r={type:"Literal",value:e};else if(e.includes(".")){const i=e.split(".");let s=-1,a;for(;++s<i.length;){const l=WH(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};a=a?{type:"MemberExpression",object:a,property:l,computed:!!(s&&l.type==="Literal"),optional:!1}:l}r=a}else r=WH(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(r.type==="Literal"){const i=r.value;return i6.call(t.components,i)?t.components[i]:i}if(t.evaluater)return t.evaluater.evaluateExpression(r);X1(t)}function X1(t,e){const n=new Js("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=t.filePath||void 0,n.url=lle+"#cannot-handle-mdx-estrees-without-createevaluater",n}function h4e(t){const e={};let n;for(n in t)i6.call(t,n)&&(e[p4e(n)]=t[n]);return e}function p4e(t){let e=t.replace(QDe,m4e);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function m4e(t){return"-"+t.toLowerCase()}const kR={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},g4e={};function o6(t,e){const n=g4e,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return fle(t,r,i)}function fle(t,e,n){if(x4e(t)){if("value"in t)return t.type==="html"&&!n?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return nW(t.children,e,n)}return Array.isArray(t)?nW(t,e,n):""}function nW(t,e,n){const r=[];let i=-1;for(;++i<t.length;)r[i]=fle(t[i],e,n);return r.join("")}function x4e(t){return!!(t&&typeof t=="object")}const rW=document.createElement("i");function l6(t){const e="&"+t+";";rW.innerHTML=e;const n=rW.textContent;
vendor: 10,926 bytes, line 771
771return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function _o(t,e,n,r){const i=t.length;let s=0,a;if(e<0?e=-e>i?0:i+e:e=e>i?i:e,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(e,n),t.splice(...a);else for(n&&t.splice(e,n);s<r.length;)a=r.slice(s,s+1e4),a.unshift(e,0),t.splice(...a),s+=1e4,e+=1e4}function Zo(t,e){return t.length>0?(_o(t,t.length,0,e),t):e}const iW={}.hasOwnProperty;function hle(t){const e={};let n=-1;for(;++n<t.length;)y4e(e,t[n]);return e}function y4e(t,e){let n;for(n in e){const i=(iW.call(t,n)?t[n]:void 0)||(t[n]={}),s=e[n];let a;if(s)for(a in s){iW.call(i,a)||(i[a]=[]);const l=s[a];v4e(i[a],Array.isArray(l)?l:l?[l]:[])}}}function v4e(t,e){let n=-1;const r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);_o(t,0,0,r)}function ple(t,e){const n=Number.parseInt(t,e);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function oc(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ua=Jh(/[A-Za-z]/),Ks=Jh(/[\dA-Za-z]/),b4e=Jh(/[#-'*+\--9=?A-Z^-~]/);function a2(t){return t!==null&&(t<32||t===127)}const lL=Jh(/\d/),w4e=Jh(/[\dA-Fa-f]/),_4e=Jh(/[!-/:-@[-`{-~]/);function Gt(t){return t!==null&&t<-2}function Sr(t){return t!==null&&(t<0||t===32)}function Cn(t){return t===-2||t===-1||t===32}const UT=Jh(new RegExp("\\p{P}|\\p{S}","u")),Hm=Jh(/\s/);function Jh(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function P0(t){const e=[];let n=-1,r=0,i=0;for(;++n<t.length;){const s=t.charCodeAt(n);let a="";if(s===37&&Ks(t.charCodeAt(n+1))&&Ks(t.charCodeAt(n+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(a=String.fromCharCode(s));else if(s>55295&&s<57344){const l=t.charCodeAt(n+1);s<56320&&l>56319&&l<57344?(a=String.fromCharCode(s,l),i=1):a="�"}else a=String.fromCharCode(s);a&&(e.push(t.slice(r,n),encodeURIComponent(a)),r=n+i+1,a=""),i&&(n+=i,i=0)}return e.join("")+t.slice(r)}function In(t,e,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return a;function a(c){return Cn(c)?(t.enter(n),l(c)):e(c)}function l(c){return Cn(c)&&s++<i?(t.consume(c),l):(t.exit(n),e(c))}}const S4e={tokenize:N4e};function N4e(t){const e=t.attempt(this.parser.constructs.contentInitial,r,i);let n;return e;function r(l){if(l===null){t.consume(l);return}return t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),In(t,e,"linePrefix")}function i(l){return t.enter("paragraph"),s(l)}function s(l){const c=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,a(l)}function a(l){if(l===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(l);return}return Gt(l)?(t.consume(l),t.exit("chunkText"),s):(t.consume(l),a)}}const j4e={tokenize:C4e},sW={tokenize:k4e};function C4e(t){const e=this,n=[];let r=0,i,s,a;return l;function l(v){if(r<n.length){const N=n[r];return e.containerState=N[1],t.attempt(N[0].continuation,c,u)(v)}return u(v)}function c(v){if(r++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&w();const N=e.events.length;let S=N,_;for(;S--;)if(e.events[S][0]==="exit"&&e.events[S][1].type==="chunkFlow"){_=e.events[S][1].end;break}g(r);let j=N;for(;j<e.events.length;)e.events[j][1].end={..._},j++;return _o(e.events,S+1,0,e.events.slice(N)),e.events.length=j,u(v)}return l(v)}function u(v){if(r===n.length){if(!i)return h(v);if(i.currentConstruct&&i.currentConstruct.concrete)return m(v);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(sW,d,f)(v)}function d(v){return i&&w(),g(r),h(v)}function f(v){return e.parser.lazy[e.now().line]=r!==n.length,a=e.now().offset,m(v)}function h(v){return e.containerState={},t.attempt(sW,p,m)(v)}function p(v){return r++,n.push([e.currentConstruct,e.containerState]),h(v)}function m(v){if(v===null){i&&w(),g(0),t.consume(v);return}return i=i||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),x(v)}function x(v){if(v===null){y(t.exit("chunkFlow"),!0),g(0),t.consume(v);return}return Gt(v)?(t.consume(v),y(t.exit("chunkFlow")),r=0,e.interrupt=void 0,l):(t.consume(v),x)}function y(v,N){const S=e.sliceStream(v);if(N&&S.push(null),v.previous=s,s&&(s.next=v),s=v,i.defineSkip(v.start),i.write(S),e.parser.lazy[v.start.line]){let _=i.events.length;for(;_--;)if(i.events[_][1].start.offset<a&&(!i.events[_][1].end||i.events[_][1].end.offset>a))return;const j=e.events.length;let A=j,C,k;for(;A--;)if(e.events[A][0]==="exit"&&e.events[A][1].type==="chunkFlow"){if(C){k=e.events[A][1].end;break}C=!0}for(g(r),_=j;_<e.events.length;)e.events[_][1].end={...k},_++;_o(e.events,A+1,0,e.events.slice(j)),e.events.length=_}}function g(v){let N=n.length;for(;N-- >v;){const S=n[N];e.containerState=S[1],S[0].exit.call(e,t)}n.length=v}function w(){i.write([null]),s=void 0,i=void 0,e.containerState._closeFlow=void 0}}function k4e(t,e,n){return In(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function hv(t){if(t===null||Sr(t)||Hm(t))return 1;if(UT(t))return 2}function zT(t,e,n){const r=[];let i=-1;for(;++i<t.length;){const s=t[i].resolveAll;s&&!r.includes(s)&&(e=s(e,n),r.push(s))}return e}const cL={name:"attention",resolveAll:E4e,tokenize:A4e};function E4e(t,e){let n=-1,r,i,s,a,l,c,u,d;for(;++n<t.length;)if(t[n][0]==="enter"&&t[n][1].type==="attentionSequence"&&t[n][1]._close){for(r=n;r--;)if(t[r][0]==="exit"&&t[r][1].type==="attentionSequence"&&t[r][1]._open&&e.sliceSerialize(t[r][1]).charCodeAt(0)===e.sliceSerialize(t[n][1]).charCodeAt(0)){if((t[r][1]._close||t[n][1]._open)&&(t[n][1].end.offset-t[n][1].start.offset)%3&&!((t[r][1].end.offset-t[r][1].start.offset+t[n][1].end.offset-t[n][1].start.offset)%3))continue;c=t[r][1].end.offset-t[r][1].start.offset>1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const f={...t[r][1].end},h={...t[n][1].start};aW(f,-c),aW(h,c),a={type:c>1?"strongSequence":"emphasisSequence",start:f,end:{...t[r][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:h},s={type:c>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},i={type:c>1?"strong":"emphasis",start:{...a.start},end:{...l.end}},t[r][1].end={...a.start},t[n][1].start={...l.end},u=[],t[r][1].end.offset-t[r][1].start.offset&&(u=Zo(u,[["enter",t[r][1],e],["exit",t[r][1],e]])),u=Zo(u,[["enter",i,e],["enter",a,e],["exit",a,e],["enter",s,e]]),u=Zo(u,zT(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),u=Zo(u,[["exit",s,e],["enter",l,e],["exit",l,e],["exit",i,e]]),t[n][1].end.offset-t[n][1].start.offset?(d=2,u=Zo(u,[["enter",t[n][1],e],["exit",t[n][1],e]])):d=0,_o(t,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function A4e(t,e){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=hv(r);let s;return a;function a(c){return s=c,t.enter("attentionSequence"),l(c)}function l(c){if(c===s)return t.consume(c),l;const u=t.exit("attentionSequence"),d=hv(c),f=!d||d===2&&i||n.includes(c),h=!i||i===2&&d||n.includes(r);return u._open=!!(s===42?f:f&&(i||!h)),u._close=!!(s===42?h:h&&(d||!f)),e(c)}}function aW(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const T4e={name:"autolink",tokenize:M4e};function M4e(t,e,n){let r=0;return i;function i(p){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(p),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),s}function s(p){return ua(p)?(t.consume(p),a):p===64?n(p):u(p)}function a(p){return p===43||p===45||p===46||Ks(p)?(r=1,l(p)):u(p)}function l(p){return p===58?(t.consume(p),r=0,c):(p===43||p===45||p===46||Ks(p))&&r++<32?(t.consume(p),l):(r=0,u(p))}function c(p){return p===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(p),t.exit("autolinkMarker"),t.exit("autolink"),e):p===null||p===32||p===60||a2(p)?n(p):(t.consume(p),c)}function u(p){return p===64?(t.consume(p),d):b4e(p)?(t.consume(p),u):n(p)}function d(p){return Ks(p)?f(p):n(p)}function f(p){return p===46?(t.consume(p),r=0,d):p===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(p),t.exit("autolinkMarker"),t.exit("autolink"),e):h(p)}function h(p){if((p===45||Ks(p))&&r++<63){const m=p===45?h:f;return t.consume(p),m}return n(p)}}const FS={partial:!0,tokenize:P4e};function P4e(t,e,n){return r;function r(s){return Cn(s)?In(t,i,"linePrefix")(s):i(s)}function i(s){return s===null||Gt(s)?e(s):n(s)}}const mle={continuation:{tokenize:R4e},exit:I4e,name:"blockQuote",tokenize:O4e};function O4e(t,e,n){const r=this;return i;function i(a){if(a===62){const l=r.containerState;return l.open||(t.enter("blockQuote",{_container:!0}),l.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(a),t.exit("blockQuoteMarker"),s}return n(a)}function s(a){return Cn(a)?(t.enter("blockQuotePrefixWhitespace"),t.consume(a),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(a))}}function R4e(t,e,n){const r=this;return i;function i(a){return Cn(a)?In(t,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):s(a)}function s(a){return t.attempt(mle,e,n)(a)}}function I4e(t){t.exit("blockQuote")}const gle={name:"characterEscape",tokenize:D4e};function D4e(t,e,n){return r;function r(s){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(s),t.exit("escapeMarker"),i}function i(s){return _4e(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(s)}}const xle={name:"characterReference",tokenize:L4e};function L4e(t,e,n){const r=this;let i=0,s,a;return l;function l(f){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(f),t.exit("characterReferenceMarker"),c}function c(f){return f===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(f),t.exit("characterReferenceMarkerNumeric"),u):(t.enter("characterReferenceValue"),s=31,a=Ks,d(f))}function u(f){return f===88||f===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(f),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),s=6,a=w4e,d):(t.enter("characterReferenceValue"),s=7,a=lL,d(f))}function d(f){if(f===59&&i){const h=t.exit("characterReferenceValue");return a===Ks&&!l6(r.sliceSerialize(h))?n(f):(t.enter("characterReferenceMarker"),t.consume(f),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return a(f)&&i++<s?(t.consume(f),d):n(f)}}const oW={partial:!0,tokenize:F4e},lW={concrete:!0,name:"codeFenced",tokenize:$4e};function $4e(t,e,n){const r=this,i={partial:!0,tokenize:S};let s=0,a=0,l;return c;function c(_){return u(_)}function u(_){const j=r.events[r.events.length-1];return s=j&&j[1].type==="linePrefix"?j[2].sliceSerialize(j[1],!0).length:0,l=_,t.enter("co
771deFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),d(_)}function d(_){return _===l?(a++,t.consume(_),d):a<3?n(_):(t.exit("codeFencedFenceSequence"),Cn(_)?In(t,f,"whitespace")(_):f(_))}function f(_){return _===null||Gt(_)?(t.exit("codeFencedFence"),r.interrupt?e(_):t.check(oW,x,N)(_)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),h(_))}function h(_){return _===null||Gt(_)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),f(_)):Cn(_)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),In(t,p,"whitespace")(_)):_===96&&_===l?n(_):(t.consume(_),h)}function p(_){return _===null||Gt(_)?f(_):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),m(_))}function m(_){return _===null||Gt(_)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),f(_)):_===96&&_===l?n(_):(t.consume(_),m)}function x(_){return t.attempt(i,N,y)(_)}function y(_){return t.enter("lineEnding"),t.consume(_),t.exit("lineEnding"),g}function g(_){return s>0&&Cn(_)?In(t,w,"linePrefix",s+1)(_):w(_)}function w(_){return _===null||Gt(_)?t.check(oW,x,N)(_):(t.enter("codeFlowValue"),v(_))}function v(_){return _===null||Gt(_)?(t.exit("codeFlowValue"),w(_)):(t.consume(_),v)}function N(_){return t.exit("codeFenced"),e(_)}function S(_,j,A){let C=0;return k;function k(P){return _.enter("lineEnding"),_.consume(P),_.exit("lineEnding"),M}function M(P){return _.enter("codeFencedFence"),Cn(P)?In(_,I,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):I(P)}function I(P){return P===l?(_.enter("codeFencedFenceSequence"),R(P)):A(P)}function R(P){return P===l?(C++,_.consume(P),R):C>=a?(_.exit("codeFencedFenceSequence"),Cn(P)?In(_,E,"whitespace")(P):E(P)):A(P)}function E(P){return P===null||Gt(P)?(_.exit("codeFencedFence"),j(P)):A(P)}}}function F4e(t,e,n){const r=this;return i;function i(a){return a===null?n(a):(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),s)}function s(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}const ER={name:"codeIndented",tokenize:z4e},U4e={partial:!0,tokenize:B4e};function z4e(t,e,n){const r=this;return i;function i(u){return t.enter("codeIndented"),In(t,s,"linePrefix",5)(u)}function s(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?a(u):n(u)}function a(u){return u===null?c(u):Gt(u)?t.attempt(U4e,a,c)(u):(t.enter("codeFlowValue"),l(u))}function l(u){return u===null||Gt(u)?(t.exit("codeFlowValue"),a(u)):(t.consume(u),l)}function c(u){return t.exit("codeIndented"),e(u)}}function B4e(t,e,n){const r=this;return i;function i(a){return r.parser.lazy[r.now().line]?n(a):Gt(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),i):In(t,s,"linePrefix",5)(a)}function s(a){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?e(a):Gt(a)?i(a):n(a)}}const V4e={name:"codeText",previous:W4e,resolve:H4e,tokenize:G4e};function H4e(t){let e=t.length-4,n=3,r,i;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r<e;)if(t[r][1].type==="codeTextData"){t[n][1].type="codeTextPadding",t[e][1].type="codeTextPadding",n+=2,e-=2;break}}for(r=n-1,e++;++r<=e;)i===void 0?r!==e&&t[r][1].type!=="lineEnding"&&(i=r):(r===e||t[r][1].type==="lineEnding")&&(t[i][1].type="codeTextData",r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),e-=r-i-2,r=i+2),i=void 0);return t}function W4e(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function G4e(t,e,n){let r=0,i,s;return a;function a(f){return t.enter("codeText"),t.enter("codeTextSequence"),l(f)}function l(f){return f===96?(t.consume(f),r++,l):(t.exit("codeTextSequence"),c(f))}function c(f){return f===null?n(f):f===32?(t.enter("space"),t.consume(f),t.exit("space"),c):f===96?(s=t.enter("codeTextSequence"),i=0,d(f)):Gt(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),c):(t.enter("codeTextData"),u(f))}function u(f){return f===null||f===32||f===96||Gt(f)?(t.exit("codeTextData"),c(f)):(t.consume(f),u)}function d(f){return f===96?(t.consume(f),i++,d):i===r?(t.exit("codeTextSequence"),t.exit("codeText"),e(f)):(s.type="codeTextData",u(f))}}class q4e{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(e,r):e>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){const i=n||0;this.setCursor(Math.trunc(e));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&xb(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),xb(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),xb(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const n=this.left.splice(e,Number.POSITIVE_INFINITY);xb(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);xb(this.left,n.reverse())}}}function xb(t,e){let n=0;if(e.length<1e4)t.push(...e);else for(;n<e.length;)t.push(...e.slice(n,n+1e4)),n+=1e4}function yle(t){const e={};let n=-1,r,i,s,a,l,c,u;const d=new q4e(t);for(;++n<d.length;){for(;n in e;)n=e[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,s=0,s<c.length&&c[s][1].type==="lineEndingBlank"&&(s+=2),s<c.length&&c[s][1].type==="content"))for(;++s<c.length&&c[s][1].type!=="content";)c[s][1].type==="chunkText"&&(c[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(e,K4e(d,n)),n=e[n],u=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(a=d.get(s),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(i&&(d.get(i)[1].type="lineEndingBlank"),a[1].type="lineEnding",i=s);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;i&&(r[1].end={...d.get(i)[1].start},l=d.slice(i,n),l.unshift(r),d.splice(i,n-i+1,l))}}return _o(t,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function K4e(t,e){const n=t.get(e)[1],r=t.get(e)[2];let i=e-1;const s=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const l=a.events,c=[],u={};let d,f,h=-1,p=n,m=0,x=0;const y=[x];for(;p;){for(;t.get(++i)[1]!==p;);s.push(i),p._tokenizer||(d=r.sliceStream(p),p.next||d.push(null),f&&a.defineSki
vendor: 18,639 bytes, line 771
771p(p.start),p._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(d),p._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),f=p,p=p.next}for(p=n;++h<l.length;)l[h][0]==="exit"&&l[h-1][0]==="enter"&&l[h][1].type===l[h-1][1].type&&l[h][1].start.line!==l[h][1].end.line&&(x=h+1,y.push(x),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(a.events=[],p?(p._tokenizer=void 0,p.previous=void 0):y.pop(),h=y.length;h--;){const g=l.slice(y[h],y[h+1]),w=s.pop();c.push([w,w+g.length-1]),t.splice(w,2,g)}for(c.reverse(),h=-1;++h<c.length;)u[m+c[h][0]]=m+c[h][1],m+=c[h][1]-c[h][0]-1;return u}const Y4e={resolve:Q4e,tokenize:J4e},X4e={partial:!0,tokenize:Z4e};function Q4e(t){return yle(t),t}function J4e(t,e){let n;return r;function r(l){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),i(l)}function i(l){return l===null?s(l):Gt(l)?t.check(X4e,a,s)(l):(t.consume(l),i)}function s(l){return t.exit("chunkContent"),t.exit("content"),e(l)}function a(l){return t.consume(l),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function Z4e(t,e,n){const r=this;return i;function i(a){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),In(t,s,"linePrefix")}function s(a){if(a===null||Gt(a))return n(a);const l=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?e(a):t.interrupt(r.parser.constructs.flow,n,e)(a)}}function vle(t,e,n,r,i,s,a,l,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return f;function f(g){return g===60?(t.enter(r),t.enter(i),t.enter(s),t.consume(g),t.exit(s),h):g===null||g===32||g===41||a2(g)?n(g):(t.enter(r),t.enter(a),t.enter(l),t.enter("chunkString",{contentType:"string"}),x(g))}function h(g){return g===62?(t.enter(s),t.consume(g),t.exit(s),t.exit(i),t.exit(r),e):(t.enter(l),t.enter("chunkString",{contentType:"string"}),p(g))}function p(g){return g===62?(t.exit("chunkString"),t.exit(l),h(g)):g===null||g===60||Gt(g)?n(g):(t.consume(g),g===92?m:p)}function m(g){return g===60||g===62||g===92?(t.consume(g),p):p(g)}function x(g){return!d&&(g===null||g===41||Sr(g))?(t.exit("chunkString"),t.exit(l),t.exit(a),t.exit(r),e(g)):d<u&&g===40?(t.consume(g),d++,x):g===41?(t.consume(g),d--,x):g===null||g===32||g===40||a2(g)?n(g):(t.consume(g),g===92?y:x)}function y(g){return g===40||g===41||g===92?(t.consume(g),x):x(g)}}function ble(t,e,n,r,i,s){const a=this;let l=0,c;return u;function u(p){return t.enter(r),t.enter(i),t.consume(p),t.exit(i),t.enter(s),d}function d(p){return l>999||p===null||p===91||p===93&&!c||p===94&&!l&&"_hiddenFootnoteSupport"in a.parser.constructs?n(p):p===93?(t.exit(s),t.enter(i),t.consume(p),t.exit(i),t.exit(r),e):Gt(p)?(t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),d):(t.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===null||p===91||p===93||Gt(p)||l++>999?(t.exit("chunkString"),d(p)):(t.consume(p),c||(c=!Cn(p)),p===92?h:f)}function h(p){return p===91||p===92||p===93?(t.consume(p),l++,f):f(p)}}function wle(t,e,n,r,i,s){let a;return l;function l(h){return h===34||h===39||h===40?(t.enter(r),t.enter(i),t.consume(h),t.exit(i),a=h===40?41:h,c):n(h)}function c(h){return h===a?(t.enter(i),t.consume(h),t.exit(i),t.exit(r),e):(t.enter(s),u(h))}function u(h){return h===a?(t.exit(s),c(a)):h===null?n(h):Gt(h)?(t.enter("lineEnding"),t.consume(h),t.exit("lineEnding"),In(t,u,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===a||h===null||Gt(h)?(t.exit("chunkString"),u(h)):(t.consume(h),h===92?f:d)}function f(h){return h===a||h===92?(t.consume(h),d):d(h)}}function Fw(t,e){let n;return r;function r(i){return Gt(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):Cn(i)?In(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}const eLe={name:"definition",tokenize:nLe},tLe={partial:!0,tokenize:rLe};function nLe(t,e,n){const r=this;let i;return s;function s(p){return t.enter("definition"),a(p)}function a(p){return ble.call(r,t,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return i=oc(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(t.enter("definitionMarker"),t.consume(p),t.exit("definitionMarker"),c):n(p)}function c(p){return Sr(p)?Fw(t,u)(p):u(p)}function u(p){return vle(t,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return t.attempt(tLe,f,f)(p)}function f(p){return Cn(p)?In(t,h,"whitespace")(p):h(p)}function h(p){return p===null||Gt(p)?(t.exit("definition"),r.parser.defined.push(i),e(p)):n(p)}}function rLe(t,e,n){return r;function r(l){return Sr(l)?Fw(t,i)(l):n(l)}function i(l){return wle(t,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function s(l){return Cn(l)?In(t,a,"whitespace")(l):a(l)}function a(l){return l===null||Gt(l)?e(l):n(l)}}const iLe={name:"hardBreakEscape",tokenize:sLe};function sLe(t,e,n){return r;function r(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return Gt(s)?(t.exit("hardBreakEscape"),e(s)):n(s)}}const aLe={name:"headingAtx",resolve:oLe,tokenize:lLe};function oLe(t,e){let n=t.length-2,r=3,i,s;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},s={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},_o(t,r,n-r+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function lLe(t,e,n){let r=0;return i;function i(d){return t.enter("atxHeading"),s(d)}function s(d){return t.enter("atxHeadingSequence"),a(d)}function a(d){return d===35&&r++<6?(t.consume(d),a):d===null||Sr(d)?(t.exit("atxHeadingSequence"),l(d)):n(d)}function l(d){return d===35?(t.enter("atxHeadingSequence"),c(d)):d===null||Gt(d)?(t.exit("atxHeading"),e(d)):Cn(d)?In(t,l,"whitespace")(d):(t.enter("atxHeadingText"),u(d))}function c(d){return d===35?(t.consume(d),c):(t.exit("atxHeadingSequence"),l(d))}function u(d){return d===null||d===35||Sr(d)?(t.exit("atxHeadingText"),l(d)):(t.consume(d),u)}}const cLe=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],cW=["pre","script","style","textarea"],uLe={concrete:!0,name:"htmlFlow",resolveTo:hLe,tokenize:pLe},dLe={partial:!0,tokenize:gLe},fLe={partial:!0,tokenize:mLe};function hLe(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function pLe(t,e,n){const r=this;let i,s,a,l,c;return u;function u(z){return d(z)}function d(z){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(z),f}function f(z){return z===33?(t.consume(z),h):z===47?(t.consume(z),s=!0,x):z===63?(t.consume(z),i=3,r.interrupt?e:F):ua(z)?(t.consume(z),a=String.fromCharCode(z),y):n(z)}function h(z){return z===45?(t.consume(z),i=2,p):z===91?(t.consume(z),i=5,l=0,m):ua(z)?(t.consume(z),i=4,r.interrupt?e:F):n(z)}function p(z){return z===45?(t.consume(z),r.interrupt?e:F):n(z)}function m(z){const H="CDATA[";return z===H.charCodeAt(l++)?(t.consume(z),l===H.length?r.interrupt?e:I:m):n(z)}function x(z){return ua(z)?(t.consume(z),a=String.fromCharCode(z),y):n(z)}function y(z){if(z===null||z===47||z===62||Sr(z)){const H=z===47,W=a.toLowerCase();return!H&&!s&&cW.includes(W)?(i=1,r.interrupt?e(z):I(z)):cLe.includes(a.toLowerCase())?(i=6,H?(t.consume(z),g):r.interrupt?e(z):I(z)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(z):s?w(z):v(z))}return z===45||Ks(z)?(t.consume(z),a+=String.fromCharCode(z),y):n(z)}function g(z){return z===62?(t.consume(z),r.interrupt?e:I):n(z)}function w(z){return Cn(z)?(t.consume(z),w):k(z)}function v(z){return z===47?(t.consume(z),k):z===58||z===95||ua(z)?(t.consume(z),N):Cn(z)?(t.consume(z),v):k(z)}function N(z){return z===45||z===46||z===58||z===95||Ks(z)?(t.consume(z),N):S(z)}function S(z){return z===61?(t.consume(z),_):Cn(z)?(t.consume(z),S):v(z)}function _(z){return z===null||z===60||z===61||z===62||z===96?n(z):z===34||z===39?(t.consume(z),c=z,j):Cn(z)?(t.consume(z),_):A(z)}function j(z){return z===c?(t.consume(z),c=null,C):z===null||Gt(z)?n(z):(t.consume(z),j)}function A(z){return z===null||z===34||z===39||z===47||z===60||z===61||z===62||z===96||Sr(z)?S(z):(t.consume(z),A)}function C(z){return z===47||z===62||Cn(z)?v(z):n(z)}function k(z){return z===62?(t.consume(z),M):n(z)}function M(z){return z===null||Gt(z)?I(z):Cn(z)?(t.consume(z),M):n(z)}function I(z){return z===45&&i===2?(t.consume(z),O):z===60&&i===1?(t.consume(z),L):z===62&&i===4?(t.consume(z),q):z===63&&i===3?(t.consume(z),F):z===93&&i===5?(t.consume(z),D):Gt(z)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(dLe,B,R)(z)):z===null||Gt(z)?(t.exit("htmlFlowData"),R(z)):(t.consume(z),I)}function R(z){return t.check(fLe,E,B)(z)}function E(z){return t.enter("lineEnding"),t.consume(z),t.exit("lineEnding"),P}function P(z){return z===null||Gt(z)?R(z):(t.enter("htmlFlowData"),I(z))}function O(z){return z===45?(t.consume(z),F):I(z)}function L(z){return z===47?(t.consume(z),a="",T):I(z)}function T(z){if(z===62){const H=a.toLowerCase();return cW.includes(H)?(t.consume(z),q):I(z)}return ua(z)&&a.length<8?(t.consume(z),a+=String.fromCharCode(z),T):I(z)}function D(z){return z===93?(t.consume(z),F):I(z)}function F(z){return z===62?(t.consume(z),q):z===45&&i===2?(t.consume(z),F):I(z)}function q(z){return z===null||Gt(z)?(t.exit("htmlFlowData"),B(z)):(t.consume(z),q)}function B(z){return t.exit("htmlFlow"),e(z)}}function mLe(t,e,n){const r=this;return i;function i(a){return Gt(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),s):n(a)}function s(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}function gLe(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(FS,e,n)}}const xLe={name:"htmlText",tokenize:yLe};function yLe(t,e,n){const r=this;let i,s,a;return l;function l(F){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(F),c}function c(F){return F===33?(t.consume(F),u):F===47?(t.consume(F),S):F===63?(t.consume(F),v):ua(F)?(t.consume(F),A):n(F)}function u(F){return F===45?(t.consume(F),d):F===91?(t.consume(F),s=0,m):ua(F)?(t.consume(F),w):n(F)}function d(F){return F===45?(t.consume(F),p):n(F)}function f(F){return F===null?n(F):F===45?(t.consume(F),h):Gt(F)?(a=f,L(F)):(t.consume(F),f)}function h(F){return F===45?(t.consume(F),p):f(F)}function p(F){return F===62?O(F):F===45?h(F):f(F)}function m(F){const q="CDATA[";return F===q.charCodeAt(s++)?(t.consume(F),s===q.length?x:m):n(F)}function x(F){return F===null?n(F):F===93?(t.consume(F),y):Gt(F)?(a=x,L(F)):(t.consume(F),x)}function y(F){return F===93?(t.consume(F),g):x(F)}function g(F){return F===62?O(F):F===93?(t.consume(F),g):x(F)}function w(F){return F===null||F===62?O(F):Gt(F)?(a=w,L(F)):(t.consume(F),w)}function v(F){return F===null?n(F):F===63?(t.consume(F),N):Gt(F)?(a=v,L(F)):(t.consume(F),v)}function N(F){return F===62?O(F):v(F)}function S(F){return ua(F)?(t.consume(F),_):n(F)}function _(F){return F===45||Ks(F)?(t.consume(F),_):j(F)}function j(F){return Gt(F)?(a=j,L(F)):Cn(F)?(t.consume(F),j):O(F)}function A(F){return F===45||Ks(F)?(t.consume(F),A):F===47||F===62||Sr(F)?C(F):n(F)}function C(F){return F===47?(t.consume(F),O):F===58||F===95||ua(F)?(t.consume(F),k):Gt(F)?(a=C,L(F)):Cn(F)?(t.consume(F),C):O(F)}function k(F){return F===45||F===46||F===58||F===95||Ks(F)?(t.consume(F),k):M(F)}function M(F){return F===61?(t.consume(F),I):Gt(F)?(a=M,L(F)):Cn(F)?(t.consume(F),M):C(F)}function I(F){return F===null||F===60||F===61||F===62||F===96?n(F):F===34||F===39?(t.consume(F),i=F,R):Gt(F)?(a=I,L(F)):Cn(F)?(t.consume(F),I):(t.consume(F),E)}function R(F){return F===i?(t.consume(F),i=void 0,P):F===null?n(F):Gt(F)?(a=R,L(F)):(t.consume(F),R)}function E(F){return F===null||F===34||F===39||F===60||F===61||F===96?n(F):F===47||F===62||Sr(F)?C(F):(t.consume(F),E)}function P(F){return F===47||F===62||Sr(F)?C(F):n(F)}function O(F){return F===62?(t.consume(F),t.exit("htmlTextData"),t.exit("htmlText"),e):n(F)}function L(F){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(F),t.exit("lineEnding"),T}function T(F){return Cn(F)?In(t,D,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):D(F)}function D(F){return t.enter("htmlTextData"),a(F)}}const c6={name:"labelEnd",resolveAll:_Le,resolveTo:SLe,tokenize:NLe},vLe={tokenize:jLe},bLe={tokenize:CLe},wLe={tokenize:kLe};function _Le(t){let e=-1;const n=[];for(;++e<t.length;){const r=t[e][1];if(n.push(t[e]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",e+=i}}return t.length!==n.length&&_o(t,0,t.length,n),t}function SLe(t,e){let n=t.length,r=0,i,s,a,l;for(;n--;)if(i=t[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;t[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(a){if(t[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(a=n);const c={type:t[s][1].type==="labelLink"?"link":"image",start:{...t[s][1].start},end:{...t[t.length-1][1].end}},u={type:"label",start:{...t[s][1].start},end:{...t[a][1].end}},d={type:"labelText",start:{...t[s+r+2][1].end},end:{...t[a-2][1].start}};return l=[["enter",c,e],["enter",u,e]],l=Zo(l,t.slice(s+1,s+r+3)),l=Zo(l,[["enter",d,e]]),l=Zo(l,zT(e.parser.constructs.insideSpan.null,t.slice(s+r+4,a-3),e)),l=Zo(l,[["exit",d,e],t[a-2],t[a-1],["exit",u,e]]),l=Zo(l,t.slice(a+1)),l=Zo(l,[["exit",c,e]]),_o(t,s,t.length,l),t}function NLe(t,e,n){const r=this;let i=r.events.length,s,a;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return l;function l(h){return s?s._inactive?f(h):(a=r.parser.defined.includes(oc(r.sliceSerialize({start:s.end,end:r.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(h),t.exit("labelMarker"),t.exit("labelEnd"),c):n(h)}function c(h){return h===40?t.attempt(vLe,d,a?d:f)(h):h===91?t.attempt(bLe,d,a?u:f)(h):a?d(h):f(h)}function u(h){return t.attempt(wLe,d,f)(h)}function d(h){return e(h)}function f(h){return s._balanced=!0,n(h)}}function jLe(t,e,n){return r;function r(f){return t.enter("resource"),t.enter("resourceMarker"),t.consume(f),t.exit("resourceMarker"),i}function i(f){return Sr(f)?Fw(t,s)(f):s(f)}function s(f){return f===41?d(f):vle(t,a,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function a(f){return Sr(f)?Fw(t,c)(f):d(f)}function l(f){return n(f)}function c(f){return f===34||f===39||f===40?wle(t,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):d(f)}function u(f){return Sr(f)?Fw(t,d)(f):d(f)}function d(f){return f===41?(t.enter("resourceMarker"),t.consume(f),t.exit("resourceMarker"),t.exit("resource"),e):n(f)}}function CLe(t,e,n){const r=this;return i;function i(l){return ble.call(r,t,s,a,"reference","referenceMarker","referenceString")(l)}function s(l){return r.parser.defined.includes(oc(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(l):n(l)}function a(l){return n(l)}}function kLe(t,e,n){return r;function r(s){return t.enter("reference"),t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),i}function i(s){return s===93?(t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),t.exit("reference"),e):n(s)}}const ELe={name:"labelStartImage",resolveAll:c6.resolveAll,tokenize:ALe};function ALe(t,e,n){const r=this;return i;function i(l){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(l),t.exit("labelImageMarker"),s}function s(l){return l===91?(t.enter("labelMarker"),t.consume(l),t.exit("labelMarker"),t.exit("labelImage"),a):n(l)}function a(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):e(l)}}const TLe={name:"labelStartLink",resolveAll:c6.resolveAll,tokenize:MLe};function MLe(t,e,n){const r=this;return i;function i(a){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(a),t.exit("labelMarker"),t.exit("labelLink"),s}function s(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):e(a)}}const AR={name:"lineEnding",tokenize:PLe};function PLe(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),In(t,e,"linePrefix")}}const KC={name:"thematicBreak",tokenize:OLe};function OLe(t,e,n){let r=0,i;return s;function s(u){return t.enter("thematicBreak"),a(u)}function a(u){return i=u,l(u)}function l(u){return u===i?(t.enter("thematicBreakSequence"),c(u)):r>=3&&(u===null||Gt(u))?(t.exit("thematicBreak"),e(u)):n(u)}function c(u){return u===i?(t.consume(u),r++,c):(t.exit("thematicBreakSequence"),Cn(u)?In(t,l,"whitespace")(u):l(u))}}const Ta={continuation:{tokenize:LLe},exit:FLe,name:"list",tokenize:DLe},RLe={partial:!0,tokenize:ULe},ILe={partial:!0,tokenize:$Le};function DLe(t,e,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,a=0;return l;function l(p){const m=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:lL(p)){if(r.containerState.type||(r.containerState.type=m,t.enter(m,{_container:!0})),m==="listUnordered")return t.enter("listItemPrefix"),p===42||p===45?t.check(KC,n,u)(p):u(p);if(!r.interrupt||p===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),c(p)}return n(p)}function c(p){return lL(p)&&++a<10?(t.consume(p),c):(!r.interrupt||a<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(t.exit("listItemValue"),u(p)):n(p)}function u(p){return t.enter("listItemMarker"),t.consume(p),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,t.check(FS,r.interrupt?n:d,t.attempt(RLe,h,f))}
vendor: 6,769 bytes, line 771
771function d(p){return r.containerState.initialBlankLine=!0,s++,h(p)}function f(p){return Cn(p)?(t.enter("listItemPrefixWhitespace"),t.consume(p),t.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return r.containerState.size=s+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(p)}}function LLe(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(FS,i,s);function i(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,In(t,e,"listItemIndent",r.containerState.size+1)(l)}function s(l){return r.containerState.furtherBlankLines||!Cn(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(ILe,e,a)(l))}function a(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,In(t,t.attempt(Ta,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function $Le(t,e,n){const r=this;return In(t,i,"listItemIndent",r.containerState.size+1);function i(s){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?e(s):n(s)}}function FLe(t){t.exit(this.containerState.type)}function ULe(t,e,n){const r=this;return In(t,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const a=r.events[r.events.length-1];return!Cn(s)&&a&&a[1].type==="listItemPrefixWhitespace"?e(s):n(s)}}const uW={name:"setextUnderline",resolveTo:zLe,tokenize:BLe};function zLe(t,e){let n=t.length,r,i,s;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(i=n)}else t[n][1].type==="content"&&t.splice(n,1),!s&&t[n][1].type==="definition"&&(s=n);const a={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[i][1].type="setextHeadingText",s?(t.splice(i,0,["enter",a,e]),t.splice(s+1,0,["exit",t[r][1],e]),t[r][1].end={...t[s][1].end}):t[r][1]=a,t.push(["exit",a,e]),t}function BLe(t,e,n){const r=this;let i;return s;function s(u){let d=r.events.length,f;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){f=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(t.enter("setextHeadingLine"),i=u,a(u)):n(u)}function a(u){return t.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===i?(t.consume(u),l):(t.exit("setextHeadingLineSequence"),Cn(u)?In(t,c,"lineSuffix")(u):c(u))}function c(u){return u===null||Gt(u)?(t.exit("setextHeadingLine"),e(u)):n(u)}}const VLe={tokenize:HLe};function HLe(t){const e=this,n=t.attempt(FS,r,t.attempt(this.parser.constructs.flowInitial,i,In(t,t.attempt(this.parser.constructs.flow,i,t.attempt(Y4e,i)),"linePrefix")));return n;function r(s){if(s===null){t.consume(s);return}return t.enter("lineEndingBlank"),t.consume(s),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function i(s){if(s===null){t.consume(s);return}return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const WLe={resolveAll:Sle()},GLe=_le("string"),qLe=_le("text");function _le(t){return{resolveAll:Sle(t==="text"?KLe:void 0),tokenize:e};function e(n){const r=this,i=this.parser.constructs[t],s=n.attempt(i,a,l);return a;function a(d){return u(d)?s(d):l(d)}function l(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),c}function c(d){return u(d)?(n.exit("data"),s(d)):(n.consume(d),c)}function u(d){if(d===null)return!0;const f=i[d];let h=-1;if(f)for(;++h<f.length;){const p=f[h];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function Sle(t){return e;function e(n,r){let i=-1,s;for(;++i<=n.length;)s===void 0?n[i]&&n[i][1].type==="data"&&(s=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==s+2&&(n[s][1].end=n[i-1][1].end,n.splice(s+2,i-s-2),i=s+2),s=void 0);return t?t(n,r):n}}function KLe(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){const r=t[n-1][1],i=e.sliceStream(r);let s=i.length,a=-1,l=0,c;for(;s--;){const u=i[s];if(typeof u=="string"){for(a=u.length;u.charCodeAt(a-1)===32;)l++,a--;if(a)break;a=-1}else if(u===-2)c=!0,l++;else if(u!==-1){s++;break}}if(e._contentTypeTextTrailing&&n===t.length&&(l=0),l){const u={type:n===t.length||c||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?a:r.start._bufferIndex+a,_index:r.start._index+s,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(t.splice(n,0,["enter",u,e],["exit",u,e]),n+=2)}n++}return t}const YLe={42:Ta,43:Ta,45:Ta,48:Ta,49:Ta,50:Ta,51:Ta,52:Ta,53:Ta,54:Ta,55:Ta,56:Ta,57:Ta,62:mle},XLe={91:eLe},QLe={[-2]:ER,[-1]:ER,32:ER},JLe={35:aLe,42:KC,45:[uW,KC],60:uLe,61:uW,95:KC,96:lW,126:lW},ZLe={38:xle,92:gle},e$e={[-5]:AR,[-4]:AR,[-3]:AR,33:ELe,38:xle,42:cL,60:[T4e,xLe],91:TLe,92:[iLe,gle],93:c6,95:cL,96:V4e},t$e={null:[cL,WLe]},n$e={null:[42,95]},r$e={null:[]},i$e=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:n$e,contentInitial:XLe,disable:r$e,document:YLe,flow:JLe,flowInitial:QLe,insideSpan:t$e,string:ZLe,text:e$e},Symbol.toStringTag,{value:"Module"}));function s$e(t,e,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},s=[];let a=[],l=[];const c={attempt:j(S),check:j(_),consume:w,enter:v,exit:N,interrupt:j(_,{interrupt:!0})},u={code:null,containerState:{},defineSkip:x,events:[],now:m,parser:t,previous:null,sliceSerialize:h,sliceStream:p,write:f};let d=e.tokenize.call(u,c);return e.resolveAll&&s.push(e),u;function f(M){return a=Zo(a,M),y(),a[a.length-1]!==null?[]:(A(e,0),u.events=zT(s,u.events,u),u.events)}function h(M,I){return o$e(p(M),I)}function p(M){return a$e(a,M)}function m(){const{_bufferIndex:M,_index:I,line:R,column:E,offset:P}=r;return{_bufferIndex:M,_index:I,line:R,column:E,offset:P}}function x(M){i[M.line]=M.column,k()}function y(){let M;for(;r._index<a.length;){const I=a[r._index];if(typeof I=="string")for(M=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===M&&r._bufferIndex<I.length;)g(I.charCodeAt(r._bufferIndex));else g(I)}}function g(M){d=d(M)}function w(M){Gt(M)?(r.line++,r.column=1,r.offset+=M===-3?2:1,k()):M!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=M}function v(M,I){const R=I||{};return R.type=M,R.start=m(),u.events.push(["enter",R,u]),l.push(R),R}function N(M){const I=l.pop();return I.end=m(),u.events.push(["exit",I,u]),I}function S(M,I){A(M,I.from)}
vendor: 10,227 bytes, lines 771-773
771function _(M,I){I.restore()}function j(M,I){return R;function R(E,P,O){let L,T,D,F;return Array.isArray(E)?B(E):"tokenize"in E?B([E]):q(E);function q(G){return K;function K(ee){const V=ee!==null&&G[ee],J=ee!==null&&G.null,Y=[...Array.isArray(V)?V:V?[V]:[],...Array.isArray(J)?J:J?[J]:[]];return B(Y)(ee)}}function B(G){return L=G,T=0,G.length===0?O:z(G[T])}function z(G){return K;function K(ee){return F=C(),D=G,G.partial||(u.currentConstruct=G),G.name&&u.parser.constructs.disable.null.includes(G.name)?W():G.tokenize.call(I?Object.assign(Object.create(u),I):u,c,H,W)(ee)}}function H(G){return M(D,F),P}function W(G){return F.restore(),++T<L.length?z(L[T]):O}}}function A(M,I){M.resolveAll&&!s.includes(M)&&s.push(M),M.resolve&&_o(u.events,I,u.events.length-I,M.resolve(u.events.slice(I),u)),M.resolveTo&&(u.events=M.resolveTo(u.events,u))}function C(){const M=m(),I=u.previous,R=u.currentConstruct,E=u.events.length,P=Array.from(l);return{from:E,restore:O};function O(){r=M,u.previous=I,u.currentConstruct=R,u.events.length=E,l=P,k()}}function k(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function a$e(t,e){const n=e.start._index,r=e.start._bufferIndex,i=e.end._index,s=e.end._bufferIndex;let a;if(n===i)a=[t[n].slice(r,s)];else{if(a=t.slice(n,i),r>-1){const l=a[0];typeof l=="string"?a[0]=l.slice(r):a.shift()}s>0&&a.push(t[i].slice(0,s))}return a}function o$e(t,e){let n=-1;const r=[];let i;for(;++n<t.length;){const s=t[n];let a;if(typeof s=="string")a=s;else switch(s){case-5:{a="\r";break}case-4:{a=`
772`;break}case-3:{a=`\r
773`;break}case-2:{a=e?" ":"	";break}case-1:{if(!e&&i)continue;a=" ";break}default:a=String.fromCharCode(s)}i=s===-2,r.push(a)}return r.join("")}function l$e(t){const r={constructs:hle([i$e,...(t||{}).extensions||[]]),content:i(S4e),defined:[],document:i(j4e),flow:i(VLe),lazy:{},string:i(GLe),text:i(qLe)};return r;function i(s){return a;function a(l){return s$e(r,s,l)}}}function c$e(t){for(;!yle(t););return t}const dW=/[\0\t\n\r]/g;function u$e(){let t=1,e="",n=!0,r;return i;function i(s,a,l){const c=[];let u,d,f,h,p;for(s=e+(typeof s=="string"?s.toString():new TextDecoder(a||void 0).decode(s)),f=0,e="",n&&(s.charCodeAt(0)===65279&&f++,n=void 0);f<s.length;){if(dW.lastIndex=f,u=dW.exec(s),h=u&&u.index!==void 0?u.index:s.length,p=s.charCodeAt(h),!u){e=s.slice(f);break}if(p===10&&f===h&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),f<h&&(c.push(s.slice(f,h)),t+=h-f),p){case 0:{c.push(65533),t++;break}case 9:{for(d=Math.ceil(t/4)*4,c.push(-2);t++<d;)c.push(-1);break}case 10:{c.push(-4),t=1;break}default:r=!0,t=1}f=h+1}return l&&(r&&c.push(-5),e&&c.push(e),c.push(null)),c}}const d$e=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function f$e(t){return t.replace(d$e,h$e)}function h$e(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return ple(n.slice(s?2:1),s?16:10)}return l6(n)||t}const Nle={}.hasOwnProperty;function p$e(t,e,n){return typeof e!="string"&&(n=e,e=void 0),m$e(n)(c$e(l$e(n).document().write(u$e()(t,e,!0))))}function m$e(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(Pe),autolinkProtocol:C,autolinkEmail:C,atxHeading:s(ve),blockQuote:s(J),characterEscape:C,characterReference:C,codeFenced:s(Y),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:s(Y,a),codeText:s($,a),codeTextData:C,data:C,codeFlowValue:C,definition:s(fe),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:s(ce),hardBreakEscape:s(X),hardBreakTrailing:s(X),htmlFlow:s(de,a),htmlFlowData:C,htmlText:s(de,a),htmlTextData:C,image:s(Te),label:a,link:s(Pe),listItem:s(U),listItemValue:h,listOrdered:s(se,f),listUnordered:s(se),paragraph:s(Q),reference:z,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:s(ve),strong:s(oe),thematicBreak:s(ye)},exit:{atxHeading:c(),atxHeadingSequence:S,autolink:c(),autolinkEmail:V,autolinkProtocol:ee,blockQuote:c(),characterEscapeValue:k,characterReferenceMarkerHexadecimal:W,characterReferenceMarkerNumeric:W,characterReferenceValue:G,characterReference:K,codeFenced:c(y),codeFencedFence:x,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:k,codeIndented:c(g),codeText:c(P),codeTextData:k,data:k,definition:c(),definitionDestinationString:N,definitionLabelString:w,definitionTitleString:v,emphasis:c(),hardBreakEscape:c(I),hardBreakTrailing:c(I),htmlFlow:c(R),htmlFlowData:k,htmlText:c(E),htmlTextData:k,image:c(L),label:D,labelText:T,lineEnding:M,link:c(O),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:H,resourceDestinationString:F,resourceTitleString:q,resource:B,setextHeading:c(A),setextHeadingLineSequence:j,setextHeadingText:_,strong:c(),thematicBreak:c()}};jle(e,(t||{}).mdastExtensions||[]);const n={};return r;function r(re){let he={type:"root",children:[]};const pe={stack:[he],tokenStack:[],config:e,enter:l,exit:u,buffer:a,resume:d,data:n},je=[];let ae=-1;for(;++ae<re.length;)if(re[ae][1].type==="listOrdered"||re[ae][1].type==="listUnordered")if(re[ae][0]==="enter")je.push(ae);else{const we=je.pop();ae=i(re,we,ae)}for(ae=-1;++ae<re.length;){const we=e[re[ae][0]];Nle.call(we,re[ae][1].type)&&we[re[ae][1].type].call(Object.assign({sliceSerialize:re[ae][2].sliceSerialize},pe),re[ae][1])}if(pe.tokenStack.length>0){const we=pe.tokenStack[pe.tokenStack.length-1];(we[1]||fW).call(pe,void 0,we[0])}for(he.position={start:Zd(re.length>0?re[0][1].start:{line:1,column:1,offset:0}),end:Zd(re.length>0?re[re.length-2][1].end:{line:1,column:1,offset:0})},ae=-1;++ae<e.transforms.length;)he=e.transforms[ae](he)||he;return he}function i(re,he,pe){let je=he-1,ae=-1,we=!1,Ie,Ue,Oe,ie;for(;++je<=pe;){const De=re[je];switch(De[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{De[0]==="enter"?ae++:ae--,ie=void 0;break}case"lineEndingBlank":{De[0]==="enter"&&(Ie&&!ie&&!ae&&!Oe&&(Oe=je),ie=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ie=void 0}if(!ae&&De[0]==="enter"&&De[1].type==="listItemPrefix"||ae===-1&&De[0]==="exit"&&(De[1].type==="listUnordered"||De[1].type==="listOrdered")){if(Ie){let Ve=je;for(Ue=void 0;Ve--;){const xe=re[Ve];if(xe[1].type==="lineEnding"||xe[1].type==="lineEndingBlank"){if(xe[0]==="exit")continue;Ue&&(re[Ue][1].type="lineEndingBlank",we=!0),xe[1].type="lineEnding",Ue=Ve}else if(!(xe[1].type==="linePrefix"||xe[1].type==="blockQuotePrefix"||xe[1].type==="blockQuotePrefixWhitespace"||xe[1].type==="blockQuoteMarker"||xe[1].type==="listItemIndent"))break}Oe&&(!Ue||Oe<Ue)&&(Ie._spread=!0),Ie.end=Object.assign({},Ue?re[Ue][1].start:De[1].end),re.splice(Ue||je,0,["exit",Ie,De[2]]),je++,pe++}if(De[1].type==="listItemPrefix"){const Ve={type:"listItem",_spread:!1,start:Object.assign({},De[1].start),end:void 0};Ie=Ve,re.splice(je,0,["enter",Ve,De[2]]),je++,pe++,Oe=void 0,ie=!0}}}return re[he][1]._spread=we,pe}function s(re,he){return pe;function pe(je){l.call(this,re(je),je),he&&he.call(this,je)}}function a(){this.stack.push({type:"fragment",children:[]})}function l(re,he,pe){this.stack[this.stack.length-1].children.push(re),this.stack.push(re),this.tokenStack.push([he,pe||void 0]),re.position={start:Zd(he.start),end:void 0}}function c(re){return he;function he(pe){re&&re.call(this,pe),u.call(this,pe)}}function u(re,he){const pe=this.stack.pop(),je=this.tokenStack.pop();if(je)je[0].type!==re.type&&(he?he.call(this,re,je[0]):(je[1]||fW).call(this,re,je[0]));else throw new Error("Cannot close `"+re.type+"` ("+$w({start:re.start,end:re.end})+"): it’s not open");pe.position.end=Zd(re.end)}function d(){return o6(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function h(re){if(this.data.expectingFirstListItemValue){const he=this.stack[this.stack.length-2];he.start=Number.parseInt(this.sliceSerialize(re),10),this.data.expectingFirstListItemValue=void 0}}function p(){const re=this.resume(),he=this.stack[this.stack.length-1];he.lang=re}function m(){const re=this.resume(),he=this.stack[this.stack.length-1];he.meta=re}function x(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){const re=this.resume(),he=this.stack[this.stack.length-1];he.value=re.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function g(){const re=this.resume(),he=this.stack[this.stack.length-1];he.value=re.replace(/(\r?\n|\r)$/g,"")}function w(re){const he=this.resume(),pe=this.stack[this.stack.length-1];pe.label=he,pe.identifier=oc(this.sliceSerialize(re)).toLowerCase()}function v(){const re=this.resume(),he=this.stack[this.stack.length-1];he.title=re}function N(){const re=this.resume(),he=this.stack[this.stack.length-1];he.url=re}function S(re){const he=this.stack[this.stack.length-1];if(!he.depth){const pe=this.sliceSerialize(re).length;he.depth=pe}}function _(){this.data.setextHeadingSlurpLineEnding=!0}function j(re){const he=this.stack[this.stack.length-1];he.depth=this.sliceSerialize(re).codePointAt(0)===61?1:2}function A(){this.data.setextHeadingSlurpLineEnding=void 0}function C(re){const pe=this.stack[this.stack.length-1].children;let je=pe[pe.length-1];(!je||je.type!=="text")&&(je=_e(),je.position={start:Zd(re.start),end:void 0},pe.push(je)),this.stack.push(je)}function k(re){const he=this.stack.pop();he.value+=this.sliceSerialize(re),he.position.end=Zd(re.end)}function M(re){const he=this.stack[this.stack.length-1];if(this.data.atHardBreak){const pe=he.children[he.children.length-1];pe.position.end=Zd(re.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(he.type)&&(C.call(this,re),k.call(this,re))}function I(){this.data.atHardBreak=!0}function R(){const re=this.resume(),he=this.stack[this.stack.length-1];he.value=re}function E(){const re=this.resume(),he=this.stack[this.stack.length-1];he.value=re}function P(){const re=this.resume(),he=this.stack[this.stack.length-1];he.value=re}function O(){const re=this.stack[this.stack.length-1];if(this.data.inReference){const he=this.data.referenceType||"shortcut";re.type+="Reference",re.referenceType=he,delete re.url,delete re.title}
vendor: 9,203 bytes, lines 773-777
773else delete re.identifier,delete re.label;this.data.referenceType=void 0}function L(){const re=this.stack[this.stack.length-1];if(this.data.inReference){const he=this.data.referenceType||"shortcut";re.type+="Reference",re.referenceType=he,delete re.url,delete re.title}else delete re.identifier,delete re.label;this.data.referenceType=void 0}function T(re){const he=this.sliceSerialize(re),pe=this.stack[this.stack.length-2];pe.label=f$e(he),pe.identifier=oc(he).toLowerCase()}function D(){const re=this.stack[this.stack.length-1],he=this.resume(),pe=this.stack[this.stack.length-1];if(this.data.inReference=!0,pe.type==="link"){const je=re.children;pe.children=je}else pe.alt=he}function F(){const re=this.resume(),he=this.stack[this.stack.length-1];he.url=re}function q(){const re=this.resume(),he=this.stack[this.stack.length-1];he.title=re}function B(){this.data.inReference=void 0}function z(){this.data.referenceType="collapsed"}function H(re){const he=this.resume(),pe=this.stack[this.stack.length-1];pe.label=he,pe.identifier=oc(this.sliceSerialize(re)).toLowerCase(),this.data.referenceType="full"}function W(re){this.data.characterReferenceType=re.type}function G(re){const he=this.sliceSerialize(re),pe=this.data.characterReferenceType;let je;pe?(je=ple(he,pe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):je=l6(he);const ae=this.stack[this.stack.length-1];ae.value+=je}function K(re){const he=this.stack.pop();he.position.end=Zd(re.end)}function ee(re){k.call(this,re);const he=this.stack[this.stack.length-1];he.url=this.sliceSerialize(re)}function V(re){k.call(this,re);const he=this.stack[this.stack.length-1];he.url="mailto:"+this.sliceSerialize(re)}function J(){return{type:"blockquote",children:[]}}function Y(){return{type:"code",lang:null,meta:null,value:""}}function $(){return{type:"inlineCode",value:""}}function fe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ce(){return{type:"emphasis",children:[]}}function ve(){return{type:"heading",depth:0,children:[]}}function X(){return{type:"break"}}function de(){return{type:"html",value:""}}function Te(){return{type:"image",title:null,url:"",alt:null}}function Pe(){return{type:"link",title:null,url:"",children:[]}}function se(re){return{type:"list",ordered:re.type==="listOrdered",start:null,spread:re._spread,children:[]}}function U(re){return{type:"listItem",spread:re._spread,checked:null,children:[]}}function Q(){return{type:"paragraph",children:[]}}function oe(){return{type:"strong",children:[]}}function _e(){return{type:"text",value:""}}function ye(){return{type:"thematicBreak"}}}function Zd(t){return{line:t.line,column:t.column,offset:t.offset}}function jle(t,e){let n=-1;for(;++n<e.length;){const r=e[n];Array.isArray(r)?jle(t,r):g$e(t,r)}}function g$e(t,e){let n;for(n in e)if(Nle.call(e,n))switch(n){case"canContainEols":{const r=e[n];r&&t[n].push(...r);break}case"transforms":{const r=e[n];r&&t[n].push(...r);break}case"enter":case"exit":{const r=e[n];r&&Object.assign(t[n],r);break}}}function fW(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+$w({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+$w({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+$w({start:e.start,end:e.end})+") is still open")}function x$e(t){const e=this;e.parser=n;function n(r){return p$e(r,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function y$e(t,e){const n={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,n),t.applyData(e,n)}function v$e(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
774`}]}function b$e(t,e){const n=e.value?e.value+`
775`:"",r={},i=e.lang?e.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return e.meta&&(s.data={meta:e.meta}),t.patch(e,s),s=t.applyData(e,s),s={type:"element",tagName:"pre",properties:{},children:[s]},t.patch(e,s),s}function w$e(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function _$e(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function S$e(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=String(e.identifier).toUpperCase(),i=P0(r.toLowerCase()),s=t.footnoteOrder.indexOf(r);let a,l=t.footnoteCounts.get(r);l===void 0?(l=0,t.footnoteOrder.push(r),a=t.footnoteOrder.length):a=s+1,l+=1,t.footnoteCounts.set(r,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};t.patch(e,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return t.patch(e,u),t.applyData(e,u)}function N$e(t,e){const n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function j$e(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function Cle(t,e){const n=e.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+r}];const i=t.all(e),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const a=i[i.length-1];return a&&a.type==="text"?a.value+=r:i.push({type:"text",value:r}),i}function C$e(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return Cle(t,e);const i={src:P0(r.url||""),alt:e.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return t.patch(e,s),t.applyData(e,s)}function k$e(t,e){const n={src:P0(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,r),t.applyData(e,r)}function E$e(t,e){const n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,r),t.applyData(e,r)}function A$e(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return Cle(t,e);const i={href:P0(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:t.all(e)};return t.patch(e,s),t.applyData(e,s)}function T$e(t,e){const n={href:P0(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function M$e(t,e,n){const r=t.all(e),i=n?P$e(n):kle(e),s={},a=[];if(typeof e.checked=="boolean"){const d=r[0];let f;d&&d.type==="element"&&d.tagName==="p"?f=d:(f={type:"element",tagName:"p",properties:{},children:[]},r.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let l=-1;for(;++l<r.length;){const d=r[l];(i||l!==0||d.type!=="element"||d.tagName!=="p")&&a.push({type:"text",value:`
776`}),d.type==="element"&&d.tagName==="p"&&!i?a.push(...d.children):a.push(d)}const c=r[r.length-1];c&&(i||c.type!=="element"||c.tagName!=="p")&&a.push({type:"text",value:`
777`});const u={type:"element",tagName:"li",properties:s,children:a};return t.patch(e,u),t.applyData(e,u)}function P$e(t){let e=!1;if(t.type==="list"){e=t.spread||!1;const n=t.children;let r=-1;for(;!e&&++r<n.length;)e=kle(n[r])}return e}function kle(t){const e=t.spread;return e??t.children.length>1}function O$e(t,e){const n={},r=t.all(e);let i=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++i<r.length;){const a=r[i];if(a.type==="element"&&a.tagName==="li"&&a.properties&&Array.isArray(a.properties.className)&&a.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const s={type:"element",tagName:e.ordered?"ol":"ul",properties:n,children:t.wrap(r,!0)};return t.patch(e,s),t.applyData(e,s)}function R$e(t,e){const n={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function I$e(t,e){const n={type:"root",children:t.wrap(t.all(e))};return t.patch(e,n),t.applyData(e,n)}function D$e(t,e){const n={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function L$e(t,e){const n=t.all(e),r=n.shift(),i=[];if(r){const a={type:"element",tagName:"thead",properties:{},children:t.wrap([r],!0)};t.patch(e.children[0],a),i.push(a)}if(n.length>0){const a={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},l=r6(e.children[1]),c=ale(e.children[e.children.length-1]);l&&c&&(a.position={start:l,end:c}),i.push(a)}const s={type:"element",tagName:"table",properties:{}
vendor: 8,640 bytes, lines 777-779
777,children:t.wrap(i,!0)};return t.patch(e,s),t.applyData(e,s)}function $$e(t,e,n){const r=n?n.children:void 0,s=(r?r.indexOf(e):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,l=a?a.length:e.children.length;let c=-1;const u=[];for(;++c<l;){const f=e.children[c],h={},p=a?a[c]:void 0;p&&(h.align=p);let m={type:"element",tagName:s,properties:h,children:[]};f&&(m.children=t.all(f),t.patch(f,m),m=t.applyData(f,m)),u.push(m)}const d={type:"element",tagName:"tr",properties:{},children:t.wrap(u,!0)};return t.patch(e,d),t.applyData(e,d)}function F$e(t,e){const n={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}const hW=9,pW=32;function U$e(t){const e=String(t),n=/\r?\n|\r/g;let r=n.exec(e),i=0;const s=[];for(;r;)s.push(mW(e.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(e);return s.push(mW(e.slice(i),i>0,!1)),s.join("")}function mW(t,e,n){let r=0,i=t.length;if(e){let s=t.codePointAt(r);for(;s===hW||s===pW;)r++,s=t.codePointAt(r)}if(n){let s=t.codePointAt(i-1);for(;s===hW||s===pW;)i--,s=t.codePointAt(i-1)}return i>r?t.slice(r,i):""}function z$e(t,e){const n={type:"text",value:U$e(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function B$e(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const V$e={blockquote:y$e,break:v$e,code:b$e,delete:w$e,emphasis:_$e,footnoteReference:S$e,heading:N$e,html:j$e,imageReference:C$e,image:k$e,inlineCode:E$e,linkReference:A$e,link:T$e,listItem:M$e,list:O$e,paragraph:R$e,root:I$e,strong:D$e,table:L$e,tableCell:F$e,tableRow:$$e,text:z$e,thematicBreak:B$e,toml:rj,yaml:rj,definition:rj,footnoteDefinition:rj};function rj(){}const Ele=-1,BT=0,Uw=1,o2=2,u6=3,d6=4,f6=5,h6=6,Ale=7,Tle=8,gW=typeof self=="object"?self:globalThis,H$e=(t,e)=>{const n=(i,s)=>(t.set(s,i),i),r=i=>{if(t.has(i))return t.get(i);const[s,a]=e[i];switch(s){case BT:case Ele:return n(a,i);case Uw:{const l=n([],i);for(const c of a)l.push(r(c));return l}case o2:{const l=n({},i);for(const[c,u]of a)l[r(c)]=r(u);return l}case u6:return n(new Date(a),i);case d6:{const{source:l,flags:c}=a;return n(new RegExp(l,c),i)}case f6:{const l=n(new Map,i);for(const[c,u]of a)l.set(r(c),r(u));return l}case h6:{const l=n(new Set,i);for(const c of a)l.add(r(c));return l}case Ale:{const{name:l,message:c}=a;return n(new gW[l](c),i)}case Tle:return n(BigInt(a),i);case"BigInt":return n(Object(BigInt(a)),i);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:l}=new Uint8Array(a);return n(new DataView(l),a)}}return n(new gW[s](a),i)};return r},xW=t=>H$e(new Map,t)(0),nx="",{toString:W$e}={},{keys:G$e}=Object,yb=t=>{const e=typeof t;if(e!=="object"||!t)return[BT,e];const n=W$e.call(t).slice(8,-1);switch(n){case"Array":return[Uw,nx];case"Object":return[o2,nx];case"Date":return[u6,nx];case"RegExp":return[d6,nx];case"Map":return[f6,nx];case"Set":return[h6,nx];case"DataView":return[Uw,n]}return n.includes("Array")?[Uw,n]:n.includes("Error")?[Ale,n]:[o2,n]},ij=([t,e])=>t===BT&&(e==="function"||e==="symbol"),q$e=(t,e,n,r)=>{const i=(a,l)=>{const c=r.push(a)-1;return n.set(l,c),c},s=a=>{if(n.has(a))return n.get(a);let[l,c]=yb(a);switch(l){case BT:{let d=a;switch(c){case"bigint":l=Tle,d=a.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return i([Ele],a)}return i([l,d],a)}case Uw:{if(c){let h=a;return c==="DataView"?h=new Uint8Array(a.buffer):c==="ArrayBuffer"&&(h=new Uint8Array(a)),i([c,[...h]],a)}const d=[],f=i([l,d],a);for(const h of a)d.push(s(h));return f}case o2:{if(c)switch(c){case"BigInt":return i([c,a.toString()],a);case"Boolean":case"Number":case"String":return i([c,a.valueOf()],a)}if(e&&"toJSON"in a)return s(a.toJSON());const d=[],f=i([l,d],a);for(const h of G$e(a))(t||!ij(yb(a[h])))&&d.push([s(h),s(a[h])]);return f}case u6:return i([l,a.toISOString()],a);case d6:{const{source:d,flags:f}=a;return i([l,{source:d,flags:f}],a)}case f6:{const d=[],f=i([l,d],a);for(const[h,p]of a)(t||!(ij(yb(h))||ij(yb(p))))&&d.push([s(h),s(p)]);return f}case h6:{const d=[],f=i([l,d],a);for(const h of a)(t||!ij(yb(h)))&&d.push(s(h));return f}}const{message:u}=a;return i([l,{name:c,message:u}],a)};return s},yW=(t,{json:e,lossy:n}={})=>{const r=[];return q$e(!(e||n),!!e,new Map,r)(t),r},l2=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?xW(yW(t,e)):structuredClone(t):(t,e)=>xW(yW(t,e));function K$e(t,e){const n=[{type:"text",value:"↩"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function Y$e(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function X$e(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||K$e,r=t.options.footnoteBackLabel||Y$e,i=t.options.footnoteLabel||"Footnotes",s=t.options.footnoteLabelTagName||"h2",a=t.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c<t.footnoteOrder.length;){const u=t.footnoteById.get(t.footnoteOrder[c]);if(!u)continue;const d=t.all(u),f=String(u.identifier).toUpperCase(),h=P0(f.toLowerCase());let p=0;const m=[],x=t.footnoteCounts.get(f);for(;x!==void 0&&++p<=x;){m.length>0&&m.push({type:"text",value:" "});let w=typeof n=="string"?n:n(c,p);typeof w=="string"&&(w={type:"text",value:w}),m.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+h+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,p),className:["data-footnote-backref"]},children:Array.isArray(w)?w:[w]})}const y=d[d.length-1];if(y&&y.type==="element"&&y.tagName==="p"){const w=y.children[y.children.length-1];w&&w.type==="text"?w.value+=" ":y.children.push({type:"text",value:" "}),y.children.push(...m)}else d.push(...m);const g={type:"element",tagName:"li",properties:{id:e+"fn-"+h},children:t.wrap(d,!0)};t.patch(u,g),l.push(g)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...l2(a),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
778`},{type:"element",tagName:"ol",properties:{},children:t.wrap(l,!0)},{type:"text",value:`
779`}]}}const VT=function(t){if(t==null)return e5e;if(typeof t=="function")return HT(t);if(typeof t=="object")return Array.isArray(t)?Q$e(t):J$e(t);if(typeof t=="string")return Z$e(t);throw new Error("Expected function, string, or object as test")};function Q$e(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=VT(t[n]);return HT(r);function r(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function J$e(t){const e=t;return HT(n);function n(r){const i=r;let s;for(s in t)if(i[s]!==e[s])return!1;return!0}}function Z$e(t){return HT(e);function e(n){return n&&n.type===t}}function HT(t){return e;function e(n,r,i){return!!(t5e(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function e5e(){return!0}function t5e(t){return t!==null&&typeof t=="object"&&"type"in t}const Mle=[],n5e=!0,uL=!1,r5e="skip";function Ple(t,e,n,r){let i;typeof e=="function"&&typeof n!="function"?(r=n,n=e):i=e;const s=VT(i),a=r?-1:1;l(t,void 0,[])();function l(c,u,d){const f=c&&typeof c=="object"?c:{};if(typeof f.type=="string"){const p=typeof f.tagName=="string"?f.tagName:typeof f.name=="string"?f.name:void 0;Object.defineProperty(h,"name",{value:"node ("+(c.type+(p?"<"+p+">":""))+")"})}return h;function h(){let p=Mle,m,x,y;if((!e||s(c,u,d[d.length-1]||void 0))&&(p=i5e(n(c,d)),p[0]===uL))return p;if("children"in c&&c.children){const g=c;if(g.children&&p[0]!==r5e)for(x=(r?g.children.length:-1)+a,y=d.concat(g);x>-1&&x<g.children.length;){const w=g.children[x];if(m=l(w,x,y)(),m[0]===uL)return m;x=typeof m[1]=="number"?m[1]:x+a}}return p}}}function i5e(t){return Array.isArray(t)?t:typeof t=="number"?[n5e,t]:t==null?Mle:[t]}function p6(t,e,n,r){let i,s,a;typeof e=="function"&&typeof n!="function"?(s=void 0,a=e,i=n):(s=e,a=n,i=r),Ple(t,s,l,i);function l(c,u){const d=u[u.length-1],f=d?d.children.indexOf(c):void 0;return a(c,f,d)}}const dL={}.hasOwnProperty,s5e={};function a5e(t,e){const n=e||s5e,r=new Map,i=new Map,s=new Map,a={...V$e,...n.handlers},l={all:u,applyData:l5e,definitionById:r,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:a,one:c,options:n,patch:o5e,wrap:u5e};return p6(t,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const f=d.type==="definition"?r:i,h=String(d.identifier).toUpperCase();f.has(h)||f.set(h,d)}}),l;function c(d,f){const h=d.type,p=l.handlers[h];if(dL.call(l.handlers,h)&&p)return p(l,d,f);
vendor: 15,625 bytes, lines 779-783
779if(l.options.passThrough&&l.options.passThrough.includes(h)){if("children"in d){const{children:x,...y}=d,g=l2(y);return g.children=l.all(d),g}return l2(d)}return(l.options.unknownHandler||c5e)(l,d,f)}function u(d){const f=[];if("children"in d){const h=d.children;let p=-1;for(;++p<h.length;){const m=l.one(h[p],d);if(m){if(p&&h[p-1].type==="break"&&(!Array.isArray(m)&&m.type==="text"&&(m.value=vW(m.value)),!Array.isArray(m)&&m.type==="element")){const x=m.children[0];x&&x.type==="text"&&(x.value=vW(x.value))}Array.isArray(m)?f.push(...m):f.push(m)}}}return f}}function o5e(t,e){t.position&&(e.position=YDe(t))}function l5e(t,e){let n=e;if(t&&t.data){const r=t.data.hName,i=t.data.hChildren,s=t.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const a="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:a}}n.type==="element"&&s&&Object.assign(n.properties,l2(s)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function c5e(t,e){const n=e.data||{},r="value"in e&&!(dL.call(n,"hProperties")||dL.call(n,"hChildren"))?{type:"text",value:e.value}:{type:"element",tagName:"div",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function u5e(t,e){const n=[];let r=-1;for(e&&n.push({type:"text",value:`
780`});++r<t.length;)r&&n.push({type:"text",value:`
781`}),n.push(t[r]);return e&&t.length>0&&n.push({type:"text",value:`
782`}),n}function vW(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function bW(t,e){const n=a5e(t,e),r=n.one(t,void 0),i=X$e(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
783`},i),s}function d5e(t,e){return t&&"run"in t?async function(n,r){const i=bW(n,{file:r,...e});await t.run(i,r)}:function(n,r){return bW(n,{file:r,...t||e})}}function wW(t){if(t)throw t}var YC=Object.prototype.hasOwnProperty,Ole=Object.prototype.toString,_W=Object.defineProperty,SW=Object.getOwnPropertyDescriptor,NW=function(e){return typeof Array.isArray=="function"?Array.isArray(e):Ole.call(e)==="[object Array]"},jW=function(e){if(!e||Ole.call(e)!=="[object Object]")return!1;var n=YC.call(e,"constructor"),r=e.constructor&&e.constructor.prototype&&YC.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!r)return!1;var i;for(i in e);return typeof i>"u"||YC.call(e,i)},CW=function(e,n){_W&&n.name==="__proto__"?_W(e,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):e[n.name]=n.newValue},kW=function(e,n){if(n==="__proto__")if(YC.call(e,n)){if(SW)return SW(e,n).value}else return;return e[n]},f5e=function t(){var e,n,r,i,s,a,l=arguments[0],c=1,u=arguments.length,d=!1;for(typeof l=="boolean"&&(d=l,l=arguments[1]||{},c=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});c<u;++c)if(e=arguments[c],e!=null)for(n in e)r=kW(l,n),i=kW(e,n),l!==i&&(d&&i&&(jW(i)||(s=NW(i)))?(s?(s=!1,a=r&&NW(r)?r:[]):a=r&&jW(r)?r:{},CW(l,{name:n,newValue:t(d,a,i)})):typeof i<"u"&&CW(l,{name:n,newValue:i}));return l};const TR=An(f5e);function fL(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function h5e(){const t=[],e={run:n,use:r};return e;function n(...i){let s=-1;const a=i.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);l(null,...i);function l(c,...u){const d=t[++s];let f=-1;if(c){a(c);return}for(;++f<i.length;)(u[f]===null||u[f]===void 0)&&(u[f]=i[f]);i=u,d?p5e(d,l)(...u):a(null,...u)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return t.push(i),e}}function p5e(t,e){let n;return r;function r(...a){const l=t.length>a.length;let c;l&&a.push(i);try{c=t.apply(this,a)}catch(u){const d=u;if(l&&n)throw d;return i(d)}l||(c&&c.then&&typeof c.then=="function"?c.then(s,i):c instanceof Error?i(c):s(c))}function i(a,...l){n||(n=!0,e(a,...l))}function s(a){i(null,a)}}const kc={basename:m5e,dirname:g5e,extname:x5e,join:y5e,sep:"/"};function m5e(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');US(t);let n=0,r=-1,i=t.length,s;if(e===void 0||e.length===0||e.length>t.length){for(;i--;)if(t.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let a=-1,l=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(s){n=i+1;break}}else a<0&&(s=!0,a=i+1),l>-1&&(t.codePointAt(i)===e.codePointAt(l--)?l<0&&(r=i):(l=-1,r=a));return n===r?r=a:r<0&&(r=t.length),t.slice(n,r)}function g5e(t){if(US(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function x5e(t){US(t);let e=t.length,n=-1,r=0,i=-1,s=0,a;for(;e--;){const l=t.codePointAt(e);if(l===47){if(a){r=e+1;break}continue}n<0&&(a=!0,n=e+1),l===46?i<0?i=e:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":t.slice(i,n)}function y5e(...t){let e=-1,n;for(;++e<t.length;)US(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":v5e(n)}function v5e(t){US(t);const e=t.codePointAt(0)===47;let n=b5e(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function b5e(t,e){let n="",r=0,i=-1,s=0,a=-1,l,c;for(;++a<=t.length;){if(a<t.length)l=t.codePointAt(a);else{if(l===47)break;l=47}if(l===47){if(!(i===a-1||s===1))if(i!==a-1&&s===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),i=a,s=0;continue}}else if(n.length>0){n="",r=0,i=a,s=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(i+1,a):n=t.slice(i+1,a),r=a-i-1;i=a,s=0}else l===46&&s>-1?s++:s=-1}return n}function US(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const w5e={cwd:_5e};function _5e(){return"/"}function hL(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function S5e(t){if(typeof t=="string")t=new URL(t);else if(!hL(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return N5e(t)}function N5e(t){if(t.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=t.pathname;let n=-1;for(;++n<e.length;)if(e.codePointAt(n)===37&&e.codePointAt(n+1)===50){const r=e.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(e)}const MR=["history","path","basename","stem","extname","dirname"];class Rle{constructor(e){let n;e?hL(e)?n={path:e}:typeof e=="string"||j5e(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":w5e.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<MR.length;){const s=MR[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let i;for(i in n)MR.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?kc.basename(this.path):void 0}set basename(e){OR(e,"basename"),PR(e,"basename"),this.path=kc.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?kc.dirname(this.path):void 0}set dirname(e){EW(this.basename,"dirname"),this.path=kc.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?kc.extname(this.path):void 0}set extname(e){if(PR(e,"extname"),EW(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=kc.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){hL(e)&&(e=S5e(e)),OR(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?kc.basename(this.path,this.extname):void 0}set stem(e){OR(e,"stem"),PR(e,"stem"),this.path=kc.join(this.dirname||"",e+(this.extname||""))}fail(e,n,r){const i=this.message(e,n,r);throw i.fatal=!0,i}info(e,n,r){const i=this.message(e,n,r);return i.fatal=void 0,i}message(e,n,r){const i=new Js(e,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function PR(t,e){if(t&&t.includes(kc.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+kc.sep+"`")}function OR(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function EW(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function j5e(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const C5e=function(t){const r=this.constructor.prototype,i=r[t],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s},k5e={}.hasOwnProperty;class m6 extends C5e{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=h5e()}copy(){const e=new m6;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];e.use(...r)}return e.data(TR(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(DR("data",this.frozen),this.namespace[e]=n,this):k5e.call(this.namespace,e)&&this.namespace[e]||void 0:e?(DR("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(e,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const n=sj(e),r=this.parser||this.Parser;return RR("parse",r),r(String(n),n)}process(e,n){const r=this;return this.freeze(),RR("process",this.parser||this.Parser),IR("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,a){const l=sj(e),c=r.parse(l);r.run(c,l,function(d,f,h){if(d||!f||!h)return u(d);const p=f,m=r.stringify(p,h);T5e(m)?h.value=m:h.result=m,u(d,h)});function u(d,f){d||!f?a(d):s?s(f):n(void 0,f)}}}processSync(e){let n=!1,r;return this.freeze(),RR("processSync",this.parser||this.Parser),IR("processSync",this.compiler||this.Compiler),this.process(e,i),TW("processSync","process",n),r;function i(s,a){n=!0,wW(s),r=a}}run(e,n,r){AW(e),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(a,l){const c=sj(n);i.run(e,c,u);function u(d,f,h){const p=f||e;d?l(d):a?a(p):r(void 0,p,h)}}}runSync(e,n){let r=!1,i;return this.run(e,n,s),TW("runSync","run",r),i;function s(a,l){wW(a),i=l,r=!0}}stringify(e,n){this.freeze();const r=sj(n),i=this.compiler||this.Compiler;return IR("stringify",i),AW(e),i(e,r)}use(e,...n){const r=this.attachers,i=this.namespace;if(DR("use",this.frozen),e!=null)if(typeof e=="function")c(e,n);else if(typeof e=="object")Array.isArray(e)?l(e):a(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function s(u){if(typeof u=="function")c(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...f]=u;c(d,f)}else a(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function a(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(u.plugins),u.settings&&(i.settings=TR(!0,i.settings,u.settings))}function l(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const f=u[d];s(f)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function c(u,d){let f=-1,h=-1;for(;++f<r.length;)if(r[f][0]===u){h=f;break}if(h===-1)r.push([u,...d]);else if(d.length>0){let[p,...m]=d;const x=r[h][1];fL(x)&&fL(p)&&(p=TR(!0,x,p)),r[h]=[u,p,...m]}}}}const E5e=new m6().freeze();function RR(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function IR(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function DR(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function AW(t){if(!fL(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function TW(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function sj(t){return A5e(t)?t:new Rle(t)}function A5e(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function T5e(t){return typeof t=="string"||M5e(t)}function M5e(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const P5e="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",MW=[],PW={allowDangerousHtml:!0},O5e=/^(https?|ircs?|mailto|xmpp)$/i,R5e=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function WT(t){const e=I5e(t),n=D5e(t);return L5e(e.runSync(e.parse(n),n),t)}function I5e(t){const e=t.rehypePlugins||MW,n=t.remarkPlugins||MW,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...PW}:PW;return E5e().use(x$e).use(n).use(d5e,r).use(e)}function D5e(t){const e=t.children||"",n=new Rle;return typeof e=="string"&&(n.value=e),n}function L5e(t,e){const n=e.allowedElements,r=e.allowElement,i=e.components,s=e.disallowedElements,a=e.skipHtml,l=e.unwrapDisallowed,c=e.urlTransform||$5e;for(const d of R5e)Object.hasOwn(e,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+P5e+d.id,void 0);return p6(t,u),e4e(t,{Fragment:o.Fragment,components:i,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function u(d,f,h){if(d.type==="raw"&&h&&typeof f=="number")return a?h.children.splice(f,1):h.children[f]={type:"text",value:d.value},f;
vendor: 6,144 bytes, lines 783-784
783if(d.type==="element"){let p;for(p in kR)if(Object.hasOwn(kR,p)&&Object.hasOwn(d.properties,p)){const m=d.properties[p],x=kR[p];(x===null||x.includes(d.tagName))&&(d.properties[p]=c(String(m||""),p,d))}}if(d.type==="element"){let p=n?!n.includes(d.tagName):s?s.includes(d.tagName):!1;if(!p&&r&&typeof f=="number"&&(p=!r(d,f,h)),p&&h&&typeof f=="number")return l&&d.children?h.children.splice(f,1,...d.children):h.children.splice(f,1),f}}}function $5e(t){const e=t.indexOf(":"),n=t.indexOf("?"),r=t.indexOf("#"),i=t.indexOf("/");return e===-1||i!==-1&&e>i||n!==-1&&e>n||r!==-1&&e>r||O5e.test(t.slice(0,e))?t:""}function OW(t,e){const n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(e);for(;i!==-1;)r++,i=n.indexOf(e,i+e.length);return r}function F5e(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function U5e(t,e,n){const i=VT((n||{}).ignore||[]),s=z5e(e);let a=-1;for(;++a<s.length;)Ple(t,"text",l);function l(u,d){let f=-1,h;for(;++f<d.length;){const p=d[f],m=h?h.children:void 0;if(i(p,m?m.indexOf(p):void 0,h))return;h=p}if(h)return c(u,d)}function c(u,d){const f=d[d.length-1],h=s[a][0],p=s[a][1];let m=0;const y=f.children.indexOf(u);let g=!1,w=[];h.lastIndex=0;let v=h.exec(u.value);for(;v;){const N=v.index,S={index:v.index,input:v.input,stack:[...d,u]};let _=p(...v,S);if(typeof _=="string"&&(_=_.length>0?{type:"text",value:_}:void 0),_===!1?h.lastIndex=N+1:(m!==N&&w.push({type:"text",value:u.value.slice(m,N)}),Array.isArray(_)?w.push(..._):_&&w.push(_),m=N+v[0].length,g=!0),!h.global)break;v=h.exec(u.value)}return g?(m<u.value.length&&w.push({type:"text",value:u.value.slice(m)}),f.children.splice(y,1,...w)):w=[u],y+w.length}}function z5e(t){const e=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!t[0]||Array.isArray(t[0])?t:[t];let r=-1;for(;++r<n.length;){const i=n[r];e.push([B5e(i[0]),V5e(i[1])])}return e}function B5e(t){return typeof t=="string"?new RegExp(F5e(t),"g"):t}function V5e(t){return typeof t=="function"?t:function(){return t}}const LR="phrasing",$R=["autolink","link","image","label"];function H5e(){return{transforms:[Q5e],enter:{literalAutolink:G5e,literalAutolinkEmail:FR,literalAutolinkHttp:FR,literalAutolinkWww:FR},exit:{literalAutolink:X5e,literalAutolinkEmail:Y5e,literalAutolinkHttp:q5e,literalAutolinkWww:K5e}}}function W5e(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:LR,notInConstruct:$R},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:LR,notInConstruct:$R},{character:":",before:"[ps]",after:"\\/",inConstruct:LR,notInConstruct:$R}]}}function G5e(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function FR(t){this.config.enter.autolinkProtocol.call(this,t)}function q5e(t){this.config.exit.autolinkProtocol.call(this,t)}function K5e(t){this.config.exit.data.call(this,t);const e=this.stack[this.stack.length-1];e.type,e.url="http://"+this.sliceSerialize(t)}function Y5e(t){this.config.exit.autolinkEmail.call(this,t)}function X5e(t){this.exit(t)}function Q5e(t){U5e(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,J5e],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Z5e]],{ignore:["link","linkReference"]})}function J5e(t,e,n,r,i){let s="";if(!Ile(i)||(/^w/i.test(e)&&(n=e+n,e="",s="http://"),!eFe(n)))return!1;const a=tFe(n+r);if(!a[0])return!1;const l={type:"link",title:null,url:s+e+a[0],children:[{type:"text",value:e+a[0]}]};return a[1]?[l,{type:"text",value:a[1]}]:l}function Z5e(t,e,n,r){return!Ile(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+n,children:[{type:"text",value:e+"@"+n}]}}function eFe(t){const e=t.split(".");return!(e.length<2||e[e.length-1]&&(/_/.test(e[e.length-1])||!/[a-zA-Z\d]/.test(e[e.length-1]))||e[e.length-2]&&(/_/.test(e[e.length-2])||!/[a-zA-Z\d]/.test(e[e.length-2])))}function tFe(t){const e=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let n=e[0],r=n.indexOf(")");const i=OW(t,"(");let s=OW(t,")");for(;r!==-1&&i>s;)t+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),s++;return[t,n]}function Ile(t,e){const n=t.input.charCodeAt(t.index-1);return(t.index===0||Hm(n)||UT(n))&&(!e||n!==47)}Dle.peek=uFe;function nFe(){this.buffer()}function rFe(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function iFe(){this.buffer()}function sFe(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function aFe(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=oc(this.sliceSerialize(t)).toLowerCase(),n.label=e}function oFe(t){this.exit(t)}function lFe(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=oc(this.sliceSerialize(t)).toLowerCase(),n.label=e}function cFe(t){this.exit(t)}function uFe(){return"["}function Dle(t,e,n,r){const i=n.createTracker(r);let s=i.move("[^");const a=n.enter("footnoteReference"),l=n.enter("reference");return s+=i.move(n.safe(n.associationId(t),{after:"]",before:s})),l(),a(),s+=i.move("]"),s}function dFe(){return{enter:{gfmFootnoteCallString:nFe,gfmFootnoteCall:rFe,gfmFootnoteDefinitionLabelString:iFe,gfmFootnoteDefinition:sFe},exit:{gfmFootnoteCallString:aFe,gfmFootnoteCall:oFe,gfmFootnoteDefinitionLabelString:lFe,gfmFootnoteDefinition:cFe}}}function fFe(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:n,footnoteReference:Dle},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,s,a){const l=s.createTracker(a);let c=l.move("[^");const u=s.enter("footnoteDefinition"),d=s.enter("label");return c+=l.move(s.safe(s.associationId(r),{before:c,after:"]"})),d(),c+=l.move("]:"),r.children&&r.children.length>0&&(l.shift(4),c+=l.move((e?`
784`:" ")+s.indentLines(s.containerFlow(r,l.current()),e?Lle:hFe))),u(),c}}function hFe(t,e,n){return e===0?t:Lle(t,e,n)}function Lle(t,e,n){return(n?"":"    ")+t}const pFe=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];$le.peek=vFe;
vendor: 8,893 bytes, lines 784-796
784function mFe(){return{canContainEols:["delete"],enter:{strikethrough:xFe},exit:{strikethrough:yFe}}}function gFe(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:pFe}],handlers:{delete:$le}}}function xFe(t){this.enter({type:"delete",children:[]},t)}function yFe(t){this.exit(t)}function $le(t,e,n,r){const i=n.createTracker(r),s=n.enter("strikethrough");let a=i.move("~~");return a+=n.containerPhrasing(t,{...i.current(),before:a,after:"~"}),a+=i.move("~~"),s(),a}function vFe(){return"~"}function bFe(t){return t.length}function wFe(t,e){const n=e||{},r=(n.align||[]).concat(),i=n.stringLength||bFe,s=[],a=[],l=[],c=[];let u=0,d=-1;for(;++d<t.length;){const x=[],y=[];let g=-1;for(t[d].length>u&&(u=t[d].length);++g<t[d].length;){const w=_Fe(t[d][g]);if(n.alignDelimiters!==!1){const v=i(w);y[g]=v,(c[g]===void 0||v>c[g])&&(c[g]=v)}x.push(w)}a[d]=x,l[d]=y}let f=-1;if(typeof r=="object"&&"length"in r)for(;++f<u;)s[f]=RW(r[f]);else{const x=RW(r);for(;++f<u;)s[f]=x}f=-1;const h=[],p=[];for(;++f<u;){const x=s[f];let y="",g="";x===99?(y=":",g=":"):x===108?y=":":x===114&&(g=":");let w=n.alignDelimiters===!1?1:Math.max(1,c[f]-y.length-g.length);const v=y+"-".repeat(w)+g;n.alignDelimiters!==!1&&(w=y.length+w+g.length,w>c[f]&&(c[f]=w),p[f]=w),h[f]=v}a.splice(1,0,h),l.splice(1,0,p),d=-1;const m=[];for(;++d<a.length;){const x=a[d],y=l[d];f=-1;const g=[];for(;++f<u;){const w=x[f]||"";let v="",N="";if(n.alignDelimiters!==!1){const S=c[f]-(y[f]||0),_=s[f];_===114?v=" ".repeat(S):_===99?S%2?(v=" ".repeat(S/2+.5),N=" ".repeat(S/2-.5)):(v=" ".repeat(S/2),N=v):N=" ".repeat(S)}n.delimiterStart!==!1&&!f&&g.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&w==="")&&(n.delimiterStart!==!1||f)&&g.push(" "),n.alignDelimiters!==!1&&g.push(v),g.push(w),n.alignDelimiters!==!1&&g.push(N),n.padding!==!1&&g.push(" "),(n.delimiterEnd!==!1||f!==u-1)&&g.push("|")}m.push(n.delimiterEnd===!1?g.join("").replace(/ +$/,""):g.join(""))}return m.join(`
785`)}function _Fe(t){return t==null?"":String(t)}function RW(t){const e=typeof t=="string"?t.codePointAt(0):0;return e===67||e===99?99:e===76||e===108?108:e===82||e===114?114:0}function SFe(t,e,n,r){const i=n.enter("blockquote"),s=n.createTracker(r);s.move("> "),s.shift(2);const a=n.indentLines(n.containerFlow(t,s.current()),NFe);return i(),a}function NFe(t,e,n){return">"+(n?"":" ")+t}function jFe(t,e){return IW(t,e.inConstruct,!0)&&!IW(t,e.notInConstruct,!1)}function IW(t,e,n){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return n;let r=-1;for(;++r<e.length;)if(t.includes(e[r]))return!0;return!1}function DW(t,e,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
786`&&jFe(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
787`}function CFe(t,e){const n=String(t);let r=n.indexOf(e),i=r,s=0,a=0;if(typeof e!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++s>a&&(a=s):s=1,i=r+e.length,r=n.indexOf(e,i);return a}function kFe(t,e){return!!(e.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function EFe(t){const e=t.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}function AFe(t,e,n,r){const i=EFe(n),s=t.value||"",a=i==="`"?"GraveAccent":"Tilde";if(kFe(t,n)){const f=n.enter("codeIndented"),h=n.indentLines(s,TFe);return f(),h}const l=n.createTracker(r),c=i.repeat(Math.max(CFe(s,i)+1,3)),u=n.enter("codeFenced");let d=l.move(c);if(t.lang){const f=n.enter(`codeFencedLang${a}`);d+=l.move(n.safe(t.lang,{before:d,after:" ",encode:["`"],...l.current()})),f()}if(t.lang&&t.meta){const f=n.enter(`codeFencedMeta${a}`);d+=l.move(" "),d+=l.move(n.safe(t.meta,{before:d,after:`
788`,encode:["`"],...l.current()})),f()}return d+=l.move(`
789`),s&&(d+=l.move(s+`
790`)),d+=l.move(c),u(),d}function TFe(t,e,n){return(n?"":"    ")+t}function g6(t){const e=t.options.quote||'"';if(e!=='"'&&e!=="'")throw new Error("Cannot serialize title with `"+e+"` for `options.quote`, expected `\"`, or `'`");return e}function MFe(t,e,n,r){const i=g6(n),s=i==='"'?"Quote":"Apostrophe",a=n.enter("definition");let l=n.enter("label");const c=n.createTracker(r);let u=c.move("[");return u+=c.move(n.safe(n.associationId(t),{before:u,after:"]",...c.current()})),u+=c.move("]: "),l(),!t.url||/[\0- \u007F]/.test(t.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(t.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(t.url,{before:u,after:t.title?" ":`
791`,...c.current()}))),l(),t.title&&(l=n.enter(`title${s}`),u+=c.move(" "+i),u+=c.move(n.safe(t.title,{before:u,after:i,...c.current()})),u+=c.move(i),l()),a(),u}function PFe(t){const e=t.options.emphasis||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize emphasis with `"+e+"` for `options.emphasis`, expected `*`, or `_`");return e}function Q1(t){return"&#x"+t.toString(16).toUpperCase()+";"}function c2(t,e,n){const r=hv(t),i=hv(e);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Fle.peek=OFe;function Fle(t,e,n,r){const i=PFe(n),s=n.enter("emphasis"),a=n.createTracker(r),l=a.move(i);let c=a.move(n.containerPhrasing(t,{after:i,before:l,...a.current()}));const u=c.charCodeAt(0),d=c2(r.before.charCodeAt(r.before.length-1),u,i);d.inside&&(c=Q1(u)+c.slice(1));const f=c.charCodeAt(c.length-1),h=c2(r.after.charCodeAt(0),f,i);h.inside&&(c=c.slice(0,-1)+Q1(f));const p=a.move(i);return s(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},l+c+p}function OFe(t,e,n){return n.options.emphasis||"*"}function RFe(t,e){let n=!1;return p6(t,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,uL}),!!((!t.depth||t.depth<3)&&o6(t)&&(e.options.setext||n))}function IFe(t,e,n,r){const i=Math.max(Math.min(6,t.depth||1),1),s=n.createTracker(r);if(RFe(t,n)){const d=n.enter("headingSetext"),f=n.enter("phrasing"),h=n.containerPhrasing(t,{...s.current(),before:`
792`,after:`
793`});return f(),d(),h+`
794`+(i===1?"=":"-").repeat(h.length-(Math.max(h.lastIndexOf("\r"),h.lastIndexOf(`
795`))+1))}const a="#".repeat(i),l=n.enter("headingAtx"),c=n.enter("phrasing");s.move(a+" ");let u=n.containerPhrasing(t,{before:"# ",after:`
796`,...s.current()});return/^[\t ]/.test(u)&&(u=Q1(u.charCodeAt(0))+u.slice(1)),u=u?a+" "+u:a,n.options.closeAtx&&(u+=" "+a),c(),l(),u}Ule.peek=DFe;function Ule(t){return t.value||""}function DFe(){return"<"}zle.peek=LFe;function zle(t,e,n,r){const i=g6(n),s=i==='"'?"Quote":"Apostrophe",a=n.enter("image");let l=n.enter("label");const c=n.createTracker(r);let u=c.move("![");return u+=c.move(n.safe(t.alt,{before:u,after:"]",...c.current()})),u+=c.move("]("),l(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(t.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(t.url,{before:u,after:t.title?" ":")",...c.current()}))),l(),t.title&&(l=n.enter(`title${s}`),u+=c.move(" "+i),u+=c.move(n.safe(t.title,{before:u,after:i,...c.current()})),u+=c.move(i),l()),u+=c.move(")"),a(),u}function LFe(){return"!"}Ble.peek=$Fe;function Ble(t,e,n,r){const i=t.referenceType,s=n.enter("imageReference");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("![");const u=n.safe(t.alt,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),a();const d=n.stack;n.stack=[],a=n.enter("reference");const f=n.safe(n.associationId(t),{before:c,after:"]",...l.current()});return a(),n.stack=d,s(),i==="full"||!u||u!==f?c+=l.move(f+"]"):i==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function $Fe(){return"!"}Vle.peek=FFe;function Vle(t,e,n){let r=t.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s<n.unsafe.length;){const a=n.unsafe[s],l=n.compilePattern(a);let c;if(a.atBreak)for(;c=l.exec(r);){let u=c.index;r.charCodeAt(u)===10&&r.charCodeAt(u-1)===13&&u--,r=r.slice(0,u)+" "+r.slice(c.index+1)}}return i+r+i}function FFe(){return"`"}function Hle(t,e){const n=o6(t);return!!(!e.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(n===t.url||"mailto:"+n===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}Wle.peek=UFe;function Wle(t,e,n,r){const i=g6(n),s=i==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let l,c;if(Hle(t,n)){const d=n.stack;n.stack=[],l=n.enter("autolink");let f=a.move("<");return f+=a.move(n.containerPhrasing(t,{before:f,after:">",...a.current()})),f+=a.move(">
796"),l(),n.stack=d,f}l=n.enter("link"),c=n.enter("label");let u=a.move("[");return u+=a.move(n.containerPhrasing(t,{before:u,after:"](",...a.current()})),u+=a.move("]("),c(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(c=n.enter("destinationLiteral"),u+=a.move("<"),u+=a.move(n.safe(t.url,{before:u,after:">",...a.current()})),u+=a.move(">")):(c=n.enter("destinationRaw"),u+=a.move(n.safe(t.url,{before:u,after:t.title?" ":")",...a.current()}))),c(),t.title&&(c=n.enter(`title${s}`),u+=a.move(" "+i),u+=a.move(n.safe(t.title,{before:u,after:i,...a.current()})),u+=a.move(i),c()),u+=a.move(")"),l(),u}function UFe(t,e,n){return Hle(t,n)?"<":"["}Gle.peek=zFe;function Gle(t,e,n,r){const i=t.referenceType,s=n.enter("linkReference");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("[");const u=n.containerPhrasing(t,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),a();const d=n.stack;n.stack=[],a=n.enter("reference");const f=n.safe(n.associationId(t),{before:c,after:"]",...l.current()});return a(),n.stack=d,s(),i==="full"||!u||u!==f?c+=l.move(f+"]"):i==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function zFe(){return"["}function x6(t){const e=t.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function BFe(t){const e=x6(t),n=t.options.bulletOther;if(!n)return e==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+n+"`) to be different");return n}function VFe(t){const e=t.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function qle(t){const e=t.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function HFe(t,e,n,r){const i=n.enter("list"),s=n.bulletCurrent;let a=t.ordered?VFe(n):x6(n);const l=t.ordered?a==="."?")":".":BFe(n);let c=e&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!t.ordered){const d=t.children?t.children[0]:void 0;if((a==="*"||a==="-")&&d&&(!d.children||!d.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),qle(n)===a&&d){let f=-1;for(;++f<t.children.length;){const h=t.children[f];if(h&&h.type==="listItem"&&h.children&&h.children[0]&&h.children[0].type==="thematicBreak"){c=!0;break}}}}c&&(a=l),n.bulletCurrent=a;const u=n.containerFlow(t,r);return n.bulletLastUsed=a,n.bulletCurrent=s,i(),u}function WFe(t){const e=t.options.listItemIndent||"one";if(e!=="tab"&&e!=="one"&&e!=="mixed")throw new Error("Cannot serialize items with `"+e+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return e}function GFe(t,e,n,r){const i=WFe(n);let s=n.bulletCurrent||x6(n);e&&e.type==="list"&&e.ordered&&(s=(typeof e.start=="number"&&e.start>-1?e.start:1)+(n.options.incrementListMarker===!1?0:e.children.indexOf(t))+s);let a=s.length+1;(i==="tab"||i==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(a=Math.ceil(a/4)*4);const l=n.createTracker(r);l.move(s+" ".repeat(a-s.length)),l.shift(a);const c=n.enter("listItem"),u=n.indentLines(n.containerFlow(t,l.current()),d);return c(),u;function d(f,h,p){return h?(p?"":" ".repeat(a))+f:(p?s:s+" ".repeat(a-s.length))+f}}function qFe(t,e,n,r){const i=n.enter("paragraph"),s=n.enter("phrasing"),a=n.containerPhrasing(t,r);return s(),i(),a}const KFe=VT(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function YFe(t,e,n,r){return(t.children.some(function(a){return KFe(a)})?n.containerPhrasing:n.containerFlow).call(n,t,r)}function XFe(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}Kle.peek=QFe;function Kle(t,e,n,r){const i=XFe(n),s=n.enter("strong"),a=n.createTracker(r),l=a.move(i+i);let c=a.move(n.containerPhrasing(t,{after:i,before:l,...a.current()}));const u=c.charCodeAt(0),d=c2(r.before.charCodeAt(r.before.length-1),u,i);d.inside&&(c=Q1(u)+c.slice(1));const f=c.charCodeAt(c.length-1),h=c2(r.after.charCodeAt(0),f,i);h.inside&&(c=c.slice(0,-1)+Q1(f));const p=a.move(i+i);return s(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},l+c+p}function QFe(t,e,n){return n.options.strong||"*"}function JFe(t,e,n,r){return n.safe(t.value,r)}function ZFe(t){const e=t.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function eUe(t,e,n){const r=(qle(n)+(n.options.ruleSpaces?" ":"")).repeat(ZFe(n));return n.options.ruleSpaces?r.slice(0,-1):r}const Yle={blockquote:SFe,break:DW,code:AFe,definition:MFe,emphasis:Fle,hardBreak:DW,heading:IFe,html:Ule,image:zle,imageReference:Ble,inlineCode:Vle,link:Wle,linkReference:Gle,list:HFe,listItem:GFe,paragraph:qFe,root:YFe,strong:Kle,text:JFe,thematicBreak:eUe};function tUe(){return{enter:{table:nUe,tableData:LW,tableHeader:LW,tableRow:iUe},exit:{codeText:sUe,table:rUe,tableData:UR,tableHeader:UR,tableRow:UR}}}function nUe(t){const e=t._align;this.enter({type:"table",align:e.map(function(n){return n==="none"?null:n}),children:[]},t),this.data.inTable=!0}function rUe(t){this.exit(t),this.data.inTable=void 0}function iUe(t){this.enter({type:"tableRow",children:[]},t)}function UR(t){this.exit(t)}function LW(t){this.enter({type:"tableCell",children:[]},t)}function sUe(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,aUe));const n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function aUe(t,e){return e==="|"?e:t}function oUe(t){const e=t||{},n=e.tableCellPadding,r=e.tablePipeAlign,i=e.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
797`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[	 :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:h,table:a,tableCell:c,tableRow:l}};function a(p,m,x,y){return u(d(p,x,y),p.align)}function l(p,m,x,y){const g=f(p,x,y),w=u([g]);return w.slice(0,w.indexOf(`
798`))}function c(p,m,x,y){const g=x.enter("tableCell"),w=x.enter("phrasing"),v=x.containerPhrasing(p,{...y,before:s,after:s});return w(),g(),v}function u(p,m){return wFe(p,{align:m,alignDelimiters:r,padding:n,stringLength:i})}function d(p,m,x){const y=p.children;let g=-1;const w=[],v=m.enter("table");for(;++g<y.length;)w[g]=f(y[g],m,x);return v(),w}function f(p,m,x){const y=p.children;let g=-1;const w=[],v=m.enter("tableRow");for(;++g<y.length;)w[g]=c(y[g],p,m,x);return v(),w}function h(p,m,x){let y=Yle.inlineCode(p,m,x);return x.stack.includes("tableCell")&&(y=y.replace(/\|/g,"\\$&")),y}}function lUe(){return{exit:{taskListCheckValueChecked:$W,taskListCheckValueUnchecked:$W,paragraph:uUe}}}function cUe(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:dUe}}}function $W(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function uUe(t){const e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=e.children;let s=-1,a;for(;++s<i.length;){const l=i[s];if(l.type==="paragraph"){a=l;break}}a===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(t)}function dUe(t,e,n,r){const i=t.children[0],s=typeof t.checked=="boolean"&&i&&i.type==="paragraph",a="["+(t.checked?"x":" ")+"] ",l=n.createTracker(r);s&&l.move(a);let c=Yle.listItem(t,e,n,{...r,...l.current()});return s&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),c;function u(d){return d+a}}function fUe(){return[H5e(),dFe(),mFe(),tUe(),lUe()]}function hUe(t){return{extensions:[W5e(),fFe(t),gFe(),oUe(t),cUe()]}}const pUe={tokenize:bUe,partial:!0},Xle={tokenize:wUe,partial:!0},Qle={tokenize:_Ue,partial:!0},Jle={tokenize:SUe,partial:!0},mUe={tokenize:NUe,partial:!0},Zle={name:"wwwAutolink",tokenize:yUe,previous:tce},ece={name:"protocolAutolink",tokenize:vUe,previous:nce},zd={name:"emailAutolink",tokenize:xUe,previous:rce},yu={};function gUe(){return{text:yu}}let hp=48;for(;hp<123;)yu[hp]=zd,hp++,hp===58?hp=65:hp===91&&(hp=97);yu[43]=zd;yu[45]=zd;yu[46]=zd;yu[95]=zd;yu[72]=[zd,ece];yu[104]=[zd,ece];yu[87]=[zd,Zle];yu[119]=[zd,Zle];function xUe(t,e,n){const r=this;let i,s;return a;function a(f){return!pL(f)||!rce.call(r,r.previous)||y6(r.events)?n(f):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),l(f))}function l(f){return pL(f)?(t.consume(f),l):f===64?(t.consume(f),c):n(f)}function c(f){return f===46?t.check(mUe,d,u)(f):f===45||f===95||Ks(f)?(s=!0,t.consume(f),c):d(f)}function u(f){return t.consume(f),i=!0,c}function d(f){return s&&i&&ua(r.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(f)):n(f)}}function yUe(t,e,n){const r=this;return i;function i(a){return a!==87&&a!==119||!tce.call(r,r.previous)||y6(r.events)?n(a):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(pUe,t.attempt(Xle,t.attempt(Qle,s),n),n)(a))}function s(a){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(
vendor: 5,044 bytes, line 798
798a)}}function vUe(t,e,n){const r=this;let i="",s=!1;return a;function a(f){return(f===72||f===104)&&nce.call(r,r.previous)&&!y6(r.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),i+=String.fromCodePoint(f),t.consume(f),l):n(f)}function l(f){if(ua(f)&&i.length<5)return i+=String.fromCodePoint(f),t.consume(f),l;if(f===58){const h=i.toLowerCase();if(h==="http"||h==="https")return t.consume(f),c}return n(f)}function c(f){return f===47?(t.consume(f),s?u:(s=!0,c)):n(f)}function u(f){return f===null||a2(f)||Sr(f)||Hm(f)||UT(f)?n(f):t.attempt(Xle,t.attempt(Qle,d),n)(f)}function d(f){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(f)}}function bUe(t,e,n){let r=0;return i;function i(a){return(a===87||a===119)&&r<3?(r++,t.consume(a),i):a===46&&r===3?(t.consume(a),s):n(a)}function s(a){return a===null?n(a):e(a)}}function wUe(t,e,n){let r,i,s;return a;function a(u){return u===46||u===95?t.check(Jle,c,l)(u):u===null||Sr(u)||Hm(u)||u!==45&&UT(u)?c(u):(s=!0,t.consume(u),a)}function l(u){return u===95?r=!0:(i=r,r=void 0),t.consume(u),a}function c(u){return i||r||!s?n(u):e(u)}}function _Ue(t,e){let n=0,r=0;return i;function i(a){return a===40?(n++,t.consume(a),i):a===41&&r<n?s(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?t.check(Jle,e,s)(a):a===null||Sr(a)||Hm(a)?e(a):(t.consume(a),i)}function s(a){return a===41&&r++,t.consume(a),i}}function SUe(t,e,n){return r;function r(l){return l===33||l===34||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===63||l===95||l===126?(t.consume(l),r):l===38?(t.consume(l),s):l===93?(t.consume(l),i):l===60||l===null||Sr(l)||Hm(l)?e(l):n(l)}function i(l){return l===null||l===40||l===91||Sr(l)||Hm(l)?e(l):r(l)}function s(l){return ua(l)?a(l):n(l)}function a(l){return l===59?(t.consume(l),r):ua(l)?(t.consume(l),a):n(l)}}function NUe(t,e,n){return r;function r(s){return t.consume(s),i}function i(s){return Ks(s)?n(s):e(s)}}function tce(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||Sr(t)}function nce(t){return!ua(t)}function rce(t){return!(t===47||pL(t))}function pL(t){return t===43||t===45||t===46||t===95||Ks(t)}function y6(t){let e=t.length,n=!1;for(;e--;){const r=t[e][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return t.length>0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const jUe={tokenize:OUe,partial:!0};function CUe(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:TUe,continuation:{tokenize:MUe},exit:PUe}},text:{91:{name:"gfmFootnoteCall",tokenize:AUe},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:kUe,resolveTo:EUe}}}}function kUe(t,e,n){const r=this;let i=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;i--;){const c=r.events[i][1];if(c.type==="labelImage"){a=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return l;function l(c){if(!a||!a._balanced)return n(c);const u=oc(r.sliceSerialize({start:a.end,end:r.now()}));return u.codePointAt(0)!==94||!s.includes(u.slice(1))?n(c):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(c),t.exit("gfmFootnoteCallLabelMarker"),e(c))}}function EUe(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},t[t.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},l=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",i,e],["exit",i,e],["enter",s,e],["enter",a,e],["exit",a,e],["exit",s,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...l),t}function AUe(t,e,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,a;return l;function l(f){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(f),t.exit("gfmFootnoteCallLabelMarker"),c}function c(f){return f!==94?n(f):(t.enter("gfmFootnoteCallMarker"),t.consume(f),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",u)}function u(f){if(s>999||f===93&&!a||f===null||f===91||Sr(f))return n(f);if(f===93){t.exit("chunkString");const h=t.exit("gfmFootnoteCallString");return i.includes(oc(r.sliceSerialize(h)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(f),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(f)}return Sr(f)||(a=!0),s++,t.consume(f),f===92?d:u}function d(f){return f===91||f===92||f===93?(t.consume(f),s++,u):u(f)}
vendor: 6,565 bytes, line 798
798}function TUe(t,e,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,a=0,l;return c;function c(m){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(m){return m===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",d):n(m)}function d(m){if(a>999||m===93&&!l||m===null||m===91||Sr(m))return n(m);if(m===93){t.exit("chunkString");const x=t.exit("gfmFootnoteDefinitionLabelString");return s=oc(r.sliceSerialize(x)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),h}return Sr(m)||(l=!0),a++,t.consume(m),m===92?f:d}function f(m){return m===91||m===92||m===93?(t.consume(m),a++,d):d(m)}function h(m){return m===58?(t.enter("definitionMarker"),t.consume(m),t.exit("definitionMarker"),i.includes(s)||i.push(s),In(t,p,"gfmFootnoteDefinitionWhitespace")):n(m)}function p(m){return e(m)}}function MUe(t,e,n){return t.check(FS,e,t.attempt(jUe,e,n))}function PUe(t){t.exit("gfmFootnoteDefinition")}function OUe(t,e,n){const r=this;return In(t,i,"gfmFootnoteDefinitionIndent",5);function i(s){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?e(s):n(s)}}function RUe(t){let n=(t||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(a,l){let c=-1;for(;++c<a.length;)if(a[c][0]==="enter"&&a[c][1].type==="strikethroughSequenceTemporary"&&a[c][1]._close){let u=c;for(;u--;)if(a[u][0]==="exit"&&a[u][1].type==="strikethroughSequenceTemporary"&&a[u][1]._open&&a[c][1].end.offset-a[c][1].start.offset===a[u][1].end.offset-a[u][1].start.offset){a[c][1].type="strikethroughSequence",a[u][1].type="strikethroughSequence";const d={type:"strikethrough",start:Object.assign({},a[u][1].start),end:Object.assign({},a[c][1].end)},f={type:"strikethroughText",start:Object.assign({},a[u][1].end),end:Object.assign({},a[c][1].start)},h=[["enter",d,l],["enter",a[u][1],l],["exit",a[u][1],l],["enter",f,l]],p=l.parser.constructs.insideSpan.null;p&&_o(h,h.length,0,zT(p,a.slice(u+1,c),l)),_o(h,h.length,0,[["exit",f,l],["enter",a[c][1],l],["exit",a[c][1],l],["exit",d,l]]),_o(a,u-1,c-u+3,h),c=u+h.length-2;break}}for(c=-1;++c<a.length;)a[c][1].type==="strikethroughSequenceTemporary"&&(a[c][1].type="data");return a}function s(a,l,c){const u=this.previous,d=this.events;let f=0;return h;function h(m){return u===126&&d[d.length-1][1].type!=="characterEscape"?c(m):(a.enter("strikethroughSequenceTemporary"),p(m))}function p(m){const x=hv(u);if(m===126)return f>1?c(m):(a.consume(m),f++,p);if(f<2&&!n)return c(m);const y=a.exit("strikethroughSequenceTemporary"),g=hv(m);return y._open=!g||g===2&&!!x,y._close=!x||x===2&&!!g,l(m)}}}class IUe{constructor(){this.map=[]}add(e,n,r){DUe(this,e,n,r)}consume(e){if(this.map.sort(function(s,a){return s[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];r.push(e.slice()),e.length=0;let i=r.pop();for(;i;){for(const s of i)e.push(s);i=r.pop()}this.map.length=0}}function DUe(t,e,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<t.map.length;){if(t.map[i][0]===e){t.map[i][1]+=n,t.map[i][2].push(...r);return}i+=1}t.map.push([e,n,r])}}function LUe(t,e){let n=!1;const r=[];for(;e<t.length;){const i=t[e];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){const s=r.length-1;r[s]=r[s]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);e+=1}return r}function $Ue(){return{flow:{null:{name:"table",tokenize:FUe,resolveAll:UUe}}}}function FUe(t,e,n){const r=this;let i=0,s=0,a;return l;function l(k){let M=r.events.length-1;for(;M>-1;){const E=r.events[M][1].type;if(E==="lineEnding"||E==="linePrefix")M--;else break}const I=M>-1?r.events[M][1].type:null,R=I==="tableHead"||I==="tableRow"?_:c;return R===_&&r.parser.lazy[r.now().line]?n(k):R(k)}function c(k){return t.enter("tableHead"),t.enter("tableRow"),u(k)}function u(k){return k===124||(a=!0,s+=1),d(k)}function d(k){return k===null?n(k):Gt(k)?s>1?(s=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(k),t.exit("lineEnding"),p):n(k):Cn(k)?In(t,d,"whitespace")(k):(s+=1,a&&(a=!1,i+=1),k===124?(t.enter("tableCellDivider"),t.consume(k),t.exit("tableCellDivider"),a=!0,d):(t.enter("data"),f(k)))}function f(k){return k===null||k===124||Sr(k)?(t.exit("data"),d(k)):(t.consume(k),k===92?h:f)}function h(k){return k===92||k===124?(t.consume(k),f):f(k)}function p(k){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(k):(t.enter("tableDelimiterRow"),a=!1,Cn(k)?In(t,m,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(k):m(k))}function m(k){return k===45||k===58?y(k):k===124?(a=!0,t.enter("tableCellDivider"),t.consume(k),t.exit("tableCellDivider"),x):S(k)}function x(k){return Cn(k)?In(t,y,"whitespace")(k):y(k)}function y(k){return k===58?(s+=1,a=!0,t.enter("tableDelimiterMarker"),t.consume(k),t.exit("tableDelimiterMarker"),g):k===45?(s+=1,g(k)):k===null||Gt(k)?N(k):S(k)}function g(k){return k===45?(t.enter("tableDelimiterFiller"),w(k)):S(k)}function w(k){return k===45?(t.consume(k),w):k===58?(a=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(k),t.exit("tableDelimiterMarker"),v):(t.exit("tableDelimiterFiller"),v(k))}function v(k){return Cn(k)?In(t,N,"whitespace")(k):N(k)}function N(k){return k===124?m(k):k===null||Gt(k)?!a||i!==s?S(k):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(k)):S(k)}function S(k){return n(k)}function _(k){return t.enter("tableRow"),j(k)}function j(k){return k===124?(t.enter("tableCellDivider"),t.consume(k),t.exit("tableCellDivider"),j):k===null||Gt(k)?(t.exit("tableRow"),e(k)):Cn(k)?In(t,j,"whitespace")(k):(t.enter("data"),A(k))}function A(k){return k===null||k===124||Sr(k)?(t.exit("data"),j(k)):(t.consume(k),k===92?C:A)}function C(k){return k===92||k===124?(t.consume(k),A):A(k)}}function UUe(t,e){let n=-1,r=!0,i=0,s=[0,0,0,0],a=[0,0,0,0],l=!1,
vendor: 4,096 bytes, line 798
798c=0,u,d,f;const h=new IUe;for(;++n<t.length;){const p=t[n],m=p[1];p[0]==="enter"?m.type==="tableHead"?(l=!1,c!==0&&(FW(h,e,c,u,d),d=void 0,c=0),u={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},h.add(n,0,[["enter",u,e]])):m.type==="tableRow"||m.type==="tableDelimiterRow"?(r=!0,f=void 0,s=[0,0,0,0],a=[0,n+1,0,0],l&&(l=!1,d={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},h.add(n,0,[["enter",d,e]])),i=m.type==="tableDelimiterRow"?2:d?3:1):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")?(r=!1,a[2]===0&&(s[1]!==0&&(a[0]=a[1],f=aj(h,e,s,i,void 0,f),s=[0,0,0,0]),a[2]=n)):m.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(a[0]=a[1],f=aj(h,e,s,i,void 0,f)),s=a,a=[s[1],n,0,0])):m.type==="tableHead"?(l=!0,c=n):m.type==="tableRow"||m.type==="tableDelimiterRow"?(c=n,s[1]!==0?(a[0]=a[1],f=aj(h,e,s,i,n,f)):a[1]!==0&&(f=aj(h,e,a,i,n,f)),i=0):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(a[3]=n)}for(c!==0&&FW(h,e,c,u,d),h.consume(e.events),n=-1;++n<e.events.length;){const p=e.events[n];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=LUe(e.events,n))}return t}function aj(t,e,n,r,i,s){const a=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",l="tableContent";n[0]!==0&&(s.end=Object.assign({},Fx(e.events,n[0])),t.add(n[0],0,[["exit",s,e]]));const c=Fx(e.events,n[1]);if(s={type:a,start:Object.assign({},c),end:Object.assign({},c)},t.add(n[1],0,[["enter",s,e]]),n[2]!==0){const u=Fx(e.events,n[2]),d=Fx(e.events,n[3]),f={type:l,start:Object.assign({},u),end:Object.assign({},d)};if(t.add(n[2],0,[["enter",f,e]]),r!==2){const h=e.events[n[2]],p=e.events[n[3]];if(h[1].end=Object.assign({},p[1].end),h[1].type="chunkText",h[1].contentType="text",n[3]>n[2]+1){const m=n[2]+1,x=n[3]-n[2]-1;t.add(m,x,[])}}t.add(n[3]+1,0,[["exit",f,e]])}return i!==void 0&&(s.end=Object.assign({},Fx(e.events,i)),t.add(i,0,[["exit",s,e]]),s=void 0),s}function FW(t,e,n,r,i){const s=[],a=Fx(e.events,n);i&&(i.end=Object.assign({},a),s.push(["exit",i,e])),r.end=Object.assign({},a),s.push(["exit",r,e]),t.add(n+1,0,s)}function Fx(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const zUe={name:"tasklistCheck",tokenize:VUe};function BUe(){return{text:{91:zUe}}}function VUe(t,e,n){const r=this;return i;function i(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(c),t.exit("taskListCheckMarker"),s)}function s(c){return Sr(c)?(t.enter("taskListCheckValueUnchecked"),t.consume(c),t.exit("taskListCheckValueUnchecked"),a):c===88||c===120?(t.enter("taskListCheckValueChecked"),t.consume(c),t.exit("taskListCheckValueChecked"),a):n(c)}function a(c){return c===93?(t.enter("taskListCheckMarker"),t.consume(c),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),l):n(c)}function l(c){return Gt(c)?e(c):Cn(c)?t.check({tokenize:HUe},e,n)(c):n(c)}}function HUe(t,e,n){return In(t,r,"whitespace");function r(i){return i===null?n(i):e(i)}}function WUe(t){return hle([gUe(),CUe(),RUe(t),$Ue(),BUe()])}const GUe={};function v6(t){const e=this,n=t||GUe,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(WUe(n)),s.push(fUe()),a.push(hUe(n))}function ice({steps:t}){return t.length===0?null:o.jsx("div",{className:"flex flex-col gap-1.5 mb-3 py-2",children:t.map((e,n)=>o.jsxs("div",{className:ne("flex items-center gap-2 text-xs",e.status==="completed"&&"text-muted-foreground",e.status==="running"&&"text-primary",e.status==="failed"&&"text-destructive",e.status==="pending"&&"text-muted-foreground/60"),children:[o.jsxs("div",{className:"flex-shrink-0",children:[e.status==="running"&&o.jsx(Me,{className:"h-3 w-3 animate-spin"}),e.status==="completed"&&o.jsx(Sn,{className:"h-3 w-3 text-primary"}),e.status==="failed"&&o.jsx(_z,{className:"h-3 w-3"}),e.status==="pending"&&o.jsx("div",{className:"h-3 w-3 rounded-full border border-muted-foreground
798/30"})]}),o.jsx("span",{className:ne(e.status==="running"&&"font-medium"),children:e.label}),e.duration_ms!=null&&e.status==="completed"&&o.jsx("span",{className:"text-muted-foreground/50",children:e.duration_ms<1e3?`${e.duration_ms}ms`:`${(e.duration_ms/1e3).toFixed(1)}s`}),e.status==="running"&&o.jsx("span",{className:"text-muted-foreground/50 animate-pulse",children:"..."})]},`${e.label}-${n}`))})}var qUe=Array.isArray,ja=qUe,KUe=typeof Vf=="object"&&Vf&&Vf.Object===Object&&Vf,sce=KUe,YUe=sce,XUe=typeof self=="object"&&self&&self.Object===Object&&self,QUe=YUe||XUe||Function("return this")(),vc=QUe,JUe=vc,ZUe=JUe.Symbol,zS=ZUe,UW=zS,ace=Object.prototype,eze=ace.hasOwnProperty,tze=ace.toString,vb=UW?UW.toStringTag:void 0;function nze(t){var e=eze.call(t,vb),n=t[vb];try{t[vb]=void 0;var r=!0}catch{}var i=tze.call(t);return r&&(e?t[vb]=n:delete t[vb]),i}var rze=nze,ize=Object.prototype,sze=ize.toString;function aze(t){return sze.call(t)}var oze=aze,zW=zS,lze=rze,cze=oze,uze="[object Null]",dze="[object Undefined]",BW=zW?zW.toStringTag:void 0;function fze(t){return t==null?t===void 0?dze:uze:BW&&BW in Object(t)?lze(t):cze(t)}var Bd=fze;function hze(t){return t!=null&&typeof t=="object"}var vu=hze,pze=Bd,mze=vu,gze="[object Symbol]";function xze(t){return typeof t=="symbol"||mze(t)&&pze(t)==gze}var O0=xze,yze=ja,vze=O0,bze=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,wze=/^\w*$/;function _ze(t,e){if(yze(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||vze(t)?!0:wze.test(t)||!bze.test(t)||e!=null&&t in Object(e)}var b6=_ze;function Sze(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var Lo=Sze;const R0=An(Lo);var Nze=Bd,jze=Lo,Cze="[object AsyncFunction]",kze="[object Function]",Eze="[object GeneratorFunction]",Aze="[object Proxy]";function Tze(t){if(!jze(t))return!1;var e=Nze(t);return e==kze||e==Eze||e==Cze||e==Aze}var GT=Tze;const Kt=An(GT);var Mze=vc,Pze=Mze["__core-js_shared__"],Oze=Pze,zR=Oze,VW=function(){var t=/[^.]+$/.exec(zR&&zR.keys&&zR.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Rze(t){return!!VW&&VW in t}var Ize=Rze,Dze=Function.prototype,Lze=Dze.toString;function $ze(t){if(t!=null){try{return Lze.call(t)}catch{}try{return t+""}catch{}}return""}var oce=$ze,Fze=GT,Uze=Ize,zze=Lo,Bze=oce,Vze=/[\\^$.*+?()[\]{}|]/g,Hze=/^\[object .+?Constructor\]$/,Wze=Function.prototype,Gze=Object.prototype,qze=Wze.toString,Kze=Gze.hasOwnProperty,Yze=RegExp("^"+qze.call(Kze).replace(Vze,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Xze(t){if(!zze(t)||Uze(t))return!1;var e=Fze(t)?Yze:Hze;return e.test(Bze(t))}var Qze=Xze;function Jze(t,e){return t==null?void 0:t[e]}var Zze=Jze,e6e=Qze,t6e=Zze;function n6e(t,e){var n=t6e(t,e);return e6e(n)?n:void 0}var jg=n6e,r6e=jg,i6e=r6e(Object,"create"),qT=i6e,HW=qT;function s6e(){this.__data__=HW?HW(null):{},this.size=0}var a6e=s6e;function o6e(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var l6e=o6e,c6e=qT,u6e="__lodash_hash_undefined__",d6e=Object.prototype,f6e=d6e.hasOwnProperty;function h6e(t){var e=this.__data__;if(c6e){var n=e[t];return n===u6e?void 0:n}return f6e.call(e,t)?e[t]:void 0}var p6e=h6e,m6e=qT,g6e=Object.prototype,x6e=g6e.hasOwnProperty;function y6e(t){var e=this.__data__;return m6e?e[t]!==void 0:x6e.call(e,t)}var v6e=y6e,b6e=qT,w6e="__lodash_hash_undefined__";function _6e(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=b6e&&e===void 0?w6e:e,this}var S6e=_6e,N6e=a6e,j6e=l6e,C6e=p6e,k6e=v6e,E6e=S6e;function I0(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}I0.prototype.clear=N6e;I0.prototype.delete=j6e;I0.prototype.get=C6e;I0.prototype.has=k6e;I0.prototype.set=E6e;var A6e=I0;function T6e(){this.__data__=[],this.size=0}var M6e=T6e;function P6e(t,e){return t===e||t!==t&&e!==e}var BS=P6e,O6e=BS;function R6e(t,e){for(var n=t.length;n--;)if(O6e(t[n][0],e))return n;return-1}var KT=R6e,I6e=KT,D6e=Array.prototype,L6e=D6e.splice;function $6e(t){var e=this.__data__,n=I6e(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():L6e.call(e,n,1),--this.size,!0}var F6e=$6e,U6e=KT;function z6e(t){var e=this.__data__,n=U6e(e,t);return n<0?void 0:e[n][1]}var B6e=z6e,V6e=KT;function H6e(t){return V6e(this.__data__,t)>-1}
vendor: 8,581 bytes, lines 798-806
798var W6e=H6e,G6e=KT;function q6e(t,e){var n=this.__data__,r=G6e(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}var K6e=q6e,Y6e=M6e,X6e=F6e,Q6e=B6e,J6e=W6e,Z6e=K6e;function D0(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}D0.prototype.clear=Y6e;D0.prototype.delete=X6e;D0.prototype.get=Q6e;D0.prototype.has=J6e;D0.prototype.set=Z6e;var YT=D0,eBe=jg,tBe=vc,nBe=eBe(tBe,"Map"),w6=nBe,WW=A6e,rBe=YT,iBe=w6;function sBe(){this.size=0,this.__data__={hash:new WW,map:new(iBe||rBe),string:new WW}}var aBe=sBe;function oBe(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var lBe=oBe,cBe=lBe;function uBe(t,e){var n=t.__data__;return cBe(e)?n[typeof e=="string"?"string":"hash"]:n.map}var XT=uBe,dBe=XT;function fBe(t){var e=dBe(this,t).delete(t);return this.size-=e?1:0,e}var hBe=fBe,pBe=XT;function mBe(t){return pBe(this,t).get(t)}var gBe=mBe,xBe=XT;function yBe(t){return xBe(this,t).has(t)}var vBe=yBe,bBe=XT;function wBe(t,e){var n=bBe(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}var _Be=wBe,SBe=aBe,NBe=hBe,jBe=gBe,CBe=vBe,kBe=_Be;function L0(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}L0.prototype.clear=SBe;L0.prototype.delete=NBe;L0.prototype.get=jBe;L0.prototype.has=CBe;L0.prototype.set=kBe;var _6=L0,lce=_6,EBe="Expected a function";function S6(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(EBe);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],s=n.cache;if(s.has(i))return s.get(i);var a=t.apply(this,r);return n.cache=s.set(i,a)||s,a};return n.cache=new(S6.Cache||lce),n}S6.Cache=lce;var cce=S6;const ABe=An(cce);var TBe=cce,MBe=500;function PBe(t){var e=TBe(t,function(r){return n.size===MBe&&n.clear(),r}),n=e.cache;return e}var OBe=PBe,RBe=OBe,IBe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,DBe=/\\(\\)?/g,LBe=RBe(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(IBe,function(n,r,i,s){e.push(i?s.replace(DBe,"$1"):r||n)}),e}),$Be=LBe;function FBe(t,e){for(var n=-1,r=t==null?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}var QT=FBe,GW=zS,UBe=QT,zBe=ja,BBe=O0,qW=GW?GW.prototype:void 0,KW=qW?qW.toString:void 0;function uce(t){if(typeof t=="string")return t;if(zBe(t))return UBe(t,uce)+"";if(BBe(t))return KW?KW.call(t):"";var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}var VBe=uce,HBe=VBe;function WBe(t){return t==null?"":HBe(t)}var dce=WBe,GBe=ja,qBe=b6,KBe=$Be,YBe=dce;function XBe(t,e){return GBe(t)?t:qBe(t,e)?[t]:KBe(YBe(t))}var JT=XBe,QBe=O0;function JBe(t){if(typeof t=="string"||QBe(t))return t;var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}var VS=JBe,ZBe=JT,e8e=VS;function t8e(t,e){e=ZBe(e,t);for(var n=0,r=e.length;t!=null&&n<r;)t=t[e8e(e[n++])];return n&&n==r?t:void 0}var ZT=t8e,n8e=ZT;function r8e(t,e,n){var r=t==null?void 0:n8e(t,e);return r===void 0?n:r}var fce=r8e;const vi=An(fce);function i8e(t){return t==null}var s8e=i8e;const nn=An(s8e);var a8e=Bd,o8e=ja,l8e=vu,c8e="[object String]";function u8e(t){return typeof t=="string"||!o8e(t)&&l8e(t)&&a8e(t)==c8e}var d8e=u8e;const Ph=An(d8e);var hce={exports:{}},ir={};/**
799 * @license React
800 * react-is.production.min.js
801 *
802 * Copyright (c) Facebook, Inc. and its affiliates.
803 *
804 * This source code is licensed under the MIT license found in the
805 * LICENSE file in the root directory of this source tree.
806 */var N6=Symbol.for("react.element"),j6=Symbol.for("react.portal"),eM=Symbol.for("react.fragment"),tM=Symbol.for("react.strict_mode"),nM=Symbol.for("react.profiler"),rM=Symbol.for("react.provider"),iM=Symbol.for("react.context"),f8e=Symbol.for("react.server_context"),sM=Symbol.for("react.forward_ref"),aM=Symbol.for("react.suspense"),oM=Symbol.for("react.suspense_list"),lM=Symbol.for("react.memo"),cM=Symbol.for("react.lazy"),h8e=Symbol.for("react.offscreen"),pce;pce=Symbol.for("react.module.reference");function Sl(t){if(typeof t=="object"&&t!==null){var e=t.$$typeof;switch(e){case N6:switch(t=t.type,t){case eM:case nM:case tM:case aM:case oM:return t;default:switch(t=t&&t.$$typeof,t){case f8e:case iM:case sM:case cM:case lM:case rM:return t;default:return e}}case j6:return e}}}ir.ContextConsumer=iM;ir.ContextProvider=rM;ir.Element=N6;ir.ForwardRef=sM;ir.Fragment=eM;ir.Lazy=cM;ir.Memo=lM;ir.Portal=j6;ir.Profiler=nM;ir.StrictMode=tM;ir.Suspense=aM;ir.SuspenseList=oM;ir.isAsyncMode=function(){return!1};ir.isConcurrentMode=function(){return!1};ir.isContextConsumer=function(t){return Sl(t)===iM};ir.isContextProvider=function(t){return Sl(t)===rM};ir.isElement=function(t){return typeof t=="object"&&t!==null&&t.$$typeof===N6};ir.isForwardRef=function(t){return Sl(t)===sM};ir.isFragment=function(t){return Sl(t)===eM};ir.isLazy=function(t){return Sl(t)===cM};ir.isMemo=function(t){return Sl(t)===lM};ir.isPortal=function(t){return Sl(t)===j6};ir.isProfiler=function(t){return Sl(t)===nM};ir.isStrictMode=function(t){return Sl(t)===tM};ir.isSuspense=function(t){return Sl(t)===aM};ir.isSuspenseList=function(t){return Sl(t)===oM};ir.isValidElementType=function(t){return typeof t=="string"||typeof t=="function"||t===eM||t===nM||t===tM||t===aM||t===oM||t===h8e||typeof t=="object"&&t!==null&&(t.$$typeof===cM||t.$$typeof===lM||t.$$typeof===rM||t.$$typeof===iM||t.$$typeof===sM||t.$$typeof===pce||t.getModuleId!==void 0)};ir.typeOf=Sl;hce.exports=ir;var p8e=hce.exports,m8e=Bd,g8e=vu,x8e="[object Number]";function y8e(t){return typeof t=="number"||g8e(t)&&m8e(t)==x8e}var mce=y8e;const v8e=An(mce);var b8e=mce;function w8e(t){return b8e(t)&&t!=+t}var _8e=w8e;const $0=An(_8e);var da=function(e){return e===0?0:e>0?1:-1},Xp=function(e){return Ph(e)&&e.indexOf("%")===e.length-1},Qe=function(e){return v8e(e)&&!$0(e)},S8e=function(e){return nn(e)},Xi=function(e){return Qe(e)||Ph(e)},N8e=0,Cg=function(e){var n=++N8e;return"".concat(e||"").concat(n)},fa=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Qe(e)&&!Ph(e))return r;var s;if(Xp(e)){var a=e.indexOf("%");s=n*parseFloat(e.slice(0,a))/100}else s=+e;return $0(s)&&(s=r),i&&s>n&&(s=n),s},Ef=function(e){if(!e)return null;var n=Object.keys(e);return n&&n.length?e[n[0]]:null},j8e=function(e){if(!Array.isArray(e))return!1;for(var n=e.length,r={},i=0;i<n;i++)if(!r[e[i]])r[e[i]]=!0;else return!0;return!1},qi=function(e,n){return Qe(e)&&Qe(n)?function(r){return e+r*(n-e)}:function(){return n}};function u2(t,e,n){return!t||!t.length?null:t.find(function(r){return r&&(typeof e=="function"?e(r):vi(r,e))===n})}var C8e=function(e,n){return Qe(e)&&Qe(n)?e-n:Ph(e)&&Ph(n)?e.localeCompare(n):e instanceof Date&&n instanceof Date?e.getTime()-n.getTime():String(e).localeCompare(String(n))};function Ey(t,e){for(var n in t)if({}.hasOwnProperty.call(t,n)&&(!{}.hasOwnProperty.call(e,n)||t[n]!==e[n]))return!1;for(var r in e)if({}.hasOwnProperty.call(e,r)&&!{}.hasOwnProperty.call(t,r))return!1;return!0}function mL(t){"@babel/helpers - typeof";return mL=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},mL(t)}var k8e=["viewBox","children"],E8e=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRen
806dering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],YW=["points","pathLength"],BR={svg:k8e,polygon:YW,polyline:YW},C6=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDrag
806Capture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],d2=function(e,n){if(!e||typeof e=="function"||typeof e=="boolean")return null;var r=e;if(b.isValidElement(e)&&(r=e.props),!R0(r))return null;var i={};return Object.keys(r).forEach(function(s){C6.includes(s)&&(i[s]=n||function(a){return r[s](r,a)})}),i},A8e=function(e,n,r){return function(i){return e(n,r,i),null}},Wm=function(e,n,r){if(!R0(e)||mL(e)!=="object")return null;var i=null;return Object.keys(e).forEach(function(s){var a=e[s];C6.includes(s)&&typeof a=="function"&&(i||(i={}),i[s]=A8e(a,n,r))}),i},T8e=["children"],M8e=["children"];function XW(t,e){if(t==null)return{};var n=P8e(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function P8e(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function gL(t){"@babel/helpers - typeof";return gL=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},gL(t)}var QW={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},ld=function(e){return typeof e=="string"?e:e?e.displayName||e.name||"Component":""},JW=null,VR=null,k6=function t(e){if(e===JW&&Array.isArray(VR))return VR;var n=[];return b.Children.forEach(e,function(r){nn(r)||(p8e.isFragment(r)?n=n.concat(t(r.props.children)):n.push(r))}),VR=n,JW=e,n};function So(t,e){var n=[],r=[];return Array.isArray(e)?r=e.map(function(i){return ld(i)}):r=[ld(e)],k6(t).forEach(function(i){var s=vi(i,"type.displayName")||vi(i,"type.name");r.indexOf(s)!==-1&&n.push(i)}),n}function lo(t,e){var n=So(t,e);return n&&n[0]}var ZW=function(e){if(!e||!e.props)return!1;var n=e.props,r=n.width,i=n.height;return!(!Qe(r)||r<=0||!Qe(i)||i<=0)},O8e=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],R8e=function(e){return e&&e.type&&Ph(e.type)&&O8e.indexOf(e.type)>=0},gce=function(e){return e&&gL(e)==="object"&&"clipDot"in e},I8e=function(e,n,r,i){var s,a=(s=BR==null?void 0:BR[i])!==null&&s!==void 0?s:[];return n.startsWith("data-")||!Kt(e)&&(i&&a.includes(n)||E8e.includes(n))||r&&C6.includes(n)},Pt=function(e,n,r){if(!e||typeof e=="function"||typeof e=="boolean")return null;var i=e;if(b.isValidElement(e)&&(i=e.props),!R0(i))return null;var s={};
vendor: 4,482 bytes, line 806
806return Object.keys(i).forEach(function(a){var l;I8e((l=i)===null||l===void 0?void 0:l[a],a,n,r)&&(s[a]=i[a])}),s},xL=function t(e,n){if(e===n)return!0;var r=b.Children.count(e);if(r!==b.Children.count(n))return!1;if(r===0)return!0;if(r===1)return eG(Array.isArray(e)?e[0]:e,Array.isArray(n)?n[0]:n);for(var i=0;i<r;i++){var s=e[i],a=n[i];if(Array.isArray(s)||Array.isArray(a)){if(!t(s,a))return!1}else if(!eG(s,a))return!1}return!0},eG=function(e,n){if(nn(e)&&nn(n))return!0;if(!nn(e)&&!nn(n)){var r=e.props||{},i=r.children,s=XW(r,T8e),a=n.props||{},l=a.children,c=XW(a,M8e);return i&&l?Ey(s,c)&&xL(i,l):!i&&!l?Ey(s,c):!1}return!1},tG=function(e,n){var r=[],i={};return k6(e).forEach(function(s,a){if(R8e(s))r.push(s);else if(s){var l=ld(s.type),c=n[l]||{},u=c.handler,d=c.once;if(u&&(!d||!i[l])){var f=u(s,l,a);r.push(f),i[l]=!0}}}),r},D8e=function(e){var n=e&&e.type;return n&&QW[n]?QW[n]:null},L8e=function(e,n){return k6(n).indexOf(e)},$8e=["children","width","height","viewBox","className","style","title","desc"];function yL(){return yL=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},yL.apply(this,arguments)}function F8e(t,e){if(t==null)return{};var n=U8e(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function U8e(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function vL(t){var e=t.children,n=t.width,r=t.height,i=t.viewBox,s=t.className,a=t.style,l=t.title,c=t.desc,u=F8e(t,$8e),d=i||{width:n,height:r,x:0,y:0},f=an("recharts-surface",s);return te.createElement("svg",yL({},Pt(u,!0,"svg"),{className:f,width:n,height:r,style:a,viewBox:"".concat(d.x," ").concat(d.y," ").concat(d.width," ").concat(d.height)}),te.createElement("title",null,l),te.createElement("desc",null,c),e)}var z8e=["children","className"];function bL(){return bL=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},bL.apply(this,arguments)}function B8e(t,e){if(t==null)return{};var n=V8e(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function V8e(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var kn=te.forwardRef(function(t,e){var n=t.children,r=t.className,i=B8e(t,z8e),s=an("recharts-layer",r);return te.createElement("g",bL({className:s},Pt(i,!0),{ref:e}),n)}),lc=function(e,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),s=2;s<r;s++)i[s-2]=arguments[s]};function H8e(t,e,n){var r=-1,i=t.length;e<0&&(e=-e>i?0:i+e),n=n>i?i:n,n<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var s=Array(i);++r<i;)s[r]=t[r+e];return s}var W8e=H8e,G8e=W8e;function q8e(t,e,n){var r=t.length;return n=n===void 0?r:n,!e&&n>=r?t:G8e(t,e,n)}var K8e=q8e,Y8e="\\ud800-\\udfff",X8e="\\u0300-\\u036f",Q8e="\\ufe20-\\ufe2f",J8e="\\u20d0-\\u20ff",Z8e=X8e+Q8e+J8e,e9e="\\ufe0e\\ufe0f",t9e="\\u200d",n9e=RegExp("["+t9e+Y8e+Z8e+e9e+"]");function r9e(t){return n9e.test(t)}var xce=r9e;function i9e(t){return t.split("")}var s9e=i9e,yce="\\ud800-\\udfff",a9e="\\u0300-\\u036f",o9e="\\ufe20-\\ufe2f",l9e="\\u20d0-\\u20ff",c9e=a9e+o9e+l9e,u9e="\\ufe0e\\ufe0f",d9e="["+yce+"]",wL="["+c9e+"]",_L="\\ud83c[\\udffb-\\udfff]",f9e="(?:"+wL+"|"+_L+")",vce="[^"+yce+"]",bce="(?:\\ud83c[\\udde6-\\uddff]){2}",wce="[\\ud800-\\udbff][\\udc00-\\udfff]",h9e="\\u200d",_ce=f9e+"?",Sce="["+u9e+"]?",p9e="(?:"+h9e+"(?:"+[vce,bce,wce].join("|")+")"+Sce+_ce+")*",m9e=Sce+_ce+p9e,g9e="(?:"+[vce+wL+"?",wL,bce,wce,d9e].join("|")+")",x9e=RegExp(_L+"(?="+_L+")|"+g9e+m9e,"g");function y9e(t){return t.match(x9e)||[]}var v9e=y9e,b9e=s9e,w9e=xce,_9e=v9e;function S9e(t){return w9e(t)?_9e(t):b9e(t)}var N9e=S9e,j9e=K8e,C9e=xce,k9e=N9e,E9e=dce;function A9e(t){return function(e){e=E9e(e);var n=C9e(e)?k9e(e):void 0,r=n?n[0]:e.charAt(0),i=n?j9e(n,1).join(""):e.slice(1);return r[t]()+i}}var T9e=A9e,M9e=T9e,P9e=M9e("toUpperCase"),O9e=P9e;const uM=An(O9e);function Ar(t){return function(){return t}}
806const Nce=Math.cos,f2=Math.sin,bc=Math.sqrt,nG=1e-12,h2=Math.PI,dM=2*h2,SL=Math.PI,NL=2*SL,Mp=1e-6,R9e=NL-Mp;function jce(t){this._+=t[0];for(let e=1,n=t.length;e<n;++e)this._+=arguments[e]+t[e]}function I9e(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return jce;const n=10**e;return function(r){this._+=r[0];for(let i=1,s=r.length;i<s;++i)this._+=Math.round(arguments[i]*n)/n+r[i]}}let D9e=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?jce:I9e(e)}moveTo(e,n){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,n){this._append`L${this._x1=+e},${this._y1=+n}`}quadraticCurveTo(e,n,r,i){this._append`Q${+e},${+n},${this._x1=+r},${this._y1=+i}`}bezierCurveTo(e,n,r,i,s,a){this._append`C${+e},${+n},${+r},${+i},${this._x1=+s},${this._y1=+a}`}arcTo(e,n,r,i,s){if(e=+e,n=+n,r=+r,i=+i,s=+s,s<0)throw new Error(`negative radius: ${s}`);let a=this._x1,l=this._y1,c=r-e,u=i-n,d=a-e,f=l-n,h=d*d+f*f;if(this._x1===null)this._append`M${this._x1=e},${this._y1=n}`;else if(h>Mp)if(!(Math.abs(f*c-u*d)>Mp)||!s)this._append`L${this._x1=e},${this._y1=n}`;else{let p=r-a,m=i-l,x=c*c+u*u,y=p*p+m*m,g=Math.sqrt(x),w=Math.sqrt(h),v=s*Math.tan((SL-Math.acos((x+h-y)/(2*g*w)))/2),N=v/w,S=v/g;Math.abs(N-1)>Mp&&this._append`L${e+N*d},${n+N*f}`,this._append`A${s},${s},0,0,${+(f*p>d*m)},${this._x1=e+S*c},${this._y1=n+S*u}`}}arc(e,n,r,i,s,a){if(e=+e,n=+n,r=+r,a=!!a,r<0)throw new Error(`negative radius: ${r}`);let l=r*Math.cos(i),c=r*Math.sin(i),u=e+l,d=n+c,f=1^a,h=a?i-s:s-i;this._x1===null?this._append`M${u},${d}`:(Math.abs(this._x1-u)>Mp||Math.abs(this._y1-d)>Mp)&&this._append`L${u},${d}`,r&&(h<0&&(h=h%NL+NL),h>R9e?this._append`A${r},${r},0,1,${f},${e-l},${n-c}A${r},${r},0,1,${f},${this._x1=u},${this._y1=d}`:h>Mp&&this._append`A${r},${r},0,${+(h>=SL)},${f},${this._x1=e+r*Math.cos(s)},${this._y1=n+r*Math.sin(s)}`)}rect(e,n,r,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}};function E6(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(n==null)e=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);e=r}return t},()=>new D9e(e)}function A6(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function Cce(t){this._context=t}Cce.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}};function kg(t){return new Cce(t)}function kce(t){return t[0]}function Ece(t){return t[1]}function T6(t,e){var n=Ar(!0),r=null,i=kg,s=null,a=E6(l);t=typeof t=="function"?t:t===void 0?kce:Ar(t),e=typeof e=="function"?e:e===void 0?Ece:Ar(e);function l(c){var u,d=(c=A6(c)).length,f,h=!1,p;for(r==null&&(s=i(p=a())),u=0;u<=d;++u)!(u<d&&n(f=c[u],u,c))===h&&((h=!h)?s.lineStart():s.lineEnd()),h&&s.point(+t(f,u,c),+e(f,u,c));if(p)return s=null,p+""||null}return l.x=function(c){return arguments.length?(t=typeof c=="function"?c:Ar(+c),l):t},l.y=function(c){return arguments.length?(e=typeof c=="function"?c:Ar(+c),l):e},l.defined=function(c){return arguments.length?(n=typeof c=="function"?c:Ar(!!c),l):n},l.curve=function(c){return arguments.length?(i=c,r!=null&&(s=i(r)),l):i},l.context=function(c){return arguments.length?(c==null?r=s=null:s=i(r=c),l):r},l}function hw(t,e,n){var r=null,i=Ar(!0),s=null,a=kg,l=null,c=E6(u);t=typeof t=="function"?t:t===void 0?kce:Ar(+t),e=typeof e=="function"?e:Ar(e===void 0?0:+e),n=typeof n=="function"?n:n===void 0?Ece:Ar(+n);function u(f){var h,p,m,x=(f=A6(f)).length,y,g=!1,w,v=new Array(x),N=new Array(x);for(s==null&&(l=a(w=c())),h=0;h<=x;++h){if(!(h<x&&i(y=f[h],h,f))===g)if(g=!g)p=h,l.areaStart(),l.lineStart();else{for(l.lineEnd(),l.lineStart(),m=h-1;m>=p;--m)l.point(v[m],N[m]);l.lineEnd(),l.areaEnd()}g&&(v[h]=+t(y,h,f),N[h]=+e(y,h,f),l.point(r?+r(y,h,f):v[h],n?+n(y,h,f):N[h]))}if(w)return l=null,w+""||null}function d(){return T6().defined(i).curve(a).context(s)}return u.x=function(f){return arguments.length?(t=typeof f=="function"?f:Ar(+f),r=null,u):t},u.x0=function(f){return arguments.length?(t=typeof f=="function"?f:Ar(+f),u):t},u.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Ar(+f),u):r},u.y=function(f){return arguments.length?(e=typeof f=="function"?f:Ar(+f),n=null,u):e},u.y0=function(f){return arguments.length?(e=typeof f=="function"?f:Ar(+f),u):e},u.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Ar(+f),u):n},u.lineX0=u.lineY0=function(){return d().x(t).y(e)},u.lineY1=function(){return d().x(t).y(n)},u.lineX1=function(){return d().x(r).y(e)},u.defined=function(f){return arguments.length?(i=typeof f=="function"?f:Ar(!!f),u):i},u.curve=function(f){return arguments.length?(a=f,s!=null&&(l=a(s)),u):a},u.context=function(f){return arguments.length?(f==null?s=l=null:l=a(s=f),u):s},u}class Ace{constructor(e,n){this._context=e,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,n){switch(e=+e,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,n,e,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,e,this._y0,e,n);break}}this._x0=e,this._y0=n}}function L9e(t){return new Ace(t,!0)}function $9e(t){return new Ace(t,!1)}const M6={draw(t,e){const n=bc(e/h2);t.moveTo(n,0),t.arc(0,0,n,0,dM)}},F9e={draw(t,e){const n=bc(e/5)/2;t.moveTo(-3*n,-n),t.lineTo(-n,-n),t.lineTo(-n,-3*n),t.lineTo(n,-3*n),t.lineTo(n,-n),t.lineTo(3*n,-n),t.lineTo(3*n,n),t.lineTo(n,n),t.lineTo(n,3*n),t.lineTo(-n,3*n),t.lineTo(-n,n),t.lineTo(-3*n,n),t.closePath()}},Tce=bc(1/3),U9e=Tce*2,z9e={draw(t,e){const n=bc(e/U9e),r=n*Tce;t.moveTo(0,-n),t.lineTo(r,0),t.lineTo(0,n),t.lineTo(-r,0),t.closePath()}},B9e={draw(t,e){const n=bc(e),r=-n/2;t.rect(r,r,n,n)}},V9e=.8908130915292852,Mce=f2(h2/10)/f2(7*h2/10),H9e=f2(dM/10)*Mce,W9e=-Nce(dM/10)*Mce,G9e={draw(t,e){const n=bc(e*V9e),r=H9e*n,i=W9e*n;t.moveTo(0,-n),t.lineTo(r,i);for(let s=1;s<5;++s){const a=dM*s/5,l=Nce(a),c=f2(a);t.lineTo(c*n,-l*n),t.lineTo(l*r-c*i,c*r+l*i)}t.closePath()}},HR=bc(3),q9e={draw(t,e){const n=-bc(e/(HR*3));t.moveTo(0,n*2),t.lineTo(-HR*n,-n),t.lineTo(HR*n,-n),t.closePath()}},Uo=-.5,zo=bc(3)/2,jL=1/bc(12),K9e=(jL/2+1)*3,Y9e={draw(t,e){const n=bc(e/K9e),r=n/2,i=n*jL,s=r,a=n*jL+n,l=-s,c=a;t.moveTo(r,i),t.lineTo(s,a),t.lineTo(l,c),t.lineTo(Uo*r-zo*i,zo*r+Uo*i),t.lineTo(Uo*s-zo*a,zo*s+Uo*a),t.lineTo(Uo*l-zo*c,zo*l+Uo*c),t.lineTo(Uo*r+zo*i,Uo*i-zo*r),t.lineTo(Uo*s+zo*a,Uo*a-zo*s),t.lineTo(Uo*l+zo*c,Uo*c-zo*l),t.closePath()}};function X9e(t,e){let n=null,r=E6(i);t=typeof t=="function"?t:Ar(t||M6),e=typeof e=="function"?e:Ar(e===void 0?64:+e);function i(){let s;if(n||(n=s=r()),t.apply(this,arguments).draw(n,+e.apply(this,arguments)),s)return n=null,
vendor: 14,034 bytes, line 806
806s+""||null}return i.type=function(s){return arguments.length?(t=typeof s=="function"?s:Ar(s),i):t},i.size=function(s){return arguments.length?(e=typeof s=="function"?s:Ar(+s),i):e},i.context=function(s){return arguments.length?(n=s??null,i):n},i}function Oh(){}function p2(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function fM(t){this._context=t}fM.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:p2(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:p2(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function hM(t){return new fM(t)}function Pce(t){this._context=t}Pce.prototype={areaStart:Oh,areaEnd:Oh,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:p2(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Oce(t){return new Pce(t)}function Rce(t){this._context=t}Rce.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:p2(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Ice(t){return new Rce(t)}function Dce(t,e){this._basis=new fM(t),this._beta=e}Dce.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,e=this._y,n=t.length-1;if(n>0)for(var r=t[0],i=e[0],s=t[n]-r,a=e[n]-i,l=-1,c;++l<=n;)c=l/n,this._basis.point(this._beta*t[l]+(1-this._beta)*(r+c*s),this._beta*e[l]+(1-this._beta)*(i+c*a));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};const Q9e=function t(e){function n(r){return e===1?new fM(r):new Dce(r,e)}return n.beta=function(r){return t(+r)},n}(.85);function m2(t,e,n){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-n),t._x2,t._y2)}function P6(t,e){this._context=t,this._k=(1-e)/6}P6.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:m2(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:m2(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const J9e=function t(e){function n(r){return new P6(r,e)}return n.tension=function(r){return t(+r)},n}(0);function O6(t,e){this._context=t,this._k=(1-e)/6}O6.prototype={areaStart:Oh,areaEnd:Oh,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:m2(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const Z9e=function t(e){function n(r){return new O6(r,e)}return n.tension=function(r){return t(+r)},n}(0);function R6(t,e){this._context=t,this._k=(1-e)/6}R6.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:m2(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const eVe=function t(e){function n(r){return new R6(r,e)}return n.tension=function(r){return t(+r)},n}(0);function I6(t,e,n){var r=t._x1,i=t._y1,s=t._x2,a=t._y2;if(t._l01_a>nG){var l=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,c=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*l-t._x0*t._l12_2a+t._x2*t._l01_2a)/c,i=(i*l-t._y0*t._l12_2a+t._y2*t._l01_2a)/c}if(t._l23_a>nG){var u=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,d=3*t._l23_a*(t._l23_a+t._l12_a);s=(s*u+t._x1*t._l23_2a-e*t._l12_2a)/d,a=(a*u+t._y1*t._l23_2a-n*t._l12_2a)/d}t._context.bezierCurveTo(r,i,s,a,t._x2,t._y2)}function Lce(t,e){this._context=t,this._alpha=e}Lce.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:I6(this,t,e);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const tVe=function t(e){function n(r){return e?new Lce(r,e):new P6(r,0)}return n.alpha=function(r){return t(+r)},n}(.5);function $ce(t,e){this._context=t,this._alpha=e}$ce.prototype={areaStart:Oh,areaEnd:Oh,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:I6(this,t,e);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const nVe=function t(e){function n(r){return e?new $ce(r,e):new O6(r,0)}return n.alpha=function(r){return t(+r)},n}(.5);function Fce(t,e){this._context=t,this._alpha=e}Fce.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:I6(this,t,e);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const rVe=function t(e){function n(r){return e?new Fce(r,e):new R6(r,0)}return n.alpha=function(r){return t(+r)},n}(.5);function Uce(t){this._context=t}Uce.prototype={areaStart:Oh,areaEnd:Oh,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function zce(t){return new Uce(t)}function rG(t){return t<0?-1:1}function iG(t,e,n){var r=t._x1-t._x0,i=e-t._x1,s=(t._y1-t._y0)/(r||i<0&&-0),a=(n-t._y1)/(i||r<0&&-0),l=(s*i+a*r)/(r+i);return(rG(s)+rG(a))*Math.min(Math.abs(s),Math.abs(a),.5*Math.abs(l))||0}function sG(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function WR(t,e,n){var r=t._x0,i=t._y0,s=t._x1,a=t._y1,l=(s-r)/3;t._context.bezierCurveTo(r+l,i+l*e,s-l,a-l*n,s,a)}function g2(t){this._context=t}g2.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:WR(this,this._t0,sG(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,WR(this,sG(this,n=iG(this,t,e)),n);break;default:WR(this,this._t0,n=iG(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function Bce(t){this._context=new Vce(t)}(Bce.prototype=Object.create(g2.prototype)).point=function(t,e){g2.prototype.point.call(this,e,t)};function Vce(t){this._context=t}Vce.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,r,i,s){this._context.bezierCurveTo(e,t,r,n,s,i)}};function Hce(t){return new g2(t)}function Wce(t){return new Bce(t)}function Gce(t){this._context=t}Gce.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),n===2)this._context.lineTo(t[1],e[1]);else for(var r=aG(t),i=aG(e),s=0,a=1;a<n;++s,++a)this._context.bezierCurveTo(r[0][s],i[0][s],r[1][s],i[1][s],t[a],e[a]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,e){this._x.push(+t),this._y.push(+e)}};function aG(t){var e,n=t.length-1,r,i=new Array(n),s=new Array(n),a=new Array(n);for(i[0]=0,s[0]=2,a[0]=t[0]+2*t[1],e=1;e<n-1;++e)i[e]=1,s[e]=4,a[e]=4*t[e]+2*t[e+1];for(i[n-1]=2,s[n-1]=7,a[n-1]=8*t[n-1]+t[n],e=1;e<n;++e)r=i[e]/s[e-1],s[e]-=r,a[e]-=r*a[e-1];for(i[n-1]=a[n-1]/s[n-1],e=n-2;e>=0;--e)i[e]=(a[e]-i[e+1])/s[e];for(s[n-1]=(t[n]+i[n-1])/2,e=0;e<n-1;++e)s[e]=2*t[e+1]-i[e+1];return[i,s]}function qce(t){return new Gce(t)}function pM(t,e){this._context=t,this._t=e}pM.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;
vendor: 9,160 bytes, lines 806-809
806default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}break}}this._x=t,this._y=e}};function Kce(t){return new pM(t,.5)}function Yce(t){return new pM(t,0)}function Xce(t){return new pM(t,1)}function pv(t,e){if((a=t.length)>1)for(var n=1,r,i,s=t[e[0]],a,l=s.length;n<a;++n)for(i=s,s=t[e[n]],r=0;r<l;++r)s[r][1]+=s[r][0]=isNaN(i[r][1])?i[r][0]:i[r][1]}function CL(t){for(var e=t.length,n=new Array(e);--e>=0;)n[e]=e;return n}function iVe(t,e){return t[e]}function sVe(t){const e=[];return e.key=t,e}function aVe(){var t=Ar([]),e=CL,n=pv,r=iVe;function i(s){var a=Array.from(t.apply(this,arguments),sVe),l,c=a.length,u=-1,d;for(const f of s)for(l=0,++u;l<c;++l)(a[l][u]=[0,+r(f,a[l].key,u,s)]).data=f;for(l=0,d=A6(e(a));l<c;++l)a[d[l]].index=l;return n(a,d),a}return i.keys=function(s){return arguments.length?(t=typeof s=="function"?s:Ar(Array.from(s)),i):t},i.value=function(s){return arguments.length?(r=typeof s=="function"?s:Ar(+s),i):r},i.order=function(s){return arguments.length?(e=s==null?CL:typeof s=="function"?s:Ar(Array.from(s)),i):e},i.offset=function(s){return arguments.length?(n=s??pv,i):n},i}function oVe(t,e){if((r=t.length)>0){for(var n,r,i=0,s=t[0].length,a;i<s;++i){for(a=n=0;n<r;++n)a+=t[n][i][1]||0;if(a)for(n=0;n<r;++n)t[n][i][1]/=a}pv(t,e)}}function lVe(t,e){if((i=t.length)>0){for(var n=0,r=t[e[0]],i,s=r.length;n<s;++n){for(var a=0,l=0;a<i;++a)l+=t[a][n][1]||0;r[n][1]+=r[n][0]=-l/2}pv(t,e)}}function cVe(t,e){if(!(!((a=t.length)>0)||!((s=(i=t[e[0]]).length)>0))){for(var n=0,r=1,i,s,a;r<s;++r){for(var l=0,c=0,u=0;l<a;++l){for(var d=t[e[l]],f=d[r][1]||0,h=d[r-1][1]||0,p=(f-h)/2,m=0;m<l;++m){var x=t[e[m]],y=x[r][1]||0,g=x[r-1][1]||0;p+=y-g}c+=f,u+=p*f}i[r-1][1]+=i[r-1][0]=n,c&&(n-=u/c)}i[r-1][1]+=i[r-1][0]=n,pv(t,e)}}function J1(t){"@babel/helpers - typeof";return J1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},J1(t)}var uVe=["type","size","sizeType"];function kL(){return kL=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},kL.apply(this,arguments)}function oG(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function lG(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?oG(Object(n),!0).forEach(function(r){dVe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):oG(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function dVe(t,e,n){return e=fVe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function fVe(t){var e=hVe(t,"string");return J1(e)=="symbol"?e:e+""}function hVe(t,e){if(J1(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(J1(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function pVe(t,e){if(t==null)return{};var n=mVe(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function mVe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var Qce={symbolCircle:M6,symbolCross:F9e,symbolDiamond:z9e,symbolSquare:B9e,symbolStar:G9e,symbolTriangle:q9e,symbolWye:Y9e},gVe=Math.PI/180,xVe=function(e){var n="symbol".concat(uM(e));return Qce[n]||M6},yVe=function(e,n,r){if(n==="area")return e;switch(r){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var i=18*gVe;return 1.25*e*e*(Math.tan(i)-Math.tan(i*2)*Math.pow(Math.tan(i),2))}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},vVe=function(e,n){Qce["symbol".concat(uM(e))]=n},D6=function(e){var n=e.type,r=n===void 0?"circle":n,i=e.size,s=i===void 0?64:i,a=e.sizeType,l=a===void 0?"area":a,c=pVe(e,uVe),u=lG(lG({},c),{},{type:r,size:s,sizeType:l}),d=function(){var y=xVe(r),g=X9e().type(y).size(yVe(s,l,r));return g()},f=u.className,h=u.cx,p=u.cy,m=Pt(u,!0);return h===+h&&p===+p&&s===+s?te.createElement("path",kL({},m,{className:an("recharts-symbols",f),transform:"translate(".concat(h,", ").concat(p,")"),d:d()})):null};D6.registerSymbol=vVe;function mv(t){"@babel/helpers - typeof";return mv=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},mv(t)}function EL(){return EL=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},EL.apply(this,arguments)}function cG(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function bVe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?cG(Object(n),!0).forEach(function(r){Z1(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):cG(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function wVe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _Ve(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Zce(r.key),r)}}function SVe(t,e,n){return e&&_Ve(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function NVe(t,e,n){return e=x2(e),jVe(t,Jce()?Reflect.construct(e,n||[],x2(t).constructor):e.apply(t,n))}function jVe(t,e){if(e&&(mv(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return CVe(t)}function CVe(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Jce(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Jce=function(){return!!t})()}function x2(t){return x2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},x2(t)}function kVe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&AL(t,e)}function AL(t,e){return AL=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},AL(t,e)}function Z1(t,e,n){return e=Zce(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Zce(t){var e=EVe(t,"string");return mv(e)=="symbol"?e:e+""}function EVe(t,e){if(mv(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(mv(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var Bo=32,L6=function(t){function e(){return wVe(this,e),NVe(this,e,arguments)}return kVe(e,t),SVe(e,[{key:"renderIcon",value:function(r){var i=this.props.inactiveColor,s=Bo/2,a=Bo/6,l=Bo/3,c=r.inactive?i:r.color;if(r.type==="plainline")return te.createElement("line",{strokeWidth:4,fill:"none",stroke:c,strokeDasharray:r.payload.strokeDasharray,x1:0,y1:s,x2:Bo,y2:s,className:"recharts-legend-icon"});if(r.type==="line")return te.createElement("path",{strokeWidth:4,fill:"none",stroke:c,d:"M0,".concat(s,"h").concat(l,`
807            A`).concat(a,",").concat(a,",0,1,1,").concat(2*l,",").concat(s,`
808            H`).concat(Bo,"M").concat(2*l,",").concat(s,`
809            A`).concat(a,",").concat(a,",0,1,1,").concat(l,",").concat(s),className:"recharts-legend-icon"});if(r.type==="rect")return te.createElement("path",{stroke:"none",fill:c,d:"M0,".concat(Bo/8,"h").concat(Bo,"v").concat(Bo*3/4,"h").concat(-Bo,"z"),className:"recharts-legend-icon"});if(te.isValidElement(r.legendIcon)){var u=bVe({},r);return delete u.legendIcon,te.cloneElement(r.legendIcon,u)}return te.createElement(D6,{fill:c,cx:s,cy:s,size:Bo,sizeType:"diameter",type:r.type})}},{key:"renderItems",value:function(){var r=this,i=this.props,s=i.payload,a=i.iconSize,l=i.layout,c=i.formatter,u=i.inactiveColor,d={x:0,y:0,width:Bo,height:Bo}
809,f={display:l==="horizontal"?"inline-block":"block",marginRight:10},h={display:"inline-block",verticalAlign:"middle",marginRight:4};return s.map(function(p,m){var x=p.formatter||c,y=an(Z1(Z1({"recharts-legend-item":!0},"legend-item-".concat(m),!0),"inactive",p.inactive));if(p.type==="none")return null;var g=Kt(p.value)?null:p.value;lc(!Kt(p.value),`The name property is also required when using a function for the dataKey of a chart's cartesian components. Ex: <Bar name="Name of my Data"/>`);var w=p.inactive?u:p.color;return te.createElement("li",EL({className:y,style:f,key:"legend-item-".concat(m)},Wm(r.props,p,m)),te.createElement(vL,{width:a,height:a,viewBox:d,style:h},r.renderIcon(p)),te.createElement("span",{className:"recharts-legend-item-text",style:{color:w}},x?x(g,p,m):g))})}},{key:"render",value:function(){var r=this.props,i=r.payload,s=r.layout,a=r.align;if(!i||!i.length)return null;var l={padding:0,margin:0,textAlign:s==="horizontal"?a:"left"};return te.createElement("ul",{className:"recharts-default-legend",style:l},this.renderItems())}}])}(b.PureComponent);Z1(L6,"displayName","Legend");Z1(L6,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var AVe=YT;function TVe(){this.__data__=new AVe,this.size=0}var MVe=TVe;function PVe(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}var OVe=PVe;function RVe(t){return this.__data__.get(t)}var IVe=RVe;function DVe(t){return this.__data__.has(t)}var LVe=DVe,$Ve=YT,FVe=w6,UVe=_6,zVe=200;function BVe(t,e){var n=this.__data__;if(n instanceof $Ve){var r=n.__data__;if(!FVe||r.length<zVe-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new UVe(r)}return n.set(t,e),this.size=n.size,this}var VVe=BVe,HVe=YT,WVe=MVe,GVe=OVe,qVe=IVe,KVe=LVe,YVe=VVe;function F0(t){var e=this.__data__=new HVe(t);this.size=e.size}F0.prototype.clear=WVe;F0.prototype.delete=GVe;F0.prototype.get=qVe;F0.prototype.has=KVe;F0.prototype.set=YVe;var $6=F0,XVe="__lodash_hash_undefined__";function QVe(t){return this.__data__.set(t,XVe),this}var JVe=QVe;function ZVe(t){return this.__data__.has(t)}var e7e=ZVe,t7e=_6,n7e=JVe,r7e=e7e;function y2(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new t7e;++e<n;)this.add(t[e])}y2.prototype.add=y2.prototype.push=n7e;y2.prototype.has=r7e;var F6=y2;function i7e(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}var eue=i7e;function s7e(t,e){return t.has(e)}var U6=s7e,a7e=F6,o7e=eue,l7e=U6,c7e=1,u7e=2;function d7e(t,e,n,r,i,s){var a=n&c7e,l=t.length,c=e.length;if(l!=c&&!(a&&c>l))return!1;var u=s.get(t),d=s.get(e);if(u&&d)return u==e&&d==t;var f=-1,h=!0,p=n&u7e?new a7e:void 0;for(s.set(t,e),s.set(e,t);++f<l;){var m=t[f],x=e[f];if(r)var y=a?r(x,m,f,e,t,s):r(m,x,f,t,e,s);if(y!==void 0){if(y)continue;h=!1;break}if(p){if(!o7e(e,function(g,w){if(!l7e(p,w)&&(m===g||i(m,g,n,r,s)))return p.push(w)})){h=!1;break}}else if(!(m===x||i(m,x,n,r,s))){h=!1;break}}return s.delete(t),s.delete(e),h}var tue=d7e,f7e=vc,h7e=f7e.Uint8Array,nue=h7e;function p7e(t){var e=-1,n=Array(t.size);return t.forEach(function(r,i){n[++e]=[i,r]}),n}var m7e=p7e;function g7e(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}var z6=g7e,uG=zS,dG=nue,x7e=BS,y7e=tue,v7e=m7e,b7e=z6,w7e=1,_7e=2,S7e="[object Boolean]",N7e="[object Date]",j7e="[object Error]",C7e="[object Map]",k7e="[object Number]",E7e="[object RegExp]",A7e="[object Set]",T7e="[object String]",M7e="[object Symbol]",P7e="[object ArrayBuffer]",O7e="[object DataView]",fG=uG?uG.prototype:void 0,GR=fG?fG.valueOf:void 0;function R7e(t,e,n,r,i,s,a){switch(n){case O7e:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case P7e:return!(t.byteLength!=e.byteLength||!s(new dG(t),new dG(e)));case S7e:case N7e:case k7e:return x7e(+t,+e);case j7e:return t.name==e.name&&t.message==e.message;case E7e:case T7e:return t==e+"";case C7e:var l=v7e;case A7e:var c=r&w7e;if(l||(l=b7e),t.size!=e.size&&!c)return!1;var u=a.get(t);if(u)return u==e;r|=_7e,a.set(t,e);var d=y7e(l(t),l(e),r,i,s,a);return a.delete(t),d;case M7e:if(GR)return GR.call(t)==GR.call(e)}return!1}var I7e=R7e;function D7e(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}var rue=D7e,L7e=rue,$7e=ja;function F7e(t,e,n){var r=e(t);return $7e(t)?r:L7e(r,n(t))}var U7e=F7e;function z7e(t,e){for(var n=-1,r=t==null?0:t.length,i=0,s=[];++n<r;){var a=t[n];e(a,n,t)&&(s[i++]=a)}return s}var B7e=z7e;function V7e(){return[]}var H7e=V7e,W7e=B7e,G7e=H7e,q7e=Object.prototype,K7e=q7e.propertyIsEnumerable,hG=Object.getOwnPropertySymbols,Y7e=hG?function(t){return t==null?[]:(t=Object(t),W7e(hG(t),function(e){return K7e.call(t,e)}))}:G7e,X7e=Y7e;function Q7e(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}var J7e=Q7e,Z7e=Bd,eHe=vu,tHe="[object Arguments]";function nHe(t){return eHe(t)&&Z7e(t)==tHe}var rHe=nHe,pG=rHe,iHe=vu,iue=Object.prototype,sHe=iue.hasOwnProperty,aHe=iue.propertyIsEnumerable,oHe=pG(function(){return arguments}())?pG:function(t){return iHe(t)&&sHe.call(t,"callee")&&!aHe.call(t,"callee")},mM=oHe,v2={exports:{}};function lHe(){return!1}var cHe=lHe;v2.exports;(function(t,e){var n=vc,r=cHe,i=e&&!e.nodeType&&e,s=i&&!0&&t&&!t.nodeType&&t,a=s&&s.exports===i,l=a?n.Buffer:void 0,c=l?l.isBuffer:void 0,u=c||r;t.exports=u})(v2,v2.exports);var B6=v2.exports,uHe=9007199254740991,dHe=/^(?:0|[1-9]\d*)$/;function fHe(t,e){var n=typeof t;return e=e??uHe,!!e&&(n=="number"||n!="symbol"&&dHe.test(t))&&t>-1&&t%1==0&&t<e}var gM=fHe,hHe=9007199254740991;function pHe(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=hHe}var V6=pHe,mHe=Bd,gHe=V6,xHe=vu,yHe="[object Arguments]",vHe="[object Array]",bHe="[object Boolean]",wHe="[object Date]",_He="[object Error]",SHe="[object Function]",NHe="[object Map]",jHe="[object Number]",CHe="[object Object]",kHe="[object RegExp]",EHe="[object Set]",AHe="[object String]",THe="[object WeakMap]",MHe="[object ArrayBuffer]",PHe="[object DataView]",OHe="[object Float32Array]",RHe="[object Float64Array
809]",IHe="[object Int8Array]",DHe="[object Int16Array]",LHe="[object Int32Array]",$He="[object Uint8Array]",FHe="[object Uint8ClampedArray]",UHe="[object Uint16Array]",zHe="[object Uint32Array]",Ur={};Ur[OHe]=Ur[RHe]=Ur[IHe]=Ur[DHe]=Ur[LHe]=Ur[$He]=Ur[FHe]=Ur[UHe]=Ur[zHe]=!0;Ur[yHe]=Ur[vHe]=Ur[MHe]=Ur[bHe]=Ur[PHe]=Ur[wHe]=Ur[_He]=Ur[SHe]=Ur[NHe]=Ur[jHe]=Ur[CHe]=Ur[kHe]=Ur[EHe]=Ur[AHe]=Ur[THe]=!1;function BHe(t){return xHe(t)&&gHe(t.length)&&!!Ur[mHe(t)]}var VHe=BHe;function HHe(t){return function(e){return t(e)}}var H6=HHe,b2={exports:{}};b2.exports;(function(t,e){var n=sce,r=e&&!e.nodeType&&e,i=r&&!0&&t&&!t.nodeType&&t,s=i&&i.exports===r,a=s&&n.process,l=function(){try{var c=i&&i.require&&i.require("util").types;return c||a&&a.binding&&a.binding("util")}catch{}}();t.exports=l})(b2,b2.exports);var sue=b2.exports,WHe=VHe,GHe=H6,mG=sue,gG=mG&&mG.isTypedArray,qHe=gG?GHe(gG):WHe,W6=qHe,KHe=J7e,YHe=mM,XHe=ja,QHe=B6,JHe=gM,ZHe=W6,eWe=Object.prototype,tWe=eWe.hasOwnProperty;function nWe(t,e){var n=XHe(t),r=!n&&YHe(t),i=!n&&!r&&QHe(t),s=!n&&!r&&!i&&ZHe(t),a=n||r||i||s,l=a?KHe(t.length,String):[],c=l.length;for(var u in t)(e||tWe.call(t,u))&&!(a&&(u=="length"||i&&(u=="offset"||u=="parent")||s&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||JHe(u,c)))&&l.push(u);return l}var aue=nWe,rWe=Object.prototype;function iWe(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||rWe;return t===n}var G6=iWe;function sWe(t,e){return function(n){return t(e(n))}}var oue=sWe,aWe=oue,oWe=aWe(Object.keys,Object),lWe=oWe,cWe=G6,uWe=lWe,dWe=Object.prototype,fWe=dWe.hasOwnProperty;function hWe(t){if(!cWe(t))return uWe(t);var e=[];for(var n in Object(t))fWe.call(t,n)&&n!="constructor"&&e.push(n);return e}var pWe=hWe,mWe=GT,gWe=V6;function xWe(t){return t!=null&&gWe(t.length)&&!mWe(t)}var Eg=xWe,yWe=aue,vWe=pWe,bWe=Eg;function wWe(t){return bWe(t)?yWe(t):vWe(t)}var xM=wWe,_We=U7e,SWe=X7e,NWe=xM;function jWe(t){return _We(t,NWe,SWe)}var CWe=jWe,xG=CWe,kWe=1,EWe=Object.prototype,AWe=EWe.hasOwnProperty;function TWe(t,e,n,r,i,s){var a=n&kWe,l=xG(t),c=l.length,u=xG(e),d=u.length;if(c!=d&&!a)return!1;for(var f=c;f--;){var h=l[f];if(!(a?h in e:AWe.call(e,h)))return!1}var p=s.get(t),m=s.get(e);if(p&&m)return p==e&&m==t;var x=!0;s.set(t,e),s.set(e,t);for(var y=a;++f<c;){h=l[f];var g=t[h],w=e[h];if(r)var v=a?r(w,g,h,e,t,s):r(g,w,h,t,e,s);if(!(v===void 0?g===w||i(g,w,n,r,s):v)){x=!1;break}y||(y=h=="constructor")}if(x&&!y){var N=t.constructor,S=e.constructor;N!=S&&"constructor"in t&&"constructor"in e&&!(typeof N=="function"&&N instanceof N&&typeof S=="function"&&S instanceof S)&&(x=!1)}return s.delete(t),s.delete(e),x}var MWe=TWe,PWe=jg,OWe=vc,RWe=PWe(OWe,"DataView"),IWe=RWe,DWe=jg,LWe=vc,$We=DWe(LWe,"Promise"),FWe=$We,UWe=jg,zWe=vc,BWe=UWe(zWe,"Set"),lue=BWe,VWe=jg,HWe=vc,WWe=VWe(HWe,"WeakMap"),GWe=WWe,TL=IWe,ML=w6,PL=FWe,OL=lue,RL=GWe,cue=Bd,U0=oce,yG="[object Map]",qWe="[object Object]",vG="[object Promise]",bG="[object Set]",wG="[object WeakMap]",_G="[object DataView]",KWe=U0(TL),YWe=U0(ML),XWe=U0(PL),QWe=U0(OL),JWe=U0(RL),Pp=cue;(TL&&Pp(new TL(new ArrayBuffer(1)))!=_G||ML&&Pp(new ML)!=yG||PL&&Pp(PL.resolve())!=vG||OL&&Pp(new OL)!=bG||RL&&Pp(new RL)!=wG)&&(Pp=function(t){var e=cue(t),n=e==qWe?t.constructor:void 0,r=n?U0(n):"";if(r)switch(r){case KWe:return _G;case YWe:return yG;case XWe:return vG;case QWe:return bG;case JWe:return wG}return e});var ZWe=Pp,qR=$6,eGe=tue,tGe=I7e,nGe=MWe,SG=ZWe,NG=ja,jG=B6,rGe=W6,iGe=1,CG="[object Arguments]",kG="[object Array]",oj="[object Object]",sGe=Object.prototype,EG=sGe.hasOwnProperty;function aGe(t,e,n,r,i,s){var a=NG(t),l=NG(e),c=a?kG:SG(t),u=l?kG:SG(e);c=c==CG?oj:c,u=u==CG?oj:u;var d=c==oj,f=u==oj,h=c==u;if(h&&jG(t)){if(!jG(e))return!1;a=!0,d=!1}if(h&&!d)return s||(s=new qR),a||rGe(t)?eGe(t,e,n,r,i,s):tGe(t,e,c,n,r,i,s);if(!(n&iGe)){var p=d&&EG.call(t,"__wrapped__"),m=f&&EG.call(e,"__wrapped__");
vendor: 4,126 bytes, line 809
809if(p||m){var x=p?t.value():t,y=m?e.value():e;return s||(s=new qR),i(x,y,n,r,s)}}return h?(s||(s=new qR),nGe(t,e,n,r,i,s)):!1}var oGe=aGe,lGe=oGe,AG=vu;function uue(t,e,n,r,i){return t===e?!0:t==null||e==null||!AG(t)&&!AG(e)?t!==t&&e!==e:lGe(t,e,n,r,uue,i)}var q6=uue,cGe=$6,uGe=q6,dGe=1,fGe=2;function hGe(t,e,n,r){var i=n.length,s=i,a=!r;if(t==null)return!s;for(t=Object(t);i--;){var l=n[i];if(a&&l[2]?l[1]!==t[l[0]]:!(l[0]in t))return!1}for(;++i<s;){l=n[i];var c=l[0],u=t[c],d=l[1];if(a&&l[2]){if(u===void 0&&!(c in t))return!1}else{var f=new cGe;if(r)var h=r(u,d,c,t,e,f);if(!(h===void 0?uGe(d,u,dGe|fGe,r,f):h))return!1}}return!0}var pGe=hGe,mGe=Lo;function gGe(t){return t===t&&!mGe(t)}var due=gGe,xGe=due,yGe=xM;function vGe(t){for(var e=yGe(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,xGe(i)]}return e}var bGe=vGe;function wGe(t,e){return function(n){return n==null?!1:n[t]===e&&(e!==void 0||t in Object(n))}}var fue=wGe,_Ge=pGe,SGe=bGe,NGe=fue;function jGe(t){var e=SGe(t);return e.length==1&&e[0][2]?NGe(e[0][0],e[0][1]):function(n){return n===t||_Ge(n,t,e)}}var CGe=jGe;function kGe(t,e){return t!=null&&e in Object(t)}var EGe=kGe,AGe=JT,TGe=mM,MGe=ja,PGe=gM,OGe=V6,RGe=VS;function IGe(t,e,n){e=AGe(e,t);for(var r=-1,i=e.length,s=!1;++r<i;){var a=RGe(e[r]);if(!(s=t!=null&&n(t,a)))break;t=t[a]}return s||++r!=i?s:(i=t==null?0:t.length,!!i&&OGe(i)&&PGe(a,i)&&(MGe(t)||TGe(t)))}var DGe=IGe,LGe=EGe,$Ge=DGe;function FGe(t,e){return t!=null&&$Ge(t,e,LGe)}var hue=FGe,UGe=q6,zGe=fce,BGe=hue,VGe=b6,HGe=due,WGe=fue,GGe=VS,qGe=1,KGe=2;function YGe(t,e){return VGe(t)&&HGe(e)?WGe(GGe(t),e):function(n){var r=zGe(n,t);return r===void 0&&r===e?BGe(n,t):UGe(e,r,qGe|KGe)}}var XGe=YGe;function QGe(t){return t}var z0=QGe;function JGe(t){return function(e){return e==null?void 0:e[t]}}var ZGe=JGe,eqe=ZT;function tqe(t){return function(e){return eqe(e,t)}}var nqe=tqe,rqe=ZGe,iqe=nqe,sqe=b6,aqe=VS;function oqe(t){return sqe(t)?rqe(aqe(t)):iqe(t)}var lqe=oqe,cqe=CGe,uqe=XGe,dqe=z0,fqe=ja,hqe=lqe;function pqe(t){return typeof t=="function"?t:t==null?dqe:typeof t=="object"?fqe(t)?uqe(t[0],t[1]):cqe(t):hqe(t)}var bu=pqe;function mqe(t,e,n,r){for(var i=t.length,s=n+(r?1:-1);r?s--:++s<i;)if(e(t[s],s,t))return s;return-1}var pue=mqe;function gqe(t){return t!==t}var xqe=gqe;function yqe(t,e,n){for(var r=n-1,i=t.length;++r<i;)if(t[r]===e)return r;return-1}var vqe=yqe,bqe=pue,wqe=xqe,_qe=vqe;function Sqe(t,e,n){return e===e?_qe(t,e,n):bqe(t,wqe,n)}var Nqe=Sqe,jqe=Nqe;function Cqe(t,e){var n=t==null?0:t.length;return!!n&&jqe(t,e,0)>-1}var mue=Cqe;function kqe(t,e,n){for(var r=-1,i=t==null?0:t.length;++r<i;)if(n(e,t[r]))return!0;return!1}var gue=kqe;function Eqe(){}var Aqe=Eqe,KR=lue,Tqe=Aqe,Mqe=z6,Pqe=1/0,Oqe=KR&&1/Mqe(new KR([,-0]))[1]==Pqe?function(t){return new KR(t)}:Tqe,Rqe=Oqe,Iqe=F6,Dqe=mue,Lqe=gue,$qe=U6,Fqe=Rqe,Uqe=z6,zqe=200;function Bqe(t,e,n){var r=-1,i=Dqe,s=t.length,a=!0,l=[],c=l;if(n)a=!1,i=Lqe;else if(s>=zqe){var u=e?null:Fqe(t);if(u)return Uqe(u);a=!1,i=$qe,c=new Iqe}else c=e?[]:l;e:for(;++r<s;){var d=t[r],f=e?e(d):d;if(d=n||d!==0?d:0,a&&f===f){for(var h=c.length;h--;)if(c[h]===f)continue e;e&&c.push(f),l.push(d)}else i(c,f,n)||(c!==l&&c.push(f),l.push(d))}return l}var Vqe=Bqe,Hqe=bu,Wqe=Vqe;function Gqe(t,e){return t&&t.length?Wqe(t,Hqe(e)):[]}var qqe=Gqe;const TG=An(qqe);function xue(t,e,n){return e===!0?TG(t,n):Kt(e)?TG(t,e):t}function gv(t){"@babel/helpers - typeof";return gv=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},gv(t)}var Kqe=["ref"];function MG(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Nu(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?MG(Object(n),!0).forEach(function(r){yM(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):MG(Object(n)).forEac
vendor: 4,260 bytes, line 809
809h(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Yqe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function PG(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,vue(r.key),r)}}function Xqe(t,e,n){return e&&PG(t.prototype,e),n&&PG(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Qqe(t,e,n){return e=w2(e),Jqe(t,yue()?Reflect.construct(e,n||[],w2(t).constructor):e.apply(t,n))}function Jqe(t,e){if(e&&(gv(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Zqe(t)}function Zqe(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function yue(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(yue=function(){return!!t})()}function w2(t){return w2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},w2(t)}function eKe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&IL(t,e)}function IL(t,e){return IL=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},IL(t,e)}function yM(t,e,n){return e=vue(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function vue(t){var e=tKe(t,"string");return gv(e)=="symbol"?e:e+""}function tKe(t,e){if(gv(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(gv(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function nKe(t,e){if(t==null)return{};var n=rKe(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function rKe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function iKe(t){return t.value}function sKe(t,e){if(te.isValidElement(t))return te.cloneElement(t,e);if(typeof t=="function")return te.createElement(t,e);e.ref;var n=nKe(e,Kqe);return te.createElement(L6,n)}var OG=1,cd=function(t){function e(){var n;Yqe(this,e);for(var r=arguments.length,i=new Array(r),s=0;s<r;s++)i[s]=arguments[s];return n=Qqe(this,e,[].concat(i)),yM(n,"lastBoundingBox",{width:-1,height:-1}),n}return eKe(e,t),Xqe(e,[{key:"componentDidMount",value:function(){this.updateBBox()}},{key:"componentDidUpdate",value:function(){this.updateBBox()}},{key:"getBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var r=this.wrapperNode.getBoundingClientRect();return r.height=this.wrapperNode.offsetHeight,r.width=this.wrapperNode.offsetWidth,r}return null}},{key:"updateBBox",value:function(){var r=this.props.onBBoxUpdate,i=this.getBBox();i?(Math.abs(i.width-this.lastBoundingBox.width)>OG||Math.abs(i.height-this.lastBoundingBox.height)>OG)&&(this.lastBoundingBox.width=i.width,this.lastBoundingBox.height=i.height,r&&r(i)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,r&&r(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?Nu({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(r){var i=this.props,s=i.layout,a=i.align,l=i.verticalAlign,c=i.margin,u=i.chartWidth,d=i.chartHeight,f,h;if(!r||(r.left===void 0||r.left===null)&&(r.right===void 0||r.right===null))if(a==="center"&&s==="vertical"){var p=this.getBBoxSnapshot();f={left:((u||0)-p.width)/2}}else f=a==="right"?{right:c&&c.right||0}:{left:c&&c.left||0};if(!r||(r.top===void 0||r.top===null)&&(r.bottom===void 0||r.bottom===null))if(l==="middle"){var m=this.getBBoxSnapsh
809ot();h={top:((d||0)-m.height)/2}}else h=l==="bottom"?{bottom:c&&c.bottom||0}:{top:c&&c.top||0};return Nu(Nu({},f),h)}},{key:"render",value:function(){var r=this,i=this.props,s=i.content,a=i.width,l=i.height,c=i.wrapperStyle,u=i.payloadUniqBy,d=i.payload,f=Nu(Nu({position:"absolute",width:a||"auto",height:l||"auto"},this.getDefaultPosition(c)),c);return te.createElement("div",{className:"recharts-legend-wrapper",style:f,ref:function(p){r.wrapperNode=p}},sKe(s,Nu(Nu({},this.props),{},{payload:xue(d,u,iKe)})))}}],[{key:"getWithHeight",value:function(r,i){var s=Nu(Nu({},this.defaultProps),r.props),a=s.layout;return a==="vertical"&&Qe(r.props.height)?{height:r.props.height}:a==="horizontal"?{width:r.props.width||i}:null}}])}(b.PureComponent);yM(cd,"displayName","Legend");yM(cd,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var RG=zS,aKe=mM,oKe=ja,IG=RG?RG.isConcatSpreadable:void 0;function lKe(t){return oKe(t)||aKe(t)||!!(IG&&t&&t[IG])}var cKe=lKe,uKe=rue,dKe=cKe;function bue(t,e,n,r,i){var s=-1,a=t.length;for(n||(n=dKe),i||(i=[]);++s<a;){var l=t[s];e>0&&n(l)?e>1?bue(l,e-1,n,r,i):uKe(i,l):r||(i[i.length]=l)}return i}var K6=bue;function fKe(t){return function(e,n,r){for(var i=-1,s=Object(e),a=r(e),l=a.length;l--;){var c=a[t?l:++i];if(n(s[c],c,s)===!1)break}return e}}var hKe=fKe,pKe=hKe,mKe=pKe(),wue=mKe,gKe=wue,xKe=xM;function yKe(t,e){return t&&gKe(t,e,xKe)}var _ue=yKe,vKe=Eg;function bKe(t,e){return function(n,r){if(n==null)return n;if(!vKe(n))return t(n,r);for(var i=n.length,s=e?i:-1,a=Object(n);(e?s--:++s<i)&&r(a[s],s,a)!==!1;);return n}}var wKe=bKe,_Ke=_ue,SKe=wKe,NKe=SKe(_Ke),Y6=NKe,jKe=Y6,CKe=Eg;function kKe(t,e){var n=-1,r=CKe(t)?Array(t.length):[];return jKe(t,function(i,s,a){r[++n]=e(i,s,a)}),r}var Sue=kKe;function EKe(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}var AKe=EKe,DG=O0;function TKe(t,e){if(t!==e){var n=t!==void 0,r=t===null,i=t===t,s=DG(t),a=e!==void 0,l=e===null,c=e===e,u=DG(e);if(!l&&!u&&!s&&t>e||s&&a&&c&&!l&&!u||r&&a&&c||!n&&c||!i)return 1;if(!r&&!s&&!u&&t<e||u&&n&&i&&!r&&!s||l&&n&&i||!a&&i||!c)return-1}return 0}var MKe=TKe,PKe=MKe;function OKe(t,e,n){for(var r=-1,i=t.criteria,s=e.criteria,a=i.length,l=n.length;++r<a;){var c=PKe(i[r],s[r]);if(c){if(r>=l)return c;var u=n[r];return c*(u=="desc"?-1:1)}}return t.index-e.index}var RKe=OKe,YR=QT,IKe=ZT,DKe=bu,LKe=Sue,$Ke=AKe,FKe=H6,UKe=RKe,zKe=z0,BKe=ja;function VKe(t,e,n){e.length?e=YR(e,function(s){return BKe(s)?function(a){return IKe(a,s.length===1?s[0]:s)}:s}):e=[zKe];var r=-1;e=YR(e,FKe(DKe));var i=LKe(t,function(s,a,l){var c=YR(e,function(u){return u(s)});return{criteria:c,index:++r,value:s}});return $Ke(i,function(s,a){return UKe(s,a,n)})}var HKe=VKe;function WKe(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}var GKe=WKe,qKe=GKe,LG=Math.max;function KKe(t,e,n){return e=LG(e===void 0?t.length-1:e,0),function(){for(var r=arguments,i=-1,s=LG(r.length-e,0),a=Array(s);++i<s;)a[i]=r[e+i];i=-1;for(var l=Array(e+1);++i<e;)l[i]=r[i];return l[e]=n(a),qKe(t,this,l)}}var Nue=KKe;function YKe(t){return function(){return t}}var XKe=YKe,QKe=jg,JKe=function(){try{var t=QKe(Object,"defineProperty");return t({},"",{}),t}catch{}}(),jue=JKe,ZKe=XKe,$G=jue,eYe=z0,tYe=$G?function(t,e){return $G(t,"toString",{configurable:!0,enumerable:!1,value:ZKe(e),writable:!0})}:eYe,nYe=tYe,rYe=800,iYe=16,sYe=Date.now;function aYe(t){var e=0,n=0;return function(){var r=sYe(),i=iYe-(r-n);if(n=r,i>0){if(++e>=rYe)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var oYe=aYe,lYe=nYe,cYe=oYe,uYe=cYe(lYe),Cue=uYe,dYe=z0,fYe=Nue,hYe=Cue;function pYe(t,e){return hYe(fYe(t,e,dYe),t+"")}var X6=pYe,mYe=BS,gYe=Eg,xYe=gM,yYe=Lo;function vYe(t,e,n){if(!yYe(n))return!1;var r=typeof e;return(r=="number"?gYe(n)&&xYe(e,n.length):r=="string"&&e in n)?mYe(n[e],t):!1}var HS=vYe,bYe=K6,wYe=HKe,_Ye=X6,FG=HS,SYe=_Ye(function(t,e){if(t==null)return[];var n=e.length;return n>1&&FG(t,e[0],e[1])?e=[]:n>2&&FG(e[0],e[1],e[2])&&(e=[e[0]]),wYe(t,bYe(e,1),[])}),NYe=SYe;const Q6=An(NYe);function e_(t){"@babel/helpers - typeof";return e_=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},e_(t)}
vendor: 29,621 bytes, lines 809-816
809function DL(){return DL=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},DL.apply(this,arguments)}function jYe(t,e){return AYe(t)||EYe(t,e)||kYe(t,e)||CYe()}function CYe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
810In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function kYe(t,e){if(t){if(typeof t=="string")return UG(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return UG(t,e)}}function UG(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function EYe(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,a,l=[],c=!0,u=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(c=(r=s.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,i=d}finally{try{if(!c&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return l}}function AYe(t){if(Array.isArray(t))return t}function zG(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function XR(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?zG(Object(n),!0).forEach(function(r){TYe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):zG(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function TYe(t,e,n){return e=MYe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function MYe(t){var e=PYe(t,"string");return e_(e)=="symbol"?e:e+""}function PYe(t,e){if(e_(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(e_(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function OYe(t){return Array.isArray(t)&&Xi(t[0])&&Xi(t[1])?t.join(" ~ "):t}var RYe=function(e){var n=e.separator,r=n===void 0?" : ":n,i=e.contentStyle,s=i===void 0?{}:i,a=e.itemStyle,l=a===void 0?{}:a,c=e.labelStyle,u=c===void 0?{}:c,d=e.payload,f=e.formatter,h=e.itemSorter,p=e.wrapperClassName,m=e.labelClassName,x=e.label,y=e.labelFormatter,g=e.accessibilityLayer,w=g===void 0?!1:g,v=function(){if(d&&d.length){var I={padding:0,margin:0},R=(h?Q6(d,h):d).map(function(E,P){if(E.type==="none")return null;var O=XR({display:"block",paddingTop:4,paddingBottom:4,color:E.color||"#000"},l),L=E.formatter||f||OYe,T=E.value,D=E.name,F=T,q=D;if(L&&F!=null&&q!=null){var B=L(T,D,E,P,d);if(Array.isArray(B)){var z=jYe(B,2);F=z[0],q=z[1]}else F=B}return te.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(P),style:O},Xi(q)?te.createElement("span",{className:"recharts-tooltip-item-name"},q):null,Xi(q)?te.createElement("span",{className:"recharts-tooltip-item-separator"},r):null,te.createElement("span",{className:"recharts-tooltip-item-value"},F),te.createElement("span",{className:"recharts-tooltip-item-unit"},E.unit||""))});return te.createElement("ul",{className:"recharts-tooltip-item-list",style:I},R)}return null},N=XR({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},s),S=XR({margin:0},u),_=!nn(x),j=_?x:"",A=an("recharts-default-tooltip",p),C=an("recharts-tooltip-label",m);_&&y&&d!==void 0&&d!==null&&(j=y(x,d));var k=w?{role:"status","aria-live":"assertive"}:{};return te.createElement("div",DL({className:A,style:N},k),te.createElement("p",{className:C,style:S},te.isValidElement(j)?j:"".concat(j)),v())};function t_(t){"@babel/helpers - typeof";return t_=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},t_(t)}function lj(t,e,n){return e=IYe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function IYe(t){var e=DYe(t,"string");return t_(e)=="symbol"?e:e+""}function DYe(t,e){if(t_(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(t_(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var bb="recharts-tooltip-wrapper",LYe={visibility:"hidden"};function $Ye(t){var e=t.coordinate,n=t.translateX,r=t.translateY;return an(bb,lj(lj(lj(lj({},"".concat(bb,"-right"),Qe(n)&&e&&Qe(e.x)&&n>=e.x),"".concat(bb,"-left"),Qe(n)&&e&&Qe(e.x)&&n<e.x),"".concat(bb,"-bottom"),Qe(r)&&e&&Qe(e.y)&&r>=e.y),"".concat(bb,"-top"),Qe(r)&&e&&Qe(e.y)&&r<e.y))}function BG(t){var e=t.allowEscapeViewBox,n=t.coordinate,r=t.key,i=t.offsetTopLeft,s=t.position,a=t.reverseDirection,l=t.tooltipDimension,c=t.viewBox,u=t.viewBoxDimension;if(s&&Qe(s[r]))return s[r];var d=n[r]-l-i,f=n[r]+i;if(e[r])return a[r]?d:f;if(a[r]){var h=d,p=c[r];return h<p?Math.max(f,c[r]):Math.max(d,c[r])}var m=f+l,x=c[r]+u;return m>x?Math.max(d,c[r]):Math.max(f,c[r])}function FYe(t){var e=t.translateX,n=t.translateY,r=t.useTranslate3d;return{transform:r?"translate3d(".concat(e,"px, ").concat(n,"px, 0)"):"translate(".concat(e,"px, ").concat(n,"px)")}}function UYe(t){var e=t.allowEscapeViewBox,n=t.coordinate,r=t.offsetTopLeft,i=t.position,s=t.reverseDirection,a=t.tooltipBox,l=t.useTranslate3d,c=t.viewBox,u,d,f;return a.height>0&&a.width>0&&n?(d=BG({allowEscapeViewBox:e,coordinate:n,key:"x",offsetTopLeft:r,position:i,reverseDirection:s,tooltipDimension:a.width,viewBox:c,viewBoxDimension:c.width}),f=BG({allowEscapeViewBox:e,coordinate:n,key:"y",offsetTopLeft:r,position:i,reverseDirection:s,tooltipDimension:a.height,viewBox:c,viewBoxDimension:c.height}),u=FYe({translateX:d,translateY:f,useTranslate3d:l})):u=LYe,{cssProperties:u,cssClasses:$Ye({translateX:d,translateY:f,coordinate:n})}}function xv(t){"@babel/helpers - typeof";return xv=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},xv(t)}function VG(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function HG(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?VG(Object(n),!0).forEach(function(r){$L(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):VG(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function zYe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function BYe(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Eue(r.key),r)}}function VYe(t,e,n){return e&&BYe(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function HYe(t,e,n){return e=_2(e),WYe(t,kue()?Reflect.construct(e,n||[],_2(t).constructor):e.apply(t,n))}function WYe(t,e){if(e&&(xv(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return GYe(t)}function GYe(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function kue(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(kue=function(){return!!t})()}function _2(t){return _2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},_2(t)}function qYe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&LL(t,e)}function LL(t,e){return LL=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},LL(t,e)}function $L(t,e,n){return e=Eue(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Eue(t){var e=KYe(t,"string");return xv(e)=="symbol"?e:e+""}function KYe(t,e){if(xv(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(xv(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var WG=1,YYe=function(t){function e(){var n;zYe(this,e);for(var r=arguments.length,i=new Array(r),s=0;s<r;s++)i[s]=arguments[s];return n=HYe(this,e,[].concat(i)),$L(n,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0},lastBoundingBox:{width:-1,height:-1}}),$L(n,"handleKeyDown",function(a){if(a.key==="Escape"){var l,c,u,d;n.setState({dismissed:!0,dismissedAtCoordinate:{x:(l=(c=n.props.coordinate)===null||c===void 0?void 0:c.x)!==null&&l!==void 0?l:0,y:(u=(d=n.props.coordinate)===null||d===void 0?void 0:d.y)!==null&&u!==void 0?u:0}})}}),n}return qYe(e,t),VYe(e,[{key:"updateBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var r=this.wrapperNode.getBoundingClientRect();(Math.abs(r.width-this.state.lastBoundingBox.width)>WG||Math.abs(r.height-this.state.lastBoundingBox.height)>WG)&&this.setState({lastBoundingBox:{width:r.width,height:r.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var r,i;this.props.active&&this.updateBBox(),this.state.dismissed&&(((r=this.props.coordinate)===null||r===void 0?void 0:r.x)!==this.state.dismissedAtCoordinate.x||((i=this.props.coordinate)===null||i===void 0?void 0:i.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var r=this,i=this.props,s=i.active,a=i.allowEscapeViewBox,l=i.animationDuration,c=i.animationEasing,u=i.children,d=i.coordinate,f=i.hasPayload,h=i.isAnimationActive,p=i.offset,m=i.position,x=i.reverseDirection,y=i.useTranslate3d,g=i.viewBox,w=i.wrapperStyle,v=UYe({allowEscapeViewBox:a,coordinate:d,offsetTopLeft:p,position:m,reverseDirection:x,tooltipBox:this.state.lastBoundingBox,useTranslate3d:y,viewBox:g}),N=v.cssClasses,S=v.cssProperties,_=HG(HG({transition:h&&s?"transform ".concat(l,"ms ").concat(c):void 0},S),{},{pointerEvents:"none",visibility:!this.state.dismissed&&s&&f?"visible":"hidden",position:"absolute",top:0,left:0},w);return te.createElement("div",{tabIndex:-1,className:N,style:_,ref:function(A){r.wrapperNode=A}},u)}}])}(b.PureComponent),XYe=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},Zh={isSsr:XYe()};function yv(t){"@babel/helpers - typeof";return yv=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},yv(t)}function GG(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function qG(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?GG(Object(n),!0).forEach(function(r){J6(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):GG(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function QYe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function JYe(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Tue(r.key),r)}}function ZYe(t,e,n){return e&&JYe(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function eXe(t,e,n){return e=S2(e),tXe(t,Aue()?Reflect.construct(e,n||[],S2(t).constructor):e.apply(t,n))}function tXe(t,e){if(e&&(yv(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return nXe(t)}function nXe(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Aue(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Aue=function(){return!!t})()}function S2(t){return S2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},S2(t)}function rXe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&FL(t,e)}function FL(t,e){return FL=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},FL(t,e)}function J6(t,e,n){return e=Tue(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Tue(t){var e=iXe(t,"string");return yv(e)=="symbol"?e:e+""}function iXe(t,e){if(yv(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(yv(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function sXe(t){return t.dataKey}function aXe(t,e){return te.isValidElement(t)?te.cloneElement(t,e):typeof t=="function"?te.createElement(t,e):te.createElement(RYe,e)}var Bn=function(t){function e(){return QYe(this,e),eXe(this,e,arguments)}return rXe(e,t),ZYe(e,[{key:"render",value:function(){var r=this,i=this.props,s=i.active,a=i.allowEscapeViewBox,l=i.animationDuration,c=i.animationEasing,u=i.content,d=i.coordinate,f=i.filterNull,h=i.isAnimationActive,p=i.offset,m=i.payload,x=i.payloadUniqBy,y=i.position,g=i.reverseDirection,w=i.useTranslate3d,v=i.viewBox,N=i.wrapperStyle,S=m??[];f&&S.length&&(S=xue(m.filter(function(j){return j.value!=null&&(j.hide!==!0||r.props.includeHidden)}),x,sXe));var _=S.length>0;return te.createElement(YYe,{allowEscapeViewBox:a,animationDuration:l,animationEasing:c,isAnimationActive:h,active:s,coordinate:d,hasPayload:_,offset:p,position:y,reverseDirection:g,useTranslate3d:w,viewBox:v,wrapperStyle:N},aXe(u,qG(qG({},this.props),{},{payload:S})))}}])}(b.PureComponent);J6(Bn,"displayName","Tooltip");J6(Bn,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!Zh.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var oXe=vc,lXe=function(){return oXe.Date.now()},cXe=lXe,uXe=/\s/;function dXe(t){for(var e=t.length;e--&&uXe.test(t.charAt(e)););return e}var fXe=dXe,hXe=fXe,pXe=/^\s+/;function mXe(t){return t&&t.slice(0,hXe(t)+1).replace(pXe,"")}var gXe=mXe,xXe=gXe,KG=Lo,yXe=O0,YG=NaN,vXe=/^[-+]0x[0-9a-f]+$/i,bXe=/^0b[01]+$/i,wXe=/^0o[0-7]+$/i,_Xe=parseInt;function SXe(t){if(typeof t=="number")return t;if(yXe(t))return YG;if(KG(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=KG(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=xXe(t);var n=bXe.test(t);return n||wXe.test(t)?_Xe(t.slice(2),n?2:8):vXe.test(t)?YG:+t}var Mue=SXe,NXe=Lo,QR=cXe,XG=Mue,jXe="Expected a function",CXe=Math.max,kXe=Math.min;function EXe(t,e,n){var r,i,s,a,l,c,u=0,d=!1,f=!1,h=!0;if(typeof t!="function")throw new TypeError(jXe);e=XG(e)||0,NXe(n)&&(d=!!n.leading,f="maxWait"in n,s=f?CXe(XG(n.maxWait)||0,e):s,h="trailing"in n?!!n.trailing:h);function p(_){var j=r,A=i;return r=i=void 0,u=_,a=t.apply(A,j),a}function m(_){return u=_,l=setTimeout(g,e),d?p(_):a}function x(_){var j=_-c,A=_-u,C=e-j;return f?kXe(C,s-A):C}function y(_){var j=_-c,A=_-u;return c===void 0||j>=e||j<0||f&&A>=s}function g(){var _=QR();if(y(_))return w(_);l=setTimeout(g,x(_))}function w(_){return l=void 0,h&&r?p(_):(r=i=void 0,a)}function v(){l!==void 0&&clearTimeout(l),u=0,r=c=i=l=void 0}function N(){return l===void 0?a:w(QR())}function S(){var _=QR(),j=y(_);if(r=arguments,i=this,c=_,j){if(l===void 0)return m(c);if(f)return clearTimeout(l),l=setTimeout(g,e),p(c)}return l===void 0&&(l=setTimeout(g,e)),a}return S.cancel=v,S.flush=N,S}var AXe=EXe,TXe=AXe,MXe=Lo,PXe="Expected a function";function OXe(t,e,n){var r=!0,i=!0;if(typeof t!="function")throw new TypeError(PXe);return MXe(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),TXe(t,e,{leading:r,maxWait:e,trailing:i})}var RXe=OXe;const Pue=An(RXe);function n_(t){"@babel/helpers - typeof";return n_=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},n_(t)}function QG(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function cj(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?QG(Object(n),!0).forEach(function(r){IXe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):QG(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function IXe(t,e,n){return e=DXe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function DXe(t){var e=LXe(t,"string");return n_(e)=="symbol"?e:e+""}function LXe(t,e){if(n_(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(n_(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function $Xe(t,e){return BXe(t)||zXe(t,e)||UXe(t,e)||FXe()}function FXe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
811In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function UXe(t,e){if(t){if(typeof t=="string")return JG(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return JG(t,e)}}function JG(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function zXe(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,a,l=[],c=!0,u=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(c=(r=s.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,i=d}finally{try{if(!c&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return l}}function BXe(t){if(Array.isArray(t))return t}var Qi=b.forwardRef(function(t,e){var n=t.aspect,r=t.initialDimension,i=r===void 0?{width:-1,height:-1}:r,s=t.width,a=s===void 0?"100%":s,l=t.height,c=l===void 0?"100%":l,u=t.minWidth,d=u===void 0?0:u,f=t.minHeight,h=t.maxHeight,p=t.children,m=t.debounce,x=m===void 0?0:m,y=t.id,g=t.className,w=t.onResize,v=t.style,N=v===void 0?{}:v,S=b.useRef(null),_=b.useRef();_.current=w,b.useImperativeHandle(e,function(){return Object.defineProperty(S.current,"current",{get:function(){return console.warn("The usage of ref.current.current is deprecated and will no longer be supported."),S.current},configurable:!0})});var j=b.useState({containerWidth:i.width,containerHeight:i.height}),A=$Xe(j,2),C=A[0],k=A[1],M=b.useCallback(function(R,E){k(function(P){var O=Math.round(R),L=Math.round(E);return P.containerWidth===O&&P.containerHeight===L?P:{containerWidth:O,containerHeight:L}})},[]);b.useEffect(function(){var R=function(D){var F,q=D[0].contentRect,B=q.width,z=q.height;M(B,z),(F=_.current)===null||F===void 0||F.call(_,B,z)};x>0&&(R=Pue(R,x,{trailing:!0,leading:!1}));var E=new ResizeObserver(R),P=S.current.getBoundingClientRect(),O=P.width,L=P.height;return M(O,L),E.observe(S.current),function(){E.disconnect()}},[M,x]);var I=b.useMemo(function(){var R=C.containerWidth,E=C.containerHeight;if(R<0||E<0)return null;lc(Xp(a)||Xp(c),`The width(%s) and height(%s) are both fixed numbers,
812       maybe you don't need to use a ResponsiveContainer.`,a,c),lc(!n||n>0,"The aspect(%s) must be greater than zero.",n);var P=Xp(a)?R:a,O=Xp(c)?E:c;n&&n>0&&(P?O=P/n:O&&(P=O*n),h&&O>h&&(O=h)),lc(P>0||O>0,`The width(%s) and height(%s) of chart should be greater than 0,
813       please check the style of container, or the props width(%s) and height(%s),
814       or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the
815       height and width.`,P,O,a,c,d,f,n);var L=!Array.isArray(p)&&ld(p.type).endsWith("Chart");return te.Children.map(p,function(T){return te.isValidElement(T)?b.cloneElement(T,cj({width:P,height:O},L?{style:cj({height:"100%",width:"100%",maxHeight:O,maxWidth:P},T.props.style)}:{})):T})},[n,p,c,h,f,d,C,a]);return te.createElement("div",{id:y?"".concat(y):void 0,className:an("recharts-responsive-container",g),style:cj(cj({},N),{},{width:a,height:c,minWidth:d,minHeight:f,maxHeight:h}),ref:S},I)}),B0=function(e){return null};B0.displayName="Cell";function r_(t){"@babel/helpers - typeof";return r_=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},r_(t)}function ZG(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function UL(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ZG(Object(n),!0).forEach(function(r){VXe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ZG(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function VXe(t,e,n){return e=HXe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function HXe(t){var e=WXe(t,"string");return r_(e)=="symbol"?e:e+""}function WXe(t,e){if(r_(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(r_(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var rx={widthCache:{},cacheCount:0},GXe=2e3,qXe={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},eq="recharts_measurement_span";function KXe(t){var e=UL({},t);return Object.keys(e).forEach(function(n){e[n]||delete e[n]}),e}var zw=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||Zh.isSsr)return{width:0,height:0};var r=KXe(n),i=JSON.stringify({text:e,copyStyle:r});if(rx.widthCache[i])return rx.widthCache[i];try{var s=document.getElementById(eq);s||(s=document.createElement("span"),s.setAttribute("id",eq),s.setAttribute("aria-hidden","true"),document.body.appendChild(s));var a=UL(UL({},qXe),r);Object.assign(s.style,a),s.textContent="".concat(e);var l=s.getBoundingClientRect(),c={width:l.width,height:l.height};return rx.widthCache[i]=c,++rx.cacheCount>GXe&&(rx.cacheCount=0,rx.widthCache={}),c}catch{return{width:0,height:0}}},YXe=function(e){return{top:e.top+window.scrollY-document.documentElement.clientTop,left:e.left+window.scrollX-document.documentElement.clientLeft}};function i_(t){"@babel/helpers - typeof";return i_=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},i_(t)}function N2(t,e){return ZXe(t)||JXe(t,e)||QXe(t,e)||XXe()}function XXe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
816In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function QXe(t,e){if(t){if(typeof t=="string")return tq(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return tq(t,e)}}function tq(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function JXe(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,a,l=[],c=!0,u=!1;try{if(s=(n=n.call(t)).next,e===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=s.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,i=d}finally{try{if(!c&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return l}}function ZXe(t){if(Array.isArray(t))return t}function eQe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function nq(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,nQe(r.key),r)}}function tQe(t,e,n){return e&&nq(t.prototype,e),n&&nq(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function nQe(t){var e=rQe(t,"string");return i_(e)=="symbol"?e:e+""}function rQe(t,e){if(i_(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(i_(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var rq=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,iq=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,iQe=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,sQe=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,Oue={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},aQe=Object.keys(Oue),ay="NaN";function oQe(t,e){return t*Oue[e]}var uj=function(){function t(e,n){eQe(this,t),this.num=e,this.unit=n,this.num=e,this.unit=n,Number.isNaN(e)&&(this.unit=""),n!==""&&!iQe.test(n)&&(this.num=NaN,this.unit=""),aQe.includes(n)&&(this.num=oQe(e,n),this.unit="px")}return tQe(t,[{key:"add",value:function(n){return this.unit!==n.unit?new t(NaN,""):new t(this.num+n.num,this.unit)}},{key:"subtract",value:function(n){return this.unit!==n.unit?new t(NaN,""):new t(this.num-n.num,this.unit)}},{key:"multiply",value:function(n){return this.unit!==""&&n.unit!==""&&this.unit!==n.unit?new t(NaN,""):new t(this.num*n.num,this.unit||n.unit)}},{key:"divide",value:function(n){return this.unit!==""&&n.unit!==""&&this.unit!==n.unit?new t(NaN,""):new t(this.num/n.num,this.unit||n.unit)}},{key:"toString",value:function(){return"".concat(this.num).concat(this.unit)}},{key:"isNaN",value:function(){return Number.isNaN(this.num)}}],[{key:"parse",value:function(n){var r,i=(r=sQe.exec(n))!==null&&r!==void 0?r:[],s=N2(i,3),a=s[1],l=s[2];return new t(parseFloat(a),l??"")}}])}();function Rue(t){if(t.includes(ay))return ay;for(var e=t;e.includes("*")||e.includes("/");){var n,r=(n=rq.exec(e))!==null&&n!==void 0?n:[],i=N2(r,4),s=i[1],a=i[2],l=i[3],c=uj.parse(s??""),u=uj.parse(l??""),d=a==="*"?c.multiply(u):c.divide(u);if(d.isNaN())return ay;e=e.replace(rq,d.toString())}for(;e.includes("+")||/.-\d+(?:\.\d+)?/.test(e);){var f,h=(f=iq.exec(e))!==null&&f!==void 0?f:[],p=N2(h,4),m=p[1],x=p[2],y=p[3],g=uj.parse(m??""),w=uj.parse(y??""),v=x==="+"?g.add(w):g.subtract(w);if(v.isNaN())return ay;e=e.replace(iq,v.toString())}return e}var sq=/\(([^()]*)\)/;function lQe(t){for(var e=t;e.includes("(");){var n=sq.exec(e),r=N2(n,2),i=r[1];e=e.replace(sq,Rue(i))}return e}function cQe(t){var e=t.replace(/\s+/g,"");return e=lQe(e),e=Rue(e),e}function uQe(t){try{return cQe(t)}catch{return ay}}function JR(t){var e=uQe(t.slice(5,-1));return e===ay?"":e}var dQe=["x","y","lineHeight","capHeight","scaleToFit","textAnchor","verticalAnchor","fill"],fQe=["dx","dy","angle","className","breakAll"];function zL(){return zL=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},zL.apply(this,arguments)}function aq(t,e){if(t==null)return{};var n=hQe(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function hQe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function oq(t,e){return xQe(t)||gQe(t,e)||mQe(t,e)||pQe()}
816function pQe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
817In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mQe(t,e){if(t){if(typeof t=="string")return lq(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return lq(t,e)}}function lq(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function gQe(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,a,l=[],c=!0,u=!1;try{if(s=(n=n.call(t)).next,e===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=s.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,i=d}finally{try{if(!c&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return l}}function xQe(t){if(Array.isArray(t))return t}var Iue=/[ \f\n\r\t\v\u2028\u2029]+/,Due=function(e){var n=e.children,r=e.breakAll,i=e.style;try{var s=[];nn(n)||(r?s=n.toString().split(""):s=n.toString().split(Iue));var a=s.map(function(c){return{word:c,width:zw(c,i).width}}),l=r?0:zw(" ",i).width;return{wordsWithComputedWidth:a,spaceWidth:l}}catch{return null}},yQe=function(e,n,r,i,s){var a=e.maxLines,l=e.children,c=e.style,u=e.breakAll,d=Qe(a),f=l,h=function(){var P=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return P.reduce(function(O,L){var T=L.word,D=L.width,F=O[O.length-1];if(F&&(i==null||s||F.width+D+r<Number(i)))F.words.push(T),F.width+=D+r;else{var q={words:[T],width:D};O.push(q)}return O},[])},p=h(n),m=function(P){return P.reduce(function(O,L){return O.width>L.width?O:L})};if(!d)return p;for(var x="…",y=function(P){var O=f.slice(0,P),L=Due({breakAll:u,style:c,children:O+x}).wordsWithComputedWidth,T=h(L),D=T.length>a||m(T).width>Number(i);return[D,T]},g=0,w=f.length-1,v=0,N;g<=w&&v<=f.length-1;){var S=Math.floor((g+w)/2),_=S-1,j=y(_),A=oq(j,2),C=A[0],k=A[1],M=y(S),I=oq(M,1),R=I[0];if(!C&&!R&&(g=S+1),C&&R&&(w=S-1),!C&&R){N=k;break}v++}return N||p},cq=function(e){var n=nn(e)?[]:e.toString().split(Iue);return[{words:n}]},vQe=function(e){var n=e.width,r=e.scaleToFit,i=e.children,s=e.style,a=e.breakAll,l=e.maxLines;if((n||r)&&!Zh.isSsr){var c,u,d=Due({breakAll:a,children:i,style:s});if(d){var f=d.wordsWithComputedWidth,h=d.spaceWidth;c=f,u=h}else return cq(i);return yQe({breakAll:a,children:i,maxLines:l,style:s},c,u,n,r)}return cq(i)},uq="#808080",Gm=function(e){var n=e.x,r=n===void 0?0:n,i=e.y,s=i===void 0?0:i,a=e.lineHeight,l=a===void 0?"1em":a,c=e.capHeight,u=c===void 0?"0.71em":c,d=e.scaleToFit,f=d===void 0?!1:d,h=e.textAnchor,p=h===void 0?"start":h,m=e.verticalAnchor,x=m===void 0?"end":m,y=e.fill,g=y===void 0?uq:y,w=aq(e,dQe),v=b.useMemo(function(){return vQe({breakAll:w.breakAll,children:w.children,maxLines:w.maxLines,scaleToFit:f,style:w.style,width:w.width})},[w.breakAll,w.children,w.maxLines,f,w.style,w.width]),N=w.dx,S=w.dy,_=w.angle,j=w.className,A=w.breakAll,C=aq(w,fQe);if(!Xi(r)||!Xi(s))return null;var k=r+(Qe(N)?N:0),M=s+(Qe(S)?S:0),I;switch(x){case"start":I=JR("calc(".concat(u,")"));break;case"middle":I=JR("calc(".concat((v.length-1)/2," * -").concat(l," + (").concat(u," / 2))"));break;default:I=JR("calc(".concat(v.length-1," * -").concat(l,")"));break}var R=[];if(f){var E=v[0].width,P=w.width;R.push("scale(".concat((Qe(P)?P/E:1)/E,")"))}return _&&R.push("rotate(".concat(_,", ").concat(k,", ").concat(M,")")),R.length&&(C.transform=R.join(" ")),te.createElement("text",zL({},Pt(C,!0),{x:k,y:M,className:an("recharts-text",j),textAnchor:p,fill:g.includes("url")?uq:g}),v.map(function(O,L){var T=O.words.join(A?"":" ");return te.createElement("tspan",{x:k,dy:L===0?I:l,key:"".concat(T,"-").concat(L)},T)}))};function ph(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function bQe(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Z6(t){let e,n,r;t.length!==2?(e=ph,n=(l,c)=>ph(t(l),c),r=(l,c)=>t(l)-c):(e=t===ph||t===bQe?t:wQe,n=t,r=t);function i(l,c,u=0,d=l.length){if(u<d){if(e(c,c)!==0)return d;do{const f=u+d>>>1;n(l[f],c)<0?u=f+1:d=f}while(u<d)}return u}function s(l,c,u=0,d=l.length){if(u<d){if(e(c,c)!==0)return d;do{const f=u+d>>>1;n(l[f],c)<=0?u=f+1:d=f}while(u<d)}return u}function a(l,c,u=0,d=l.length){const f=i(l,c,u,d-1);return f>u&&r(l[f-1],c)>-r(l[f],c)?f-1:f}return{left:i,center:a,right:s}}function wQe(){return 0}function Lue(t){return t===null?NaN:+t}function*_Qe(t,e){for(let n of t)n!=null&&(n=+n)>=n&&(yield n)}const SQe=Z6(ph),WS=SQe.right;Z6(Lue).center;class dq extends Map{constructor(e,n=CQe){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),e!=null)for(const[r,i]of e)this.set(r,i)}get(e){return super.get(fq(this,e))}has(e){return super.has(fq(this,e))}set(e,n){return super.set(NQe(this,e),n)}delete(e){return super.delete(jQe(this,e))}}function fq({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function NQe({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function jQe({_intern:t,_key:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function CQe(t){return t!==null&&typeof t=="object"?t.valueOf():t}function kQe(t=ph){if(t===ph)return $ue;if(typeof t!="function")throw new TypeError("compare is not a function");return(e,n)=>{const r=t(e,n);return r||r===0?r:(t(n,n)===0)-(t(e,e)===0)}}function $ue(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(t<e?-1:t>e?1:0)}const EQe=Math.sqrt(50),AQe=Math.sqrt(10),TQe=Math.sqrt(2);function j2(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log10(r)),s=r/Math.pow(10,i),a=s>=EQe?10:s>=AQe?5:s>=TQe?2:1;let l,c,u;return i<0?(u=Math.pow(10,-i)/a,l=Math.round(t*u),c=Math.round(e*u),l/u<t&&++l,c/u>e&&--c,u=-u):(u=Math.pow(10,i)*a,l=Math.round(t/u),c=Math.round(e/u),l*u<t&&++l,c*u>e&&--c),c<l&&.5<=n&&n<2?j2(t,e,n*2):[l,c,u]}function BL(t,e,n){if(e=+e,t=+t,n=+n,!(n>0))return[];if(t===e)return[t];const r=e<t,[i,s,a]=r?j2(e,t,n):j2(t,e,n);if(!(s>=i))return[];const l=s-i+1,c=new Array(l);if(r)if(a<0)for(let u=0;u<l;++u)c[u]=(s-u)/-a;else for(let u=0;u<l;++u)c[u]=(s-u)*a;else if(a<0)for(let u=0;u<l;++u)c[u]=(i+u)/-a;else for(let u=0;u<l;++u)c[u]=(i+u)*a;return c}function VL(t,e,n){return e=+e,t=+t,n=+n,j2(t,e,n)[2]}function HL(t,e,n){e=+e,t=+t,n=+n;const r=e<t,i=r?VL(e,t,n):VL(t,e,n);return(r?-1:1)*(i<0?1/-i:i)}function hq(t,e){let n;for(const r of t)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);return n}function pq(t,e){let n;for(const r of t)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}
817function Fue(t,e,n=0,r=1/0,i){if(e=Math.floor(e),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(t.length-1,r)),!(n<=e&&e<=r))return t;for(i=i===void 0?$ue:kQe(i);r>n;){if(r-n>600){const c=r-n+1,u=e-n+1,d=Math.log(c),f=.5*Math.exp(2*d/3),h=.5*Math.sqrt(d*f*(c-f)/c)*(u-c/2<0?-1:1),p=Math.max(n,Math.floor(e-u*f/c+h)),m=Math.min(r,Math.floor(e+(c-u)*f/c+h));Fue(t,e,p,m,i)}const s=t[e];let a=n,l=r;for(wb(t,n,e),i(t[r],s)>0&&wb(t,n,r);a<l;){for(wb(t,a,l),++a,--l;i(t[a],s)<0;)++a;for(;i(t[l],s)>0;)--l}i(t[n],s)===0?wb(t,n,l):(++l,wb(t,l,r)),l<=e&&(n=l+1),e<=l&&(r=l-1)}return t}function wb(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function MQe(t,e,n){if(t=Float64Array.from(_Qe(t)),!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return pq(t);if(e>=1)return hq(t);var r,i=(r-1)*e,s=Math.floor(i),a=hq(Fue(t,s).subarray(0,s+1)),l=pq(t.subarray(s+1));return a+(l-a)*(i-s)}}function PQe(t,e,n=Lue){if(!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,i=(r-1)*e,s=Math.floor(i),a=+n(t[s],s,t),l=+n(t[s+1],s+1,t);return a+(l-a)*(i-s)}}function OQe(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((e-t)/n))|0,s=new Array(i);++r<i;)s[r]=t+r*n;return s}function Nl(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function Vd(t,e){switch(arguments.length){case 0:break;case 1:{typeof t=="function"?this.interpolator(t):this.range(t);break}default:{this.domain(t),typeof e=="function"?this.interpolator(e):this.range(e);break}}return this}const WL=Symbol("implicit");function qf(){var t=new dq,e=[],n=[],r=WL;function i(s){let a=t.get(s);if(a===void 0){if(r!==WL)return r;t.set(s,a=e.push(s)-1)}return n[a%n.length]}return i.domain=function(s){if(!arguments.length)return e.slice();e=[],t=new dq;for(const a of s)t.has(a)||t.set(a,e.push(a)-1);return i},i.range=function(s){return arguments.length?(n=Array.from(s),i):n.slice()},i.unknown=function(s){return arguments.length?(r=s,i):r},i.copy=function(){return qf(e,n).unknown(r)},Nl.apply(i,arguments),i}function s_(){var t=qf().unknown(void 0),e=t.domain,n=t.range,r=0,i=1,s,a,l=!1,c=0,u=0,d=.5;delete t.unknown;function f(){var h=e().length,p=i<r,m=p?i:r,x=p?r:i;s=(x-m)/Math.max(1,h-c+u*2),l&&(s=Math.floor(s)),m+=(x-m-s*(h-c))*d,a=s*(1-c),l&&(m=Math.round(m),a=Math.round(a));var y=OQe(h).map(function(g){return m+s*g});return n(p?y.reverse():y)}return t.domain=function(h){return arguments.length?(e(h),f()):e()},t.range=function(h){return arguments.length?([r,i]=h,r=+r,i=+i,f()):[r,i]},t.rangeRound=function(h){return[r,i]=h,r=+r,i=+i,l=!0,f()},t.bandwidth=function(){return a},t.step=function(){return s},t.round=function(h){return arguments.length?(l=!!h,f()):l},t.padding=function(h){return arguments.length?(c=Math.min(1,u=+h),f()):c},t.paddingInner=function(h){return arguments.length?(c=Math.min(1,h),f()):c},t.paddingOuter=function(h){return arguments.length?(u=+h,f()):u},t.align=function(h){return arguments.length?(d=Math.max(0,Math.min(1,h)),f()):d},t.copy=function(){return s_(e(),[r,i]).round(l).paddingInner(c).paddingOuter(u).align(d)},Nl.apply(f(),arguments)}function Uue(t){var e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return Uue(e())},t}function mh(){return Uue(s_.apply(null,arguments).paddingInner(1))}function vM(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function eB(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function V0(){}var qm=.7,vv=1/qm,Ay="\\s*([+-]?\\d+)\\s*",a_="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Xc="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",RQe=/^#([0-9a-f]{3,8})$/,IQe=new RegExp(`^rgb\\(${Ay},${Ay},${Ay}\\)$`),DQe=new RegExp(`^rgb\\(${Xc},${Xc},${Xc}\\)$`),LQe=new RegExp(`^rgba\\(${Ay},${Ay},${Ay},${a_}\\)$`),$Qe=new RegExp(`^rgba\\(${Xc},${Xc},${Xc},${a_}\\)$`),FQe=new RegExp(`^hsl\\(${a_},${Xc},${Xc}\\)$`),UQe=new RegExp(`^hsla\\(${a_},${Xc},${Xc},${a_}\\)$`),mq={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};vM(V0,Km,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:gq,formatHex:gq,formatHex8:zQe,formatHsl:BQe,formatRgb:xq,toString:xq});function gq(){return this.rgb().formatHex()}function zQe(){return this.rgb().formatHex8()}function BQe(){return Bue(this).formatHsl()}function xq(){return this.rgb().formatRgb()}function Km(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=RQe.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?yq(e):n===3?new Ys(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?dj(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?dj(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=IQe.exec(t))?new Ys(e[1],e[2],e[3],1):(e=DQe.exec(t))?new Ys(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=LQe.exec(t))?dj(e[1],e[2],e[3],e[4]):(e=$Qe.exec(t))?dj(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=FQe.exec(t))?wq(e[1],e[2]/100,e[3]/100,1):(e=UQe.exec(t))?wq(e[1],e[2]/100,e[3]/100,e[4]):mq.hasOwnProperty(t)?yq(mq[t]):t==="transparent"?new Ys(NaN,NaN,NaN,0):null}function yq(t){return new Ys(t>>16&255,t>>8&255,t&255,1)}function dj(t,e,n,r){return r<=0&&(t=e=n=NaN),new Ys(t,e,n,r)}function zue(t){return t instanceof V0||(t=Km(t)),t?(t=t.rgb(),new Ys(t.r,t.g,t.b,t.opacity)):new Ys}function bv(t,e,n,r){return arguments.length===1?zue(t):new Ys(t,e,n,r??1)}function Ys(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}vM(Ys,bv,eB(V0,{brighter(t){return t=t==null?vv:Math.pow(vv,t),new Ys(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?qm:Math.pow(qm,t),new Ys(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Ys(_m(this.r),_m(this.g),_m(this.b),C2(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:vq,formatHex:vq,formatHex8:VQe,formatRgb:bq,toString:bq}));function vq(){return`#${Qp(this.r)}${Qp(this.g)}${Qp(this.b)}`}function VQe(){return`#${Qp(this.r)}${Qp(this.g)}${Qp(this.b)}${Qp((isNaN(this.opacity)?1:this.opacity)*255)}`}function bq(){const t=C2(this.opacity);return`${t===1?"rgb(":"rgba("}${_m(this.r)}, ${_m(this.g)}, ${_m(this.b)}${t===1?")":`, ${t})`}`}function C2(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function _m(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Qp(t){return t=_m(t),(t<16?"0":"")+t.toString(16)}function wq(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Yl(t,e,n,r)}function Bue(t){if(t instanceof Yl)return new Yl(t.h,t.s,t.l,t.opacity);if(t instanceof V0||(t=Km(t)),!t)return new Yl;if(t instanceof Yl)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),s=Math.max(e,n,r),a=NaN,l=s-i,c=(s+i)/2;return l?(e===s?a=(n-r)/l+(n<r)*6:n===s?a=(r-e)/l+2:a=(e-n)/l+4,l/=c<.5?s+i:2-s-i,a*=60):l=c>0&&c<1?0:a,new Yl(a,l,c,t.opacity)}function HQe(t,e,n,r){return arguments.length===1?Bue(t):new Yl(t,e,n,r??1)}function Yl(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}vM(Yl,HQe,eB(V0,{brighter(t){return t=t==null?vv:Math.pow(vv,t),new Yl(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?qm:Math.pow(qm,t),new Yl(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new Ys(ZR(t>=240?t-240:t+120,i,r),ZR(t,i,r),ZR(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Yl(_q(this.h),fj(this.s),fj(this.l),C2(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=C2(this.opacity);return`${t===1?"hsl(":"hsla("}${_q(this.h)}, ${fj(this.s)*100}%, ${fj(this.l)*100}%${t===1?")":`, ${t})`}`}}));function _q(t){return t=(t||0)%360,t<0?t+360:t}
vendor: 5,224 bytes, line 817
817function fj(t){return Math.max(0,Math.min(1,t||0))}function ZR(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const WQe=Math.PI/180,GQe=180/Math.PI;var Vue=-.14861,tB=1.78277,nB=-.29227,bM=-.90649,o_=1.97294,Sq=o_*bM,Nq=o_*tB,jq=tB*nB-bM*Vue;function qQe(t){if(t instanceof Sm)return new Sm(t.h,t.s,t.l,t.opacity);t instanceof Ys||(t=zue(t));var e=t.r/255,n=t.g/255,r=t.b/255,i=(jq*r+Sq*e-Nq*n)/(jq+Sq-Nq),s=r-i,a=(o_*(n-i)-nB*s)/bM,l=Math.sqrt(a*a+s*s)/(o_*i*(1-i)),c=l?Math.atan2(a,s)*GQe-120:NaN;return new Sm(c<0?c+360:c,l,i,t.opacity)}function cu(t,e,n,r){return arguments.length===1?qQe(t):new Sm(t,e,n,r??1)}function Sm(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}vM(Sm,cu,eB(V0,{brighter(t){return t=t==null?vv:Math.pow(vv,t),new Sm(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?qm:Math.pow(qm,t),new Sm(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=isNaN(this.h)?0:(this.h+120)*WQe,e=+this.l,n=isNaN(this.s)?0:this.s*e*(1-e),r=Math.cos(t),i=Math.sin(t);return new Ys(255*(e+n*(Vue*r+tB*i)),255*(e+n*(nB*r+bM*i)),255*(e+n*(o_*r)),this.opacity)}}));function KQe(t,e,n,r,i){var s=t*t,a=s*t;return((1-3*t+3*s-a)*e+(4-6*s+3*a)*n+(1+3*t+3*s-3*a)*r+a*i)/6}function YQe(t){var e=t.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),i=t[r],s=t[r+1],a=r>0?t[r-1]:2*i-s,l=r<e-1?t[r+2]:2*s-i;return KQe((n-r/e)*e,a,i,s,l)}}const wM=t=>()=>t;function Hue(t,e){return function(n){return t+n*e}}function XQe(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function QQe(t,e){var n=e-t;return n?Hue(t,n>180||n<-180?n-360*Math.round(n/360):n):wM(isNaN(t)?e:t)}function JQe(t){return(t=+t)==1?Ty:function(e,n){return n-e?XQe(e,n,t):wM(isNaN(e)?n:e)}}function Ty(t,e){var n=e-t;return n?Hue(t,n):wM(isNaN(t)?e:t)}const k2=function t(e){var n=JQe(e);function r(i,s){var a=n((i=bv(i)).r,(s=bv(s)).r),l=n(i.g,s.g),c=n(i.b,s.b),u=Ty(i.opacity,s.opacity);return function(d){return i.r=a(d),i.g=l(d),i.b=c(d),i.opacity=u(d),i+""}}return r.gamma=t,r}(1);function ZQe(t){return function(e){var n=e.length,r=new Array(n),i=new Array(n),s=new Array(n),a,l;for(a=0;a<n;++a)l=bv(e[a]),r[a]=l.r||0,i[a]=l.g||0,s[a]=l.b||0;return r=t(r),i=t(i),s=t(s),l.opacity=1,function(c){return l.r=r(c),l.g=i(c),l.b=s(c),l+""}}}var eJe=ZQe(YQe);function tJe(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),i;return function(s){for(i=0;i<n;++i)r[i]=t[i]*(1-s)+e[i]*s;return r}}function nJe(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function rJe(t,e){var n=e?e.length:0,r=t?Math.min(n,t.length):0,i=new Array(r),s=new Array(n),a;for(a=0;a<r;++a)i[a]=ud(t[a],e[a]);for(;a<n;++a)s[a]=e[a];return function(l){for(a=0;a<r;++a)s[a]=i[a](l);return s}}function iJe(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function Gl(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function sJe(t,e){var n={},r={},i;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(i in e)i in t?n[i]=ud(t[i],e[i]):r[i]=e[i];return function(s){for(i in n)r[i]=n[i](s);return r}}var GL=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,eI=new RegExp(GL.source,"g");function aJe(t){return function(){return t}}function oJe(t){return function(e){return t(e)+""}}function rB(t,e){var n=GL.lastIndex=eI.lastIndex=0,r,i,s,a=-1,l=[],c=[];for(t=t+"",e=e+"";(r=GL.exec(t))&&(i=eI.exec(e));)(s=i.index)>n&&(s=e.slice(n,s),l[a]?l[a]+=s:l[++a]=s),(r=r[0])===(i=i[0])?l[a]?l[a]+=i:l[++a]=i:(l[++a]=null,c.push({i:a,x:Gl(r,i)})),n=eI.lastIndex;return n<e.length&&(s=e.slice(n),l[a]?l[a]+=s:l[++a]=s),l.length<2?c[0]?oJe(c[0].x):aJe(e):(e=c.length,function(u){for(var d=0,f;d<e;++d)l[(f=c[d]).i]=f.x(u);return l.join("")})}function ud(t,e){var n=typeof e,r;return e==null||n==="boolean"?wM(e):(n==="number"?Gl:n==="string"?(r=Km(e))?(e=r,k2):rB:e instanceof Km?k2:e instanceof Date?iJe:nJe(e)?tJe:Array.isArray(e)?rJe:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?sJe:Gl)(t,e)}function iB(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}var Cq=180/Math.PI,qL={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Wue(t,e,n,r,i,s){var a,l,c;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(c=t*n+e*r)&&(n-=t*c,r-=e*c),(l=Math.sqrt(n*n+r*r))&&(n/=l,r/=l,c/=l),t*r<e*n&&(t=-t,e=-e,c=-c,a=-a),{translateX:i,translateY:s,rotate:Math.atan2(e,t)*Cq,skewX:Math.atan(c)*Cq,scaleX:a,scaleY:l}}var hj;function lJe(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?qL:Wue(e.a,e.b,e.c,e.d,e.e,e.f)}function cJe(t){return t==null||(hj||(hj=document.createElementNS("http://www.w3.org/2000/svg","g")),hj.setAttribute("transform",t),!(t=hj.transform.baseVal.consolidate()))?qL:(t=t.matrix,Wue(t.a,t.b,t.c,t.d,t.e,t.f))}function Gue(t,e,n,r){function i(u){return u.length?u.pop()+" ":""}function s(u,d,f,h,p,m){if(u!==f||d!==h){var x=p.push("translate(",null,e,null,n);m.push({i:x-4,x:Gl(u,f)},{i:x-2,x:Gl(d,h)})}else(f||h)&&p.push("translate("+f+e+h+n)}function a(u,d,f,h){u!==d?(u-d>180?d+=360:d-u>180&&(u+=360),h.push({i:f.push(i(f)+"rotate(",null,r)-2,x:Gl(u,d)})):d&&f.push(i(f)+"rotate("+d+r)}
vendor: 4,654 bytes, line 817
817function l(u,d,f,h){u!==d?h.push({i:f.push(i(f)+"skewX(",null,r)-2,x:Gl(u,d)}):d&&f.push(i(f)+"skewX("+d+r)}function c(u,d,f,h,p,m){if(u!==f||d!==h){var x=p.push(i(p)+"scale(",null,",",null,")");m.push({i:x-4,x:Gl(u,f)},{i:x-2,x:Gl(d,h)})}else(f!==1||h!==1)&&p.push(i(p)+"scale("+f+","+h+")")}return function(u,d){var f=[],h=[];return u=t(u),d=t(d),s(u.translateX,u.translateY,d.translateX,d.translateY,f,h),a(u.rotate,d.rotate,f,h),l(u.skewX,d.skewX,f,h),c(u.scaleX,u.scaleY,d.scaleX,d.scaleY,f,h),u=d=null,function(p){for(var m=-1,x=h.length,y;++m<x;)f[(y=h[m]).i]=y.x(p);return f.join("")}}}var uJe=Gue(lJe,"px, ","px)","deg)"),dJe=Gue(cJe,", ",")",")"),fJe=1e-12;function kq(t){return((t=Math.exp(t))+1/t)/2}function hJe(t){return((t=Math.exp(t))-1/t)/2}function pJe(t){return((t=Math.exp(2*t))-1)/(t+1)}const XC=function t(e,n,r){function i(s,a){var l=s[0],c=s[1],u=s[2],d=a[0],f=a[1],h=a[2],p=d-l,m=f-c,x=p*p+m*m,y,g;if(x<fJe)g=Math.log(h/u)/e,y=function(j){return[l+j*p,c+j*m,u*Math.exp(e*j*g)]};else{var w=Math.sqrt(x),v=(h*h-u*u+r*x)/(2*u*n*w),N=(h*h-u*u-r*x)/(2*h*n*w),S=Math.log(Math.sqrt(v*v+1)-v),_=Math.log(Math.sqrt(N*N+1)-N);g=(_-S)/e,y=function(j){var A=j*g,C=kq(S),k=u/(n*w)*(C*pJe(e*A+S)-hJe(S));return[l+k*p,c+k*m,u*C/kq(e*A+S)]}}return y.duration=g*1e3*e/Math.SQRT2,y}return i.rho=function(s){var a=Math.max(.001,+s),l=a*a,c=l*l;return t(a,l,c)},i}(Math.SQRT2,2,4);function que(t){return function e(n){n=+n;function r(i,s){var a=t((i=cu(i)).h,(s=cu(s)).h),l=Ty(i.s,s.s),c=Ty(i.l,s.l),u=Ty(i.opacity,s.opacity);return function(d){return i.h=a(d),i.s=l(d),i.l=c(Math.pow(d,n)),i.opacity=u(d),i+""}}return r.gamma=e,r}(1)}que(QQe);var sB=que(Ty);function mJe(t,e){e===void 0&&(e=t,t=ud);for(var n=0,r=e.length-1,i=e[0],s=new Array(r<0?0:r);n<r;)s[n]=t(i,i=e[++n]);return function(a){var l=Math.max(0,Math.min(r-1,Math.floor(a*=r)));return s[l](a-l)}}function gJe(t){return function(){return t}}function E2(t){return+t}var Eq=[0,1];function ha(t){return t}function KL(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:gJe(isNaN(e)?NaN:.5)}function xJe(t,e){var n;return t>e&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function yJe(t,e,n){var r=t[0],i=t[1],s=e[0],a=e[1];return i<r?(r=KL(i,r),s=n(a,s)):(r=KL(r,i),s=n(s,a)),function(l){return s(r(l))}}function vJe(t,e,n){var r=Math.min(t.length,e.length)-1,i=new Array(r),s=new Array(r),a=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++a<r;)i[a]=KL(t[a],t[a+1]),s[a]=n(e[a],e[a+1]);return function(l){var c=WS(t,l,1,r)-1;return s[c](i[c](l))}}function GS(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function _M(){var t=Eq,e=Eq,n=ud,r,i,s,a=ha,l,c,u;function d(){var h=Math.min(t.length,e.length);return a!==ha&&(a=xJe(t[0],t[h-1])),l=h>2?vJe:yJe,c=u=null,f}function f(h){return h==null||isNaN(h=+h)?s:(c||(c=l(t.map(r),e,n)))(r(a(h)))}return f.invert=function(h){return a(i((u||(u=l(e,t.map(r),Gl)))(h)))},f.domain=function(h){return arguments.length?(t=Array.from(h,E2),d()):t.slice()},f.range=function(h){return arguments.length?(e=Array.from(h),d()):e.slice()},f.rangeRound=function(h){return e=Array.from(h),n=iB,d()},f.clamp=function(h){return arguments.length?(a=h?!0:ha,d()):a!==ha},f.interpolate=function(h){return arguments.length?(n=h,d()):n},f.unknown=function(h){return arguments.length?(s=h,f):s},function(h,p){return r=h,i=p,d()}}function aB(){return _M()(ha,ha)}function bJe(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function A2(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function wv(t){return t=A2(Math.abs(t)),t?t[1]:NaN}function wJe(t,e){return function(n,r){for(var i=n.length,s=[],a=0,l=t[0],c=0;i>0&&l>0&&(c+l+1>r&&(l=Math.max(1,r-c)),s.push(n.substring(i-=l,i+l)),!((c+=l+1)>r));)l=t[a=(a+1)%t.length];return s.reverse().join(e)}}function _Je(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var SJe=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function l_(t){if(!(e=SJe.exec(t)))throw new Error("invalid format: "+t);var e;return new oB({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}l_.prototype=oB.prototype;function oB(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.
vendor: 4,862 bytes, line 817
817width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}oB.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function NJe(t){e:for(var e=t.length,n=1,r=-1,i;n<e;++n)switch(t[n]){case".":r=i=n;break;case"0":r===0&&(r=n),i=n;break;default:if(!+t[n])break e;r>0&&(r=0);break}return r>0?t.slice(0,r)+t.slice(i+1):t}var Kue;function jJe(t,e){var n=A2(t,e);if(!n)return t+"";var r=n[0],i=n[1],s=i-(Kue=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,a=r.length;return s===a?r:s>a?r+new Array(s-a+1).join("0"):s>0?r.slice(0,s)+"."+r.slice(s):"0."+new Array(1-s).join("0")+A2(t,Math.max(0,e+s-1))[0]}function Aq(t,e){var n=A2(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const Tq={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:bJe,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Aq(t*100,e),r:Aq,s:jJe,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Mq(t){return t}var Pq=Array.prototype.map,Oq=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function CJe(t){var e=t.grouping===void 0||t.thousands===void 0?Mq:wJe(Pq.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",r=t.currency===void 0?"":t.currency[1]+"",i=t.decimal===void 0?".":t.decimal+"",s=t.numerals===void 0?Mq:_Je(Pq.call(t.numerals,String)),a=t.percent===void 0?"%":t.percent+"",l=t.minus===void 0?"−":t.minus+"",c=t.nan===void 0?"NaN":t.nan+"";function u(f){f=l_(f);var h=f.fill,p=f.align,m=f.sign,x=f.symbol,y=f.zero,g=f.width,w=f.comma,v=f.precision,N=f.trim,S=f.type;S==="n"?(w=!0,S="g"):Tq[S]||(v===void 0&&(v=12),N=!0,S="g"),(y||h==="0"&&p==="=")&&(y=!0,h="0",p="=");var _=x==="$"?n:x==="#"&&/[boxX]/.test(S)?"0"+S.toLowerCase():"",j=x==="$"?r:/[%p]/.test(S)?a:"",A=Tq[S],C=/[defgprs%]/.test(S);v=v===void 0?6:/[gprs]/.test(S)?Math.max(1,Math.min(21,v)):Math.max(0,Math.min(20,v));function k(M){var I=_,R=j,E,P,O;if(S==="c")R=A(M)+R,M="";else{M=+M;var L=M<0||1/M<0;if(M=isNaN(M)?c:A(Math.abs(M),v),N&&(M=NJe(M)),L&&+M==0&&m!=="+"&&(L=!1),I=(L?m==="("?m:l:m==="-"||m==="("?"":m)+I,R=(S==="s"?Oq[8+Kue/3]:"")+R+(L&&m==="("?")":""),C){for(E=-1,P=M.length;++E<P;)if(O=M.charCodeAt(E),48>O||O>57){R=(O===46?i+M.slice(E+1):M.slice(E))+R,M=M.slice(0,E);break}}}w&&!y&&(M=e(M,1/0));var T=I.length+M.length+R.length,D=T<g?new Array(g-T+1).join(h):"";switch(w&&y&&(M=e(D+M,D.length?g-R.length:1/0),D=""),p){case"<":M=I+M+R+D;break;case"=":M=I+D+M+R;break;case"^":M=D.slice(0,T=D.length>>1)+I+M+R+D.slice(T);break;default:M=D+I+M+R;break}return s(M)}return k.toString=function(){return f+""},k}function d(f,h){var p=u((f=l_(f),f.type="f",f)),m=Math.max(-8,Math.min(8,Math.floor(wv(h)/3)))*3,x=Math.pow(10,-m),y=Oq[8+m/3];return function(g){return p(x*g)+y}}return{format:u,formatPrefix:d}}var pj,lB,Yue;kJe({thousands:",",grouping:[3],currency:["$",""]});function kJe(t){return pj=CJe(t),lB=pj.format,Yue=pj.formatPrefix,pj}function EJe(t){return Math.max(0,-wv(Math.abs(t)))}function AJe(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(wv(e)/3)))*3-wv(Math.abs(t)))}function TJe(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,wv(e)-wv(t))+1}function Xue(t,e,n,r){var i=HL(t,e,n),s;switch(r=l_(r??",f"),r.type){case"s":{var a=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(s=AJe(i,a))&&(r.precision=s),Yue(r,a)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(s=TJe(i,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=s-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(s=EJe(i))&&(r.precision=s-(r.type==="%")*2);break}}return lB(r)}function ep(t){var e=t.domain;return t.ticks=function(n){var r=e();return BL(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var i=e();return Xue(i[0],i[i.length-1],n??10,r)},t.nice=function(n){n==null&&(n=10);var r=e(),i=0,s=r.length-1,a=r[i],l=r[s],c,u,d=10;for(l<a&&(u=a,a=l,l=u,u=i,i=s,s=u);d-- >0;){if(u=VL(a,l,n),u===c)return r[i]=a,r[s]=l,e(r);if(u>0)a=Math.floor(a/u)*u,l=Math.ceil(l/u)*u;else if(u<0)a=Math.ceil(a*u)/u,l=Math.floor(l*u)/u;else break;c=u}return t},t}function Ym(){var t=aB();return t.copy=function(){return GS(t,Ym())},Nl.apply(t,arguments),ep(t)}function Que(t){var e;function n(r){return r==null||isNaN(r=+r)?e:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(t=Array.from(r,E2),n):t.slice()},n.unknown=function(r){return arguments.length?(e=r,n):e}
vendor: 4,609 bytes, line 817
817,n.copy=function(){return Que(t).unknown(e)},t=arguments.length?Array.from(t,E2):[0,1],ep(n)}function Jue(t,e){t=t.slice();var n=0,r=t.length-1,i=t[n],s=t[r],a;return s<i&&(a=n,n=r,r=a,a=i,i=s,s=a),t[n]=e.floor(i),t[r]=e.ceil(s),t}function Rq(t){return Math.log(t)}function Iq(t){return Math.exp(t)}function MJe(t){return-Math.log(-t)}function PJe(t){return-Math.exp(-t)}function OJe(t){return isFinite(t)?+("1e"+t):t<0?0:t}function RJe(t){return t===10?OJe:t===Math.E?Math.exp:e=>Math.pow(t,e)}function IJe(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}function Dq(t){return(e,n)=>-t(-e,n)}function cB(t){const e=t(Rq,Iq),n=e.domain;let r=10,i,s;function a(){return i=IJe(r),s=RJe(r),n()[0]<0?(i=Dq(i),s=Dq(s),t(MJe,PJe)):t(Rq,Iq),e}return e.base=function(l){return arguments.length?(r=+l,a()):r},e.domain=function(l){return arguments.length?(n(l),a()):n()},e.ticks=l=>{const c=n();let u=c[0],d=c[c.length-1];const f=d<u;f&&([u,d]=[d,u]);let h=i(u),p=i(d),m,x;const y=l==null?10:+l;let g=[];if(!(r%1)&&p-h<y){if(h=Math.floor(h),p=Math.ceil(p),u>0){for(;h<=p;++h)for(m=1;m<r;++m)if(x=h<0?m/s(-h):m*s(h),!(x<u)){if(x>d)break;g.push(x)}}else for(;h<=p;++h)for(m=r-1;m>=1;--m)if(x=h>0?m/s(-h):m*s(h),!(x<u)){if(x>d)break;g.push(x)}g.length*2<y&&(g=BL(u,d,y))}else g=BL(h,p,Math.min(p-h,y)).map(s);return f?g.reverse():g},e.tickFormat=(l,c)=>{if(l==null&&(l=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=l_(c)).precision==null&&(c.trim=!0),c=lB(c)),l===1/0)return c;const u=Math.max(1,r*l/e.ticks().length);return d=>{let f=d/s(Math.round(i(d)));return f*r<r-.5&&(f*=r),f<=u?c(d):""}},e.nice=()=>n(Jue(n(),{floor:l=>s(Math.floor(i(l))),ceil:l=>s(Math.ceil(i(l)))})),e}function Zue(){const t=cB(_M()).domain([1,10]);return t.copy=()=>GS(t,Zue()).base(t.base()),Nl.apply(t,arguments),t}function Lq(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function $q(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function uB(t){var e=1,n=t(Lq(e),$q(e));return n.constant=function(r){return arguments.length?t(Lq(e=+r),$q(e)):e},ep(n)}function ede(){var t=uB(_M());return t.copy=function(){return GS(t,ede()).constant(t.constant())},Nl.apply(t,arguments)}function Fq(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function DJe(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function LJe(t){return t<0?-t*t:t*t}function dB(t){var e=t(ha,ha),n=1;function r(){return n===1?t(ha,ha):n===.5?t(DJe,LJe):t(Fq(n),Fq(1/n))}return e.exponent=function(i){return arguments.length?(n=+i,r()):n},ep(e)}function fB(){var t=dB(_M());return t.copy=function(){return GS(t,fB()).exponent(t.exponent())},Nl.apply(t,arguments),t}function $Je(){return fB.apply(null,arguments).exponent(.5)}function Uq(t){return Math.sign(t)*t*t}function FJe(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function tde(){var t=aB(),e=[0,1],n=!1,r;function i(s){var a=FJe(t(s));return isNaN(a)?r:n?Math.round(a):a}return i.invert=function(s){return t.invert(Uq(s))},i.domain=function(s){return arguments.length?(t.domain(s),i):t.domain()},i.range=function(s){return arguments.length?(t.range((e=Array.from(s,E2)).map(Uq)),i):e.slice()},i.rangeRound=function(s){return i.range(s).round(!0)},i.round=function(s){return arguments.length?(n=!!s,i):n},i.clamp=function(s){return arguments.length?(t.clamp(s),i):t.clamp()},i.unknown=function(s){return arguments.length?(r=s,i):r},i.copy=function(){return tde(t.domain(),e).round(n).clamp(t.clamp()).unknown(r)},Nl.apply(i,arguments),ep(i)}function nde(){var t=[],e=[],n=[],r;function i(){var a=0,l=Math.max(1,e.length);for(n=new Array(l-1);++a<l;)n[a-1]=PQe(t,a/l);return s}function s(a){return a==null||isNaN(a=+a)?r:e[WS(n,a)]}return s.invertExtent=function(a){var l=e.indexOf(a);return l<0?[NaN,NaN]:[l>0?n[l-1]:t[0],l<n.length?n[l]:t[t.length-1]]},s.domain=function(a){if(!arguments.length)return t.slice();t=[];for(let l of a)l!=null&&!isNaN(l=+l)&&t.push(l);return t.sort(ph),i()},s.range=function(a){return arguments.length?(e=Array.from(a),i()):e.slice()},s.unknown=function(a){return arguments.length?(r=a,s):r},s.quantiles=function(){return n.slice()},s.copy=function(){return nde().domain(t).range(e).unknown(r)},Nl.apply(s,arguments)}function rde(){var t=0,e=1,n=1,r=[.5],i=[0,1],s;function a(c){return c!=null&&c<=c?i[WS(r,c,0,n)]:s}function l(){var c=-1;for(r=new Array(n);++c<n;)r[c]=((c+1)*e-(c-n)*t)/(n+1);return a}return a.domain=function(c){return arguments.length?([t,e]=c,t=+t,e=+e,l()):[t,e]},a.range=function(c){return arguments.length?(n=(i=Array.from(c)).length-1,l(
817)):i.slice()},a.invertExtent=function(c){var u=i.indexOf(c);return u<0?[NaN,NaN]:u<1?[t,r[0]]:u>=n?[r[n-1],e]:[r[u-1],r[u]]},a.unknown=function(c){return arguments.length&&(s=c),a},a.thresholds=function(){return r.slice()},a.copy=function(){return rde().domain([t,e]).range(i).unknown(s)},Nl.apply(ep(a),arguments)}function ide(){var t=[.5],e=[0,1],n,r=1;function i(s){return s!=null&&s<=s?e[WS(t,s,0,r)]:n}return i.domain=function(s){return arguments.length?(t=Array.from(s),r=Math.min(t.length,e.length-1),i):t.slice()},i.range=function(s){return arguments.length?(e=Array.from(s),r=Math.min(t.length,e.length-1),i):e.slice()},i.invertExtent=function(s){var a=e.indexOf(s);return[t[a-1],t[a]]},i.unknown=function(s){return arguments.length?(n=s,i):n},i.copy=function(){return ide().domain(t).range(e).unknown(n)},Nl.apply(i,arguments)}const tI=new Date,nI=new Date;function is(t,e,n,r){function i(s){return t(s=arguments.length===0?new Date:new Date(+s)),s}return i.floor=s=>(t(s=new Date(+s)),s),i.ceil=s=>(t(s=new Date(s-1)),e(s,1),t(s),s),i.round=s=>{const a=i(s),l=i.ceil(s);return s-a<l-s?a:l},i.offset=(s,a)=>(e(s=new Date(+s),a==null?1:Math.floor(a)),s),i.range=(s,a,l)=>{const c=[];if(s=i.ceil(s),l=l==null?1:Math.floor(l),!(s<a)||!(l>0))return c;let u;do c.push(u=new Date(+s)),e(s,l),t(s);while(u<s&&s<a);return c},i.filter=s=>is(a=>{if(a>=a)for(;t(a),!s(a);)a.setTime(a-1)},(a,l)=>{if(a>=a)if(l<0)for(;++l<=0;)for(;e(a,-1),!s(a););else for(;--l>=0;)for(;e(a,1),!s(a););}),n&&(i.count=(s,a)=>(tI.setTime(+s),nI.setTime(+a),t(tI),t(nI),Math.floor(n(tI,nI))),i.every=s=>(s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?i.filter(r?a=>r(a)%s===0:a=>i.count(0,a)%s===0):i)),i}const T2=is(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);T2.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?is(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):T2);T2.range;const ed=1e3,il=ed*60,td=il*60,Cd=td*24,hB=Cd*7,zq=Cd*30,rI=Cd*365,Jp=is(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*ed)},(t,e)=>(e-t)/ed,t=>t.getUTCSeconds());Jp.range;const pB=is(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*ed)},(t,e)=>{t.setTime(+t+e*il)},(t,e)=>(e-t)/il,t=>t.getMinutes());pB.range;const mB=is(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*il)},(t,e)=>(e-t)/il,t=>t.getUTCMinutes());mB.range;const gB=is(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*ed-t.getMinutes()*il)},(t,e)=>{t.setTime(+t+e*td)},(t,e)=>(e-t)/td,t=>t.getHours());gB.range;const xB=is(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*td)},(t,e)=>(e-t)/td,t=>t.getUTCHours());xB.range;const qS=is(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*il)/Cd,t=>t.getDate()-1);qS.range;const SM=is(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Cd,t=>t.getUTCDate()-1);SM.range;const sde=is(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Cd,t=>Math.floor(t/Cd));sde.range;function Ag(t){return is(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*il)/hB)}const NM=Ag(0),M2=Ag(1),UJe=Ag(2),zJe=Ag(3),_v=Ag(4),BJe=Ag(5),VJe=Ag(6);NM.range;M2.range;UJe.range;zJe.range;_v.range;BJe.range;VJe.range;function Tg(t){return is(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/hB)}const jM=Tg(0),P2=Tg(1),HJe=Tg(2),WJe=Tg(3),Sv=Tg(4),GJe=Tg(5),qJe=Tg(6);jM.range;P2.range;HJe.range;WJe.range;Sv.range;GJe.range;qJe.range;const yB=is(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());yB.range;const vB=is(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());vB.range;const kd=is(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());kd.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:is(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});kd.range;const Ed=is(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());Ed.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:is(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});Ed.range;function ade(t,e,n,r,i,s){const a=[[Jp,1,ed],[Jp,5,5*ed],[Jp,15,15*ed],[Jp,30,30*ed],[s,1,il],[s,5,5*il],[s,15,15*il],[s,30,30*il],[i,1,td],[i,3,3*td],[i,6,6*td],[i,12,12*td],[r,1,C
vendor: 5,609 bytes, line 817
817d],[r,2,2*Cd],[n,1,hB],[e,1,zq],[e,3,3*zq],[t,1,rI]];function l(u,d,f){const h=d<u;h&&([u,d]=[d,u]);const p=f&&typeof f.range=="function"?f:c(u,d,f),m=p?p.range(u,+d+1):[];return h?m.reverse():m}function c(u,d,f){const h=Math.abs(d-u)/f,p=Z6(([,,y])=>y).right(a,h);if(p===a.length)return t.every(HL(u/rI,d/rI,f));if(p===0)return T2.every(Math.max(HL(u,d,f),1));const[m,x]=a[h/a[p-1][2]<a[p][2]/h?p-1:p];return m.every(x)}return[l,c]}const[KJe,YJe]=ade(Ed,vB,jM,sde,xB,mB),[XJe,QJe]=ade(kd,yB,NM,qS,gB,pB);function iI(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function sI(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function _b(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function JJe(t){var e=t.dateTime,n=t.date,r=t.time,i=t.periods,s=t.days,a=t.shortDays,l=t.months,c=t.shortMonths,u=Sb(i),d=Nb(i),f=Sb(s),h=Nb(s),p=Sb(a),m=Nb(a),x=Sb(l),y=Nb(l),g=Sb(c),w=Nb(c),v={a:L,A:T,b:D,B:F,c:null,d:qq,e:qq,f:wZe,g:MZe,G:OZe,H:yZe,I:vZe,j:bZe,L:ode,m:_Ze,M:SZe,p:q,q:B,Q:Xq,s:Qq,S:NZe,u:jZe,U:CZe,V:kZe,w:EZe,W:AZe,x:null,X:null,y:TZe,Y:PZe,Z:RZe,"%":Yq},N={a:z,A:H,b:W,B:G,c:null,d:Kq,e:Kq,f:$Ze,g:KZe,G:XZe,H:IZe,I:DZe,j:LZe,L:cde,m:FZe,M:UZe,p:K,q:ee,Q:Xq,s:Qq,S:zZe,u:BZe,U:VZe,V:HZe,w:WZe,W:GZe,x:null,X:null,y:qZe,Y:YZe,Z:QZe,"%":Yq},S={a:k,A:M,b:I,B:R,c:E,d:Wq,e:Wq,f:pZe,g:Hq,G:Vq,H:Gq,I:Gq,j:uZe,L:hZe,m:cZe,M:dZe,p:C,q:lZe,Q:gZe,s:xZe,S:fZe,u:rZe,U:iZe,V:sZe,w:nZe,W:aZe,x:P,X:O,y:Hq,Y:Vq,Z:oZe,"%":mZe};v.x=_(n,v),v.X=_(r,v),v.c=_(e,v),N.x=_(n,N),N.X=_(r,N),N.c=_(e,N);function _(V,J){return function(Y){var $=[],fe=-1,ce=0,ve=V.length,X,de,Te;for(Y instanceof Date||(Y=new Date(+Y));++fe<ve;)V.charCodeAt(fe)===37&&($.push(V.slice(ce,fe)),(de=Bq[X=V.charAt(++fe)])!=null?X=V.charAt(++fe):de=X==="e"?" ":"0",(Te=J[X])&&(X=Te(Y,de)),$.push(X),ce=fe+1);return $.push(V.slice(ce,fe)),$.join("")}}function j(V,J){return function(Y){var $=_b(1900,void 0,1),fe=A($,V,Y+="",0),ce,ve;if(fe!=Y.length)return null;if("Q"in $)return new Date($.Q);if("s"in $)return new Date($.s*1e3+("L"in $?$.L:0));if(J&&!("Z"in $)&&($.Z=0),"p"in $&&($.H=$.H%12+$.p*12),$.m===void 0&&($.m="q"in $?$.q:0),"V"in $){if($.V<1||$.V>53)return null;"w"in $||($.w=1),"Z"in $?(ce=sI(_b($.y,0,1)),ve=ce.getUTCDay(),ce=ve>4||ve===0?P2.ceil(ce):P2(ce),ce=SM.offset(ce,($.V-1)*7),$.y=ce.getUTCFullYear(),$.m=ce.getUTCMonth(),$.d=ce.getUTCDate()+($.w+6)%7):(ce=iI(_b($.y,0,1)),ve=ce.getDay(),ce=ve>4||ve===0?M2.ceil(ce):M2(ce),ce=qS.offset(ce,($.V-1)*7),$.y=ce.getFullYear(),$.m=ce.getMonth(),$.d=ce.getDate()+($.w+6)%7)}else("W"in $||"U"in $)&&("w"in $||($.w="u"in $?$.u%7:"W"in $?1:0),ve="Z"in $?sI(_b($.y,0,1)).getUTCDay():iI(_b($.y,0,1)).getDay(),$.m=0,$.d="W"in $?($.w+6)%7+$.W*7-(ve+5)%7:$.w+$.U*7-(ve+6)%7);return"Z"in $?($.H+=$.Z/100|0,$.M+=$.Z%100,sI($)):iI($)}}function A(V,J,Y,$){for(var fe=0,ce=J.length,ve=Y.length,X,de;fe<ce;){if($>=ve)return-1;if(X=J.charCodeAt(fe++),X===37){if(X=J.charAt(fe++),de=S[X in Bq?J.charAt(fe++):X],!de||($=de(V,Y,$))<0)return-1}else if(X!=Y.charCodeAt($++))return-1}return $}function C(V,J,Y){var $=u.exec(J.slice(Y));return $?(V.p=d.get($[0].toLowerCase()),Y+$[0].length):-1}function k(V,J,Y){var $=p.exec(J.slice(Y));return $?(V.w=m.get($[0].toLowerCase()),Y+$[0].length):-1}function M(V,J,Y){var $=f.exec(J.slice(Y));return $?(V.w=h.get($[0].toLowerCase()),Y+$[0].length):-1}function I(V,J,Y){var $=g.exec(J.slice(Y));return $?(V.m=w.get($[0].toLowerCase()),Y+$[0].length):-1}function R(V,J,Y){var $=x.exec(J.slice(Y));return $?(V.m=y.get($[0].toLowerCase()),Y+$[0].length):-1}function E(V,J,Y){return A(V,e,J,Y)}function P(V,J,Y){return A(V,n,J,Y)}function O(V,J,Y){return A(V,r,J,Y)}function L(V){return a[V.getDay()]}function T(V){return s[V.getDay()]}function D(V){return c[V.getMonth()]}function F(V){return l[V.getMonth()]}function q(V){return i[+(V.getHours()>=12)]}function B(V){return 1+~~(V.getMonth()/3)}function z(V){return a[V.getUTCDay()]}function H(V){return s[V.getUTCDay()]}function W(V){return c[V.getUTCMonth()]}function G(V){return l[V.getUTCMonth()]}function K(V){return i[+(V.getUTCHours()>=12)]}function ee(V){return 1+~~(V.getUTCMonth()/3)}return{format:function(V){var J=_(V+="",v);return J.toString=function(){return V},J},parse:function(V){var J=j(V+="",!1);return J.toString=function(){return V},J},utcFormat:function(V){var J=_(V+="",N);return J.toString=function(){return V},J},utcParse:function(V){var J=j(V+="",!0);return J.toString=function(){return V},J}}}var Bq={"-":"",_:" ",0:"0"},Ss=/^\s*\d+/,ZJe=/^%/,eZe=/[\\^$*+?|[\]().{}]/g;function Wn(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",s=i.length;return r+(s<n?new Array(n-s+1).join(e)+i:i)}function tZe(t){return t.replace(eZe,"\\$&")}function Sb(t){return new RegExp("^(?:"+t.map(tZe).join("|")+")","i")}function Nb(t){return new Map(t.map((e,n)=>[e.toLowerCase(),n]))}function nZe(t,e,n){var r=Ss.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function rZe(t,e,n){var r=Ss.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function iZe(t,e,n){var r=Ss.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function sZe(t,e,n){var r=Ss.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function aZe(t,e,n){var r=Ss.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function Vq(t,e,n){var r=Ss.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function Hq(t,e,n){var r=Ss.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}
817function oZe(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function lZe(t,e,n){var r=Ss.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function cZe(t,e,n){var r=Ss.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function Wq(t,e,n){var r=Ss.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function uZe(t,e,n){var r=Ss.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Gq(t,e,n){var r=Ss.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function dZe(t,e,n){var r=Ss.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function fZe(t,e,n){var r=Ss.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function hZe(t,e,n){var r=Ss.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function pZe(t,e,n){var r=Ss.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function mZe(t,e,n){var r=ZJe.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function gZe(t,e,n){var r=Ss.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function xZe(t,e,n){var r=Ss.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function qq(t,e){return Wn(t.getDate(),e,2)}function yZe(t,e){return Wn(t.getHours(),e,2)}function vZe(t,e){return Wn(t.getHours()%12||12,e,2)}function bZe(t,e){return Wn(1+qS.count(kd(t),t),e,3)}function ode(t,e){return Wn(t.getMilliseconds(),e,3)}function wZe(t,e){return ode(t,e)+"000"}function _Ze(t,e){return Wn(t.getMonth()+1,e,2)}function SZe(t,e){return Wn(t.getMinutes(),e,2)}function NZe(t,e){return Wn(t.getSeconds(),e,2)}function jZe(t){var e=t.getDay();return e===0?7:e}function CZe(t,e){return Wn(NM.count(kd(t)-1,t),e,2)}function lde(t){var e=t.getDay();return e>=4||e===0?_v(t):_v.ceil(t)}function kZe(t,e){return t=lde(t),Wn(_v.count(kd(t),t)+(kd(t).getDay()===4),e,2)}function EZe(t){return t.getDay()}function AZe(t,e){return Wn(M2.count(kd(t)-1,t),e,2)}function TZe(t,e){return Wn(t.getFullYear()%100,e,2)}function MZe(t,e){return t=lde(t),Wn(t.getFullYear()%100,e,2)}function PZe(t,e){return Wn(t.getFullYear()%1e4,e,4)}function OZe(t,e){var n=t.getDay();return t=n>=4||n===0?_v(t):_v.ceil(t),Wn(t.getFullYear()%1e4,e,4)}function RZe(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Wn(e/60|0,"0",2)+Wn(e%60,"0",2)}function Kq(t,e){return Wn(t.getUTCDate(),e,2)}function IZe(t,e){return Wn(t.getUTCHours(),e,2)}function DZe(t,e){return Wn(t.getUTCHours()%12||12,e,2)}function LZe(t,e){return Wn(1+SM.count(Ed(t),t),e,3)}function cde(t,e){return Wn(t.getUTCMilliseconds(),e,3)}function $Ze(t,e){return cde(t,e)+"000"}function FZe(t,e){return Wn(t.getUTCMonth()+1,e,2)}function UZe(t,e){return Wn(t.getUTCMinutes(),e,2)}function zZe(t,e){return Wn(t.getUTCSeconds(),e,2)}function BZe(t){var e=t.getUTCDay();return e===0?7:e}function VZe(t,e){return Wn(jM.count(Ed(t)-1,t),e,2)}function ude(t){var e=t.getUTCDay();return e>=4||e===0?Sv(t):Sv.ceil(t)}function HZe(t,e){return t=ude(t),Wn(Sv.count(Ed(t),t)+(Ed(t).getUTCDay()===4),e,2)}function WZe(t){return t.getUTCDay()}function GZe(t,e){return Wn(P2.count(Ed(t)-1,t),e,2)}function qZe(t,e){return Wn(t.getUTCFullYear()%100,e,2)}function KZe(t,e){return t=ude(t),Wn(t.getUTCFullYear()%100,e,2)}function YZe(t,e){return Wn(t.getUTCFullYear()%1e4,e,4)}function XZe(t,e){var n=t.getUTCDay();return t=n>=4||n===0?Sv(t):Sv.ceil(t),Wn(t.getUTCFullYear()%1e4,e,4)}function QZe(){return"+0000"}function Yq(){return"%"}function Xq(t){return+t}function Qq(t){return Math.floor(+t/1e3)}var ix,dde,fde;JZe({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function JZe(t){return ix=JJe(t),dde=ix.format,ix.parse,fde=ix.utcFormat,ix.utcParse,ix}function ZZe(t){return new Date(t)}function eet(t){return t instanceof Date?+t:+new Date(+t)}function bB(t,e,n,r,i,s,a,l,c,u){var d=aB(),f=d.invert,h=d.domain,p=u(".%L"),m=u(":%S"),x=u("%I:%M"),y=u("%I %p"),g=u("%a %d"),w=u("%b %d"),v=u("%B"),N=u("%Y");function S(_){return(c(_)<_?p:l(_)<_?m:a(_)<_?x:s(_)<_?y:r(_)<_?i(_)<_?g:w:n(_)<_?v:N)(_)}return d.invert=function(_){return new Date(f(_))},d.domain=function(_){return arguments.length?h(Array.from(_,eet)):h().map(ZZe)},d.ticks=function(_){var j=h();return t(j[0],j[j.length-1],_??10)},d.tickFormat=function(_,j){return j==null?S:u(j)},d.nice=function(_){var j=h();return(!_||typeof _.range!="function")&&(_=e(j[0],j[j.length-1],_??10)),_?h(Jue(j,_)):d},d.copy=function(){return GS(d,bB(t,e,n,r,i,s,a,l,c,u))},d}function tet(){return Nl.apply(bB(XJe,QJe,kd,yB,NM,qS,gB,pB,Jp,dde).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function net(){return Nl.apply(bB(KJe,YJe,Ed,vB,jM,SM,xB,mB,Jp,fde).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function CM(){var t=0,e=1,n,r,i,s,a=ha,l=!1,c;function u(f){return f==null||isNaN(f=+f)?c:a(i===0?.5:(f=(s(f)-n)*i,l?Math.max(0,Math.min(1,f)):f))}u.domain=function(f){return arguments.length?([t,e]=f,n=s(t=+t),r=s(e=+e),i=n===r?0:1/(r-n),u):[t,e]},u.clamp=function(f){return arguments.length?(l=!!f,u):l},u.interpolator=function(f){return arguments.length?(a=f,u):a};function d(f){return function(h){var p,m;return arguments.length?([p,m]=h,a=f(p,m),u):[a(0),a(1)]}}return u.range=d(ud),u.rangeRound=d(iB),u.unknown=function(f){return arguments.length?(c=f,u):c},function(f){return s=f,n=f(t),r=f(e),i=n===r?0:1/(r-n),u}}function tp(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function hde(){var t=ep(CM()(ha));return t.copy=function(){return tp(t,hde())},Vd.apply(t,arguments)}function pde(){var t=cB(CM()).domain([1,10]);return t.copy=function(){return tp(t,pde()).base(t.base())},Vd.apply(t,arguments)}function mde(){var t=uB(CM());return t.copy=function(){return tp(t,mde()).constant(t.constant())},Vd.apply(t,arguments)}function wB(){var t=dB(CM());return t.copy=function(){return tp(t,wB()).exponent(t.exponent())},Vd.apply(t,arguments)}function ret(){return wB.apply(null,arguments).exponent(.5)}function gde(){var t=[],e=ha;function n(r){if(r!=null&&!isNaN(r=+r))return e((WS(t,r,1)-1)/(t.length-1))}return n.domain=function(r){if(!arguments.length)return t.slice();t=[];for(let i of r)i!=null&&!isNaN(i=+i)&&t.push(i);return t.sort(ph),n},n.interpolator=function(r){return arguments.length?(e=r,n):e},n.range=function(){return t.map((r,i)=>e(i/(t.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(i,s)=>MQe(t,s/r))},n.copy=function(){return gde(e).domain(t)},Vd.apply(n,arguments)}function kM(){var t=0,e=.5,n=1,r=1,i,s,a,l,c,u=ha,d,f=!1,h;function p(x){return isNaN(x=+x)?h:(x=.5+((x=+d(x))-s)*(r*x<r*s?l:c),u(f?Math.max(0,Math.min(1,x)):x))}p.domain=function(x){return arguments.length?([t,e,n]=x,i=d(t=+t),s=d(e=+e),a=d(n=+n),l=i===s?0:.5/(s-i),c=s===a?0:.5/(a-s),r=s<i?-1:1,p):[t,e,n]},p.clamp=function(x){return arguments.length?(f=!!x,p):f},p.interpolator=function(x){return arguments.length?(u=x,p):u};function m(x){return function(y){var g,w,v;return arguments.length?([g,w,v]=y,u=mJe(x,[g,w,v]),p):[u(0),u(.5),u(1)]}}return p.range=m(ud),p.rangeRound=m(iB),p.unknown=function(x){return arguments.length?(h=x,p):h},function(x){return d=x,i=x(t),s=x(e),a=x(n),l=i===s?0:.5/(s-i),c=s===a?0:.5/(a-s),r=s<i?-1:1,p}}function xde(){var t=ep(kM()(ha));return t.copy=function(){return tp(t,xde())},Vd.apply(t,arguments)}function yde(){var t=cB(kM()).domain([.1,1,10]);return t.copy=function(){return tp(t,yde()).base(t.base())},Vd.apply(t,arguments)}function vde(){var t=uB(kM());return t.copy=function(){return tp(t,vde()).constant(t.constant())},Vd.apply(t,arguments)}function _B(){var t=dB(kM());return t.copy=function(){return tp(t,_B()).exponent(t.exponent())},Vd.apply(t,arguments)}function iet(){return _B.apply(null,arguments).exponent(.5)}const Jq=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:s_,scaleDiverging:xde,scaleDivergingLog:yde,scaleDivergingPow:_B,scaleDivergingSqrt:iet,scaleDivergingSymlog:vde,scaleIdentity:Que,scaleImplicit:WL,scaleLinear:Ym,scaleLog:Zue,scaleOrdinal:qf,scalePoint:mh,scalePow:fB,scaleQuantile:nde,scaleQuantize:rde,scaleRadial:tde,scaleSequential:hde,scaleSequentialLog:pde,scaleSequentialPow:wB,scaleSequentialQuantile:gde,scaleSequentialSqrt:ret,scaleSequentialSymlog:mde,scaleSqrt:$Je,scaleSymlog:ede,scaleThreshold:ide,scaleTime:tet,scaleUtc:net,tickFormat:Xue},Symbol.toStringTag,{value:"Module"}));var set=O0;function aet(t,e,n){for(var r=-1,i=t.length;++r<i;){var s=t[r],a=e(s);if(a!=null&&(l===void 0?a===a&&!set(a):n(a,l)))var l=a,c=s}return c}var EM=aet;function oet(t,e){return t>e}var bde=oet,cet=EM,uet=bde,det=z0;function fet(t){return t&&t.length?cet(t,det,uet):void 0}var het=fet;const Kf=An(het);function pet(t,e){return t<e}var wde=pet,met=EM,get=wde,xet=z0;function yet(t){return t&&t.length?met(t,xet,get):void 0}var vet=yet;const AM=An(vet);var bet=QT,wet=bu,_et=Sue,Net=ja;function jet(t,e){var n=Net(t)?bet:_et;return n(t,wet(e))}var Cet=jet,ket=K6,Eet=Cet;function Aet(t,e){return ket(Eet(t,e),1)}var Tet=Aet;const Met=An(Tet);var Pet=q6;function Oet(t,e){return Pet(t,e)}var Ret=Oet;const Rh=An(Ret);
vendor: 178,187 bytes, lines 817-866
817var H0=1e9,Iet={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},NB,Xr=!0,xl="[DecimalError] ",Nm=xl+"Invalid argument: ",SB=xl+"Exponent out of range: ",W0=Math.floor,Op=Math.pow,Det=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,po,us=1e7,Br=7,_de=9007199254740991,O2=W0(_de/Br),xt={};xt.absoluteValue=xt.abs=function(){var t=new this.constructor(this);return t.s&&(t.s=1),t};xt.comparedTo=xt.cmp=function(t){var e,n,r,i,s=this;if(t=new s.constructor(t),s.s!==t.s)return s.s||-t.s;if(s.e!==t.e)return s.e>t.e^s.s<0?1:-1;for(r=s.d.length,i=t.d.length,e=0,n=r<i?r:i;e<n;++e)if(s.d[e]!==t.d[e])return s.d[e]>t.d[e]^s.s<0?1:-1;return r===i?0:r>i^s.s<0?1:-1};xt.decimalPlaces=xt.dp=function(){var t=this,e=t.d.length-1,n=(e-t.e)*Br;if(e=t.d[e],e)for(;e%10==0;e/=10)n--;return n<0?0:n};xt.dividedBy=xt.div=function(t){return dd(this,new this.constructor(t))};xt.dividedToIntegerBy=xt.idiv=function(t){var e=this,n=e.constructor;return wr(dd(e,new n(t),0,1),n.precision)};xt.equals=xt.eq=function(t){return!this.cmp(t)};xt.exponent=function(){return Pi(this)};xt.greaterThan=xt.gt=function(t){return this.cmp(t)>0};xt.greaterThanOrEqualTo=xt.gte=function(t){return this.cmp(t)>=0};xt.isInteger=xt.isint=function(){return this.e>this.d.length-2};xt.isNegative=xt.isneg=function(){return this.s<0};xt.isPositive=xt.ispos=function(){return this.s>0};xt.isZero=function(){return this.s===0};xt.lessThan=xt.lt=function(t){return this.cmp(t)<0};xt.lessThanOrEqualTo=xt.lte=function(t){return this.cmp(t)<1};xt.logarithm=xt.log=function(t){var e,n=this,r=n.constructor,i=r.precision,s=i+5;if(t===void 0)t=new r(10);else if(t=new r(t),t.s<1||t.eq(po))throw Error(xl+"NaN");if(n.s<1)throw Error(xl+(n.s?"NaN":"-Infinity"));return n.eq(po)?new r(0):(Xr=!1,e=dd(c_(n,s),c_(t,s),s),Xr=!0,wr(e,i))};xt.minus=xt.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?jde(e,t):Sde(e,(t.s=-t.s,t))};xt.modulo=xt.mod=function(t){var e,n=this,r=n.constructor,i=r.precision;if(t=new r(t),!t.s)throw Error(xl+"NaN");return n.s?(Xr=!1,e=dd(n,t,0,1).times(t),Xr=!0,n.minus(e)):wr(new r(n),i)};xt.naturalExponential=xt.exp=function(){return Nde(this)};xt.naturalLogarithm=xt.ln=function(){return c_(this)};xt.negated=xt.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t};xt.plus=xt.add=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?Sde(e,t):jde(e,(t.s=-t.s,t))};xt.precision=xt.sd=function(t){var e,n,r,i=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(Nm+t);if(e=Pi(i)+1,r=i.d.length-1,n=r*Br+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return t&&e>n?e:n};xt.squareRoot=xt.sqrt=function(){var t,e,n,r,i,s,a,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(xl+"NaN")}for(t=Pi(l),Xr=!1,i=Math.sqrt(+l),i==0||i==1/0?(e=Bc(l.d),(e.length+t)%2==0&&(e+="0"),i=Math.sqrt(e),t=W0((t+1)/2)-(t<0||t%2),i==1/0?e="5e"+t:(e=i.toExponential(),e=e.slice(0,e.indexOf("e")+1)+t),r=new c(e)):r=new c(i.toString()),n=c.precision,i=a=n+3;;)if(s=r,r=s.plus(dd(l,s,a+2)).times(.5),Bc(s.d).slice(0,a)===(e=Bc(r.d)).slice(0,a)){if(e=e.slice(a-3,a+1),i==a&&e=="4999"){if(wr(s,n+1,0),s.times(s).eq(l)){r=s;break}}else if(e!="9999")break;a+=4}return Xr=!0,wr(r,n)};xt.times=xt.mul=function(t){var e,n,r,i,s,a,l,c,u,d=this,f=d.constructor,h=d.d,p=(t=new f(t)).d;if(!d.s||!t.s)return new f(0);for(t.s*=d.s,n=d.e+t.e,c=h.length,u=p.length,c<u&&(s=h,h=p,p=s,a=c,c=u,u=a),s=[],a=c+u,r=a;r--;)s.push(0);for(r=u;--r>=0;){for(e=0,i=c+r;i>r;)l=s[i]+p[r]*h[i-r-1]+e,s[i--]=l%us|0,e=l/us|0;s[i]=(s[i]+e)%us|0}for(;!s[--a];)s.pop();return e?++n:s.shift(),t.d=s,t.e=n,Xr?wr(t,f.precision):t};xt.toDecimalPlaces=xt.todp=function(t,e){var n=this,r=n.constructor;return n=new r(n),t===void 0?n:(uu(t,0,H0),e===void 0?e=r.rounding:uu(e,0,8),wr(n,t+Pi(n)+1,e))};xt.toExponential=function(t,e){var n,r=this,i=r.constructor;return t===void 0?n=Xm(r,!0):(uu(t,0,H0),e===void 0?e=i.rounding:uu(e,0,8),r=wr(new i(r),t+1,e),n=Xm(r,!0,t+1)),n};xt.toFixed=function(t,e){var n,r,i=this,s=i.constructor;return t===void 0?Xm(i):(uu(t,0,H0),e===void 0?e=s.rounding:uu(e,0,8),r=wr(new s(i),t+Pi(i)+1,e),n=Xm(r.abs(),!1,t+Pi(r)+1),i.isneg()&&!i.isZero()?"-"+n:n)};xt.toInteger=xt.toint=function(){var t=this,e=t.constructor;return wr(new e(t),Pi(t)+1,e.rounding)};xt.toNumber=function(){return+this};xt.toPower=xt.pow=function(t){var e,n,r,i,s,a,l=this,c=l.constructor,u=12,d=+(t=new c(t));if(!t.s)return new c(po);if(l=new c(l),!l.s){if(t.s<1)throw Error(xl+"Infinity");return l}if(l.eq(po))return l;if(r=c.precision,t.eq(po))return wr(l,r);if(e=t.e,n=t.d.length-1,a=e>=n,s=l.s,a){if((n=d<0?-d:d)<=_de){for(i=new c(po),e=Math.ceil(r/Br+4),Xr=!1;n%2&&(i=i.times(l),eK(i.d,e)),n=W0(n/2),n!==0;)l=l.times(l),eK(l.d,e);return Xr=!0,t.s<0?new c(po).div(i):wr(i,r)}}else if(s<0)throw Error(xl+"NaN");return s=s<0&&t.d[Math.max(e,n)]&1?-1:1,l.s=1,Xr=!1,i=t.times(c_(l,r+u)),Xr=!0,i=Nde(i),i.s=s,i};xt.toPrecision=function(t,e){var n,r,i=this,s=i.constructor;return t===void 0?(n=Pi(i),r=Xm(i,n<=s.toExpNeg||n>=s.toExpPos)):(uu(t,1,H0),e===void 0?e=s.rounding:uu(e,0,8),i=wr(new s(i),t,e),n=Pi(i),r=Xm(i,t<=n||n<=s.toExpNeg,t)),r};xt.toSignificantDigits=xt.tosd=function(t,e){var n=this,r=n.constructor;return t===void 0?(t=r.precision,e=r.rounding):(uu(t,1,H0),e===void 0?e=r.rounding:uu(e,0,8)),wr(new r(n),t,e)};xt.toString=xt.valueOf=xt.val=xt.toJSON=xt[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=Pi(t),n=t.constructor;return Xm(t,e<=n.toExpNeg||e>=n.toExpPos)};function Sde(t,e){var n,r,i,s,a,l,c,u,d=t.constructor,f=d.precision;if(!t.s||!e.s)return e.s||(e=new d(t)),Xr?wr(e,f):e;if(c=t.d,u=e.d,a=t.e,i=e.e,c=c.slice(),s=a-i,s){for(s<0?(r=c,s=-s,l=u.length):(r=u,i=a,l=c.length),a=Math.ceil(f/Br),l=a>l?a+1:l+1,s>l&&(s=l,r.length=1),r.reverse();s--;)r.push(0);r.reverse()}for(l=c.length,s=u.length,l-s<0&&(s=l,r=u,u=c,c=r),n=0;s;)n=(c[--s]=c[s]+u[s]+n)/us|0,c[s]%=us;for(n&&(c.unshift(n),++i),l=c.length;c[--l]==0;)c.pop();return e.d=c,e.e=i,Xr?wr(e,f):e}function uu(t,e,n){if(t!==~~t||t<e||t>n)throw Error(Nm+t)}function Bc(t){var e,n,r,i=t.length-1,s="",a=t[0];if(i>0){for(s+=a,e=1;e<i;e++)r=t[e]+"",n=Br-r.length,n&&(s+=bf(n)),s+=r;a=t[e],r=a+"",n=Br-r.length,n&&(s+=bf(n))}else if(a===0)return"0";for(;a%10===0;)a/=10;return s+a}var dd=function(){function t(r,i){var s,a=0,l=r.length;for(r=r.slice();l--;)s=r[l]*i+a,r[l]=s%us|0,a=s/us|0;return a&&r.unshift(a),r}function e(r,i,s,a){var l,c;if(s!=a)c=s>a?1:-1;else for(l=c=0;l<s;l++)if(r[l]!=i[l]){c=r[l]>i[l]?1:-1;break}return c}function n(r,i,s){for(var a=0;s--;)r[s]-=a,a=r[s]<i[s]?1:0,r[s]=a*us+r[s]-i[s];for(;!r[0]&&r.length>1;)r.shift()}return function(r,i,s,a){var l,c,u,d,f,h,p,m,x,y,g,w,v,N,S,_,j,A,C=r.constructor,k=r.s==i.s?1:-1,M=r.d,I=i.d;if(!r.s)return new C(r);if(!i.s)throw Error(xl+"Division by zero");for(c=r.e-i.e,j=I.length,S=M.length,p=new C(k),m=p.d=[],u=0;I[u]==(M[u]||0);)++u;if(I[u]>(M[u]||0)&&--c,s==null?w=s=C.precision:a?w=s+(Pi(r)-Pi(i))+1:w=s,w<0)return new C(0);if(w=w/Br+2|0,u=0,j==1)for(d=0,I=I[0],w++;(u<S||d)&&w--;u++)v=d*us+(M[u]||0),m[u]=v/I|0,d=v%I|0;else{for(d=us/(I[0]+1)|0,d>1&&(I=t(I,d),M=t(M,d),j=I.length,S=M.length),N=j,x=M.slice(0,j),y=x.length;y<j;)x[y++]=0;A=I.slice(),A.unshift(0),_=I[0],I[1]>=us/2&&++_;do d=0,l=e(I,x,j,y),l<0?(g=x[0],j!=y&&(g=g*us+(x[1]||0)),d=g/_|0,d>1?(d>=us&&(d=us-1),f=t(I,d),h=f.length,y=x.length,l=e(f,x,h,y),l==1&&(d--,n(f,j<h?A:I,h))):(d==0&&(l=d=1),f=I.slice()),h=f.length,h<y&&f.unshift(0),n(x,f,y),l==-1&&(y=x.length,l=e(I,x,j,y),l<1&&(d++,n(x,j<y?A:I,y))),y=x.length):l===0&&(d++,x=[0]),m[u++]=d,l&&x[0]?x[y++]=M[N]||0:(x=[M[N]],y=1);while((N++<S||x[0]!==void 0)&&w--)}return m[0]||m.shift(),p.e=c,wr(p,a?s+Pi(p)+1:s)}}();function Nde(t,e){var n,r,i,s,a,l,c=0,u=0,d=t.constructor,f=d.precision;if(Pi(t)>16)throw Error(SB+Pi(t));if(!t.s)return new d(po);for(Xr=!1,l=f,a=new d(.03125);t.abs().gte(.1);)t=t.times(a),u+=5;for(r=Math.log(Op(2,u))/Math.LN10*2+5|0,l+=r,n=i=s=new d(po),d.precision=l;;){if(i=wr(i.times(t),l),n=n.times(++c),a=s.plus(dd(i,n,l)),Bc(a.d).slice(0,l)===Bc(s.d).slice(0,l)){for(;u--;)s=wr(s.times(s),l);return d.precision=f,e==null?(Xr=!0,wr(s,f)):s}s=a}}function Pi(t){for(var e=t.e*Br,n=t.d[0];n>=10;n/=10)e++;return e}function aI(t,e,n){if(e>t.LN10.sd())throw Xr=!0,n&&(t.precision=n),Error(xl+"LN10 precision limit exceeded");return wr(new t(t.LN10),e)}function bf(t){for(var e="";t--;)e+="0";return e}function c_(t,e){var n,r,i,s,a,l,c,u,d,f=1,h=10,p=t,m=p.d,x=p.constructor,y=x.precision;if(p.s<1)throw Error(xl+(p.s?"NaN":"-Infinity"));if(p.eq(po))return new x(0);if(e==null?(Xr=!1,u=y):u=e,p.eq(10))return e==null&&(Xr=!0),aI(x,u);if(u+=h,x.precision=u,n=Bc(m),r=n.charAt(0),s=Pi(p),Math.abs(s)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)p=p.times(t),n=Bc(p.d),r=n.charAt(0),f++;s=Pi(p),r>1?(p=new x("0."+n),s++):p=new x(r+"."+n.slice(1))}else return c=aI(x,u+2,y).times(s+""),p=c_(new x(r+"."+n.slice(1)),u-h).plus(c),x.precision=y,e==null?(Xr=!0,wr(p,y)):p;for(l=a=p=dd(p.minus(po),p.plus(po),u),d=wr(p.times(p),u),i=3;;){if(a=wr(a.times(d),u),c=l.plus(dd(a,new x(i),u)),Bc(c.d).slice(0,u)===Bc(l.d).slice(0,u))return l=l.times(2),s!==0&&(l=l.plus(aI(x,u+2,y).times(s+""))),l=dd(l,new x(f),u),x.precision=y,e==null?(Xr=!0,wr(l,y)):l;l=c,i+=2}}function Zq(t,e){var n,r,i;for((n=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(n<0&&(n=r),n+=+e.slice(r+1),e=e.substring(0,r)):n<0&&(n=e.length),r=0;e.charCodeAt(r)===48;)++r;for(i=e.length;e.charCodeAt(i-1)===48;)--i;if(e=e.slice(r,i),e){if(i-=r,n=n-r-1,t.e=W0(n/Br),t.d=[],r=(n+1)%Br,n<0&&(r+=Br),r<i){for(r&&t.d.push(+e.slice(0,r)),i-=Br;r<i;)t.d.push(+e.slice(r,r+=Br));e=e.slice(r),r=Br-e.length}else r-=i;for(;r--;)e+="0";if(t.d.push(+e),Xr&&(t.e>O2||t.e<-O2))throw Error(SB+n)}else t.s=0,t.e=0,t.d=[0];return t}function wr(t,e,n){var r,i,s,a,l,c,u,d,f=t.d;for(a=1,s=f[0];s>=10;s/=10)a++;if(r=e-a,r<0)r+=Br,i=e,u=f[d=0];else{if(d=Math.ceil((r+1)/Br),s=f.length,d>=s)return t;for(u=s=f[d],a=1;s>=10;s/=10)a++;r%=Br,i=r-Br+a}if(n!==void 0&&(s=Op(10,a-i-1),l=u/s%10|0,c=e<0||f[d+1]!==void 0||u%s,c=n<4?(l||c)&&(n==0||n==(t.s<0?3:2)):l>5||l==5&&(n==4||c||n==6&&(r>0?i>0?u/Op(10,a-i):0:f[d-1])%10&1||n==(t.s<0?8:7))),e<1||!f[0])return c?(s=Pi(t),f.length=1,e=e-s-1,f[0]=Op(10,(Br-e%Br)%Br),t.e=W0(-e/Br)||0):(f.length=1,f[0]=t.e=t.s=0),t;if(r==0?(f.length=d,s=1,d--):(f.length=d+1,s=Op(10,Br-r),f[d]=i>0?(u/Op(10,a-i)%Op(10,i)|0)*s:0),c)for(;;)if(d==0){(f[0]+=s)==us&&(f[0]=1,++t.e);break}else{if(f[d]+=s,f[d]!=us)break;f[d--]=0,s=1}for(r=f.length;f[--r]===0;)f.pop();if(Xr&&(t.e>O2||t.e<-O2))throw Error(SB+Pi(t));return t}function jde(t,e){var n,r,i,s,a,l,c,u,d,f,h=t.constructor,p=h.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new h(t),Xr?wr(e,p):e;if(c=t.d,f=e.d,r=e.e,u=t.e,c=c.slice(),a=u-r,a){for(d=a<0,d?(n=c,a=-a,l=f.length):(n=f,r=u,l=c.length),i=Math.max(Math.ceil(p/Br),l)+2,a>i&&(a=i,n.length=1),n.reverse(),i=a;i--;)n.push(0);n.reverse()}else{for(i=c.length,l=f.length,d=i<l,d&&(l=i),i=0;i<l;i++)if(c[i]!=f[i]){d=c[i]<f[i];break}a=0}for(d&&(n=c,c=f,f=n,e.s=-e.s),l=c.length,i=f.length-l;i>0;--i)c[l++]=0;for(i=f.length;i>a;){if(c[--i]<f[i]){for(s=i;s&&c[--s]===0;)c[s]=us-1;--c[s],c[i]+=us}c[i]-=f[i]}for(;c[--l]===0;)c.pop();for(;c[0]===0;c.shift())--r;return c[0]?(e.d=c,e.e=r,Xr?wr(e,p):e):new h(0)}function Xm(t,e,n){var r,i=Pi(t),s=Bc(t.d),a=s.length;return e?(n&&(r=n-a)>0?s=s.charAt(0)+"."+s.slice(1)+bf(r):a>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(i<0?"e":"e+")+i):i<0?(s="0."+bf(-i-1)+s,n&&(r=n-a)>0&&(s+=bf(r))):i>=a?(s+=bf(i+1-a),n&&(r=n-i-1)>0&&(s=s+"."+bf(r))):((r=i+1)<a&&(s=s.slice(0,r)+"."+s.slice(r)),n&&(r=n-a)>0&&(i+1===a&&(s+="."),s+=bf(r))),t.s<0?"-"+s:s}function eK(t,e){if(t.length>e)return t.length=e,!0}function Cde(t){var e,n,r;function i(s){var a=this;if(!(a instanceof i))return new i(s);if(a.constructor=i,s instanceof i){a.s=s.s,a.e=s.e,a.d=(s=s.d)?s.slice():s;return}if(typeof s=="number"){if(s*0!==0)throw Error(Nm+s);if(s>0)a.s=1;else if(s<0)s=-s,a.s=-1;else{a.s=0,a.e=0,a.d=[0];return}if(s===~~s&&s<1e7){a.e=0,a.d=[s];return}return Zq(a,s.toString())}else if(typeof s!="string")throw Error(Nm+s);if(s.charCodeAt(0)===45?(s=s.slice(1),a.s=-1):a.s=1,Det.test(s))Zq(a,s);else throw Error(Nm+s)}if(i.prototype=xt,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=Cde,i.config=i.set=Let,t===void 0&&(t={}),t)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],e=0;e<r.length;)t.hasOwnProperty(n=r[e++])||(t[n]=this[n]);return i.config(t),i}function Let(t){if(!t||typeof t!="object")throw Error(xl+"Object expected");var e,n,r,i=["precision",1,H0,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(e=0;e<i.length;e+=3)if((r=t[n=i[e]])!==void 0)if(W0(r)===r&&r>=i[e+1]&&r<=i[e+2])this[n]=r;else throw Error(Nm+n+": "+r);if((r=t[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(Nm+n+": "+r);return this}var NB=Cde(Iet);po=new NB(1);const or=NB;function $et(t){return Bet(t)||zet(t)||Uet(t)||Fet()}function Fet(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
818In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Uet(t,e){if(t){if(typeof t=="string")return YL(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return YL(t,e)}}function zet(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}function Bet(t){if(Array.isArray(t))return YL(t)}function YL(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var Vet=function(e){return e},kde={},Ede=function(e){return e===kde},tK=function(e){return function n(){return arguments.length===0||arguments.length===1&&Ede(arguments.length<=0?void 0:arguments[0])?n:e.apply(void 0,arguments)}},Het=function t(e,n){return e===1?n:tK(function(){for(var r=arguments.length,i=new Array(r),s=0;s<r;s++)i[s]=arguments[s];var a=i.filter(function(l){return l!==kde}).length;return a>=e?n.apply(void 0,i):t(e-a,tK(function(){for(var l=arguments.length,c=new Array(l),u=0;u<l;u++)c[u]=arguments[u];var d=i.map(function(f){return Ede(f)?c.shift():f});return n.apply(void 0,$et(d).concat(c))}))})},TM=function(e){return Het(e.length,e)},XL=function(e,n){for(var r=[],i=e;i<n;++i)r[i-e]=i;return r},Wet=TM(function(t,e){return Array.isArray(e)?e.map(t):Object.keys(e).map(function(n){return e[n]}).map(t)}),Get=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];if(!n.length)return Vet;var i=n.reverse(),s=i[0],a=i.slice(1);return function(){return a.reduce(function(l,c){return c(l)},s.apply(void 0,arguments))}},QL=function(e){return Array.isArray(e)?e.reverse():e.split("").reverse.join("")},Ade=function(e){var n=null,r=null;return function(){for(var i=arguments.length,s=new Array(i),a=0;a<i;a++)s[a]=arguments[a];return n&&s.every(function(l,c){return l===n[c]})||(n=s,r=e.apply(void 0,s)),r}};function qet(t){var e;return t===0?e=1:e=Math.floor(new or(t).abs().log(10).toNumber())+1,e}function Ket(t,e,n){for(var r=new or(t),i=0,s=[];r.lt(e)&&i<1e5;)s.push(r.toNumber()),r=r.add(n),i++;return s}var Yet=TM(function(t,e,n){var r=+t,i=+e;return r+n*(i-r)}),Xet=TM(function(t,e,n){var r=e-+t;return r=r||1/0,(n-t)/r}),Qet=TM(function(t,e,n){var r=e-+t;return r=r||1/0,Math.max(0,Math.min(1,(n-t)/r))});const MM={rangeStep:Ket,getDigitCount:qet,interpolateNumber:Yet,uninterpolateNumber:Xet,uninterpolateTruncation:Qet};function JL(t){return ett(t)||Zet(t)||Tde(t)||Jet()}function Jet(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
819In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Zet(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}function ett(t){if(Array.isArray(t))return ZL(t)}function u_(t,e){return rtt(t)||ntt(t,e)||Tde(t,e)||ttt()}function ttt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
820In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Tde(t,e){if(t){if(typeof t=="string")return ZL(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ZL(t,e)}}function ZL(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function ntt(t,e){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(t)))){var n=[],r=!0,i=!1,s=void 0;try{for(var a=t[Symbol.iterator](),l;!(r=(l=a.next()).done)&&(n.push(l.value),!(e&&n.length===e));r=!0);}catch(c){i=!0,s=c}finally{try{!r&&a.return!=null&&a.return()}finally{if(i)throw s}}return n}}function rtt(t){if(Array.isArray(t))return t}function Mde(t){var e=u_(t,2),n=e[0],r=e[1],i=n,s=r;return n>r&&(i=r,s=n),[i,s]}function Pde(t,e,n){if(t.lte(0))return new or(0);var r=MM.getDigitCount(t.toNumber()),i=new or(10).pow(r),s=t.div(i),a=r!==1?.05:.1,l=new or(Math.ceil(s.div(a).toNumber())).add(n).mul(a),c=l.mul(i);return e?c:new or(Math.ceil(c))}function itt(t,e,n){var r=1,i=new or(t);if(!i.isint()&&n){var s=Math.abs(t);s<1?(r=new or(10).pow(MM.getDigitCount(t)-1),i=new or(Math.floor(i.div(r).toNumber())).mul(r)):s>1&&(i=new or(Math.floor(t)))}else t===0?i=new or(Math.floor((e-1)/2)):n||(i=new or(Math.floor(t)));var a=Math.floor((e-1)/2),l=Get(Wet(function(c){return i.add(new or(c-a).mul(r)).toNumber()}),XL);return l(0,e)}function Ode(t,e,n,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((e-t)/(n-1)))return{step:new or(0),tickMin:new or(0),tickMax:new or(0)};var s=Pde(new or(e).sub(t).div(n-1),r,i),a;t<=0&&e>=0?a=new or(0):(a=new or(t).add(e).div(2),a=a.sub(new or(a).mod(s)));var l=Math.ceil(a.sub(t).div(s).toNumber()),c=Math.ceil(new or(e).sub(a).div(s).toNumber()),u=l+c+1;return u>n?Ode(t,e,n,r,i+1):(u<n&&(c=e>0?c+(n-u):c,l=e>0?l:l+(n-u)),{step:s,tickMin:a.sub(new or(l).mul(s)),tickMax:a.add(new or(c).mul(s))})}function stt(t){var e=u_(t,2),n=e[0],r=e[1],i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=Math.max(i,2),l=Mde([n,r]),c=u_(l,2),u=c[0],d=c[1];if(u===-1/0||d===1/0){var f=d===1/0?[u].concat(JL(XL(0,i-1).map(function(){return 1/0}))):[].concat(JL(XL(0,i-1).map(function(){return-1/0})),[d]);return n>r?QL(f):f}if(u===d)return itt(u,i,s);var h=Ode(u,d,a,s),p=h.step,m=h.tickMin,x=h.tickMax,y=MM.rangeStep(m,x.add(new or(.1).mul(p)),p);return n>r?QL(y):y}function att(t,e){var n=u_(t,2),r=n[0],i=n[1],s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=Mde([r,i]),l=u_(a,2),c=l[0],u=l[1];if(c===-1/0||u===1/0)return[r,i];if(c===u)return[c];var d=Math.max(e,2),f=Pde(new or(u).sub(c).div(d-1),s,0),h=[].concat(JL(MM.rangeStep(new or(c),new or(u).sub(new or(.99).mul(f)),f)),[u]);return r>i?QL(h):h}var ott=Ade(stt),ltt=Ade(att),ctt="Invariant failed";function Qm(t,e){throw new Error(ctt)}var utt=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function Nv(t){"@babel/helpers - typeof";return Nv=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},Nv(t)}function R2(){return R2=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},R2.apply(this,arguments)}function dtt(t,e){return mtt(t)||ptt(t,e)||htt(t,e)||ftt()}function ftt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
821In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function htt(t,e){if(t){if(typeof t=="string")return nK(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return nK(t,e)}}function nK(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function ptt(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,a,l=[],c=!0,u=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(c=(r=s.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,i=d}finally{try{if(!c&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return l}}function mtt(t){if(Array.isArray(t))return t}function gtt(t,e){if(t==null)return{};var n=xtt(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function xtt(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function ytt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function vtt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Dde(r.key),r)}}function btt(t,e,n){return e&&vtt(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function wtt(t,e,n){return e=I2(e),_tt(t,Rde()?Reflect.construct(e,n||[],I2(t).constructor):e.apply(t,n))}function _tt(t,e){if(e&&(Nv(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Stt(t)}function Stt(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Rde(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Rde=function(){return!!t})()}function I2(t){return I2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},I2(t)}function Ntt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&e$(t,e)}function e$(t,e){return e$=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},e$(t,e)}function Ide(t,e,n){return e=Dde(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Dde(t){var e=jtt(t,"string");return Nv(e)=="symbol"?e:e+""}function jtt(t,e){if(Nv(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Nv(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var KS=function(t){function e(){return ytt(this,e),wtt(this,e,arguments)}return Ntt(e,t),btt(e,[{key:"render",value:function(){var r=this.props,i=r.offset,s=r.layout,a=r.width,l=r.dataKey,c=r.data,u=r.dataPointFormatter,d=r.xAxis,f=r.yAxis,h=gtt(r,utt),p=Pt(h,!1);this.props.direction==="x"&&d.type!=="number"&&Qm();var m=c.map(function(x){var y=u(x,l),g=y.x,w=y.y,v=y.value,N=y.errorVal;if(!N)return null;var S=[],_,j;if(Array.isArray(N)){var A=dtt(N,2);_=A[0],j=A[1]}else _=j=N;if(s==="vertical"){var C=d.scale,k=w+i,M=k+a,I=k-a,R=C(v-_),E=C(v+j);S.push({x1:E,y1:M,x2:E,y2:I}),S.push({x1:R,y1:k,x2:E,y2:k}),S.push({x1:R,y1:M,x2:R,y2:I})}else if(s==="horizontal"){var P=f.scale,O=g+i,L=O-a,T=O+a,D=P(v-_),F=P(v+j);S.push({x1:L,y1:F,x2:T,y2:F}),S.push({x1:O,y1:D,x2:O,y2:F}),S.push({x1:L,y1:D,x2:T,y2:D})}return te.createElement(kn,R2({className:"recharts-errorBar",key:"bar-".concat(S.map(function(q){return"".concat(q.x1,"-").concat(q.x2,"-").concat(q.y1,"-").concat(q.y2)}))},p),S.map(function(q){return te.createElement("line",R2({},q,{key:"line-".concat(q.x1,"-").concat(q.x2,"-").concat(q.y1,"-").concat(q.y2)}))}))});return te.createElement(kn,{className:"recharts-errorBars"},m)}}])}(te.Component);Ide(KS,"defaultProps",{stroke:"black",strokeWidth:1.5,width:5,offset:0,layout:"horizontal"});Ide(KS,"displayName","ErrorBar");function d_(t){"@babel/helpers - typeof";return d_=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},d_(t)}function rK(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function pp(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?rK(Object(n),!0).forEach(function(r){Ctt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):rK(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Ctt(t,e,n){return e=ktt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ktt(t){var e=Ett(t,"string");return d_(e)=="symbol"?e:e+""}function Ett(t,e){if(d_(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(d_(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Lde=function(e){var n=e.children,r=e.formattedGraphicalItems,i=e.legendWidth,s=e.legendContent,a=lo(n,cd);if(!a)return null;var l=cd.defaultProps,c=l!==void 0?pp(pp({},l),a.props):{},u;return a.props&&a.props.payload?u=a.props&&a.props.payload:s==="children"?u=(r||[]).reduce(function(d,f){var h=f.item,p=f.props,m=p.sectors||p.data||[];return d.concat(m.map(function(x){return{type:a.props.iconType||h.props.legendType,value:x.name,color:x.fill,payload:x}}))},[]):u=(r||[]).map(function(d){var f=d.item,h=f.type.defaultProps,p=h!==void 0?pp(pp({},h),f.props):{},m=p.dataKey,x=p.name,y=p.legendType,g=p.hide;return{inactive:g,dataKey:m,type:c.iconType||y||"square",color:jB(f),value:x||m,payload:p}}),pp(pp(pp({},c),cd.getWithHeight(a,i)),{},{payload:u,item:a})};function f_(t){"@babel/helpers - typeof";return f_=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},f_(t)}function iK(t){return Ptt(t)||Mtt(t)||Ttt(t)||Att()}function Att(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
822In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ttt(t,e){if(t){if(typeof t=="string")return t$(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return t$(t,e)}}function Mtt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Ptt(t){if(Array.isArray(t))return t$(t)}function t$(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function sK(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function di(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?sK(Object(n),!0).forEach(function(r){My(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):sK(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function My(t,e,n){return e=Ott(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ott(t){var e=Rtt(t,"string");return f_(e)=="symbol"?e:e+""}function Rtt(t,e){if(f_(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(f_(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function gi(t,e,n){return nn(t)||nn(e)?n:Xi(e)?vi(t,e,n):Kt(e)?e(t):n}function Bw(t,e,n,r){var i=Met(t,function(l){return gi(l,e)});if(n==="number"){var s=i.filter(function(l){return Qe(l)||parseFloat(l)});return s.length?[AM(s),Kf(s)]:[1/0,-1/0]}var a=r?i.filter(function(l){return!nn(l)}):i;return a.map(function(l){return Xi(l)||l instanceof Date?l:""})}var Itt=function(e){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0,a=-1,l=(n=r==null?void 0:r.length)!==null&&n!==void 0?n:0;if(l<=1)return 0;if(s&&s.axisType==="angleAxis"&&Math.abs(Math.abs(s.range[1]-s.range[0])-360)<=1e-6)for(var c=s.range,u=0;u<l;u++){var d=u>0?i[u-1].coordinate:i[l-1].coordinate,f=i[u].coordinate,h=u>=l-1?i[0].coordinate:i[u+1].coordinate,p=void 0;if(da(f-d)!==da(h-f)){var m=[];if(da(h-f)===da(c[1]-c[0])){p=h;var x=f+c[1]-c[0];m[0]=Math.min(x,(x+d)/2),m[1]=Math.max(x,(x+d)/2)}else{p=d;var y=h+c[1]-c[0];m[0]=Math.min(f,(y+f)/2),m[1]=Math.max(f,(y+f)/2)}var g=[Math.min(f,(p+f)/2),Math.max(f,(p+f)/2)];if(e>g[0]&&e<=g[1]||e>=m[0]&&e<=m[1]){a=i[u].index;break}}else{var w=Math.min(d,h),v=Math.max(d,h);if(e>(w+f)/2&&e<=(v+f)/2){a=i[u].index;break}}}else for(var N=0;N<l;N++)if(N===0&&e<=(r[N].coordinate+r[N+1].coordinate)/2||N>0&&N<l-1&&e>(r[N].coordinate+r[N-1].coordinate)/2&&e<=(r[N].coordinate+r[N+1].coordinate)/2||N===l-1&&e>(r[N].coordinate+r[N-1].coordinate)/2){a=r[N].index;break}return a},jB=function(e){var n,r=e,i=r.type.displayName,s=(n=e.type)!==null&&n!==void 0&&n.defaultProps?di(di({},e.type.defaultProps),e.props):e.props,a=s.stroke,l=s.fill,c;switch(i){case"Line":c=a;break;case"Area":case"Radar":c=a&&a!=="none"?a:l;break;default:c=l;break}return c},Dtt=function(e){var n=e.barSize,r=e.totalSize,i=e.stackGroups,s=i===void 0?{}:i;if(!s)return{};for(var a={},l=Object.keys(s),c=0,u=l.length;c<u;c++)for(var d=s[l[c]].stackGroups,f=Object.keys(d),h=0,p=f.length;h<p;h++){var m=d[f[h]],x=m.items,y=m.cateAxisId,g=x.filter(function(j){return ld(j.type).indexOf("Bar")>=0});if(g&&g.length){var w=g[0].type.defaultProps,v=w!==void 0?di(di({},w),g[0].props):g[0].props,N=v.barSize,S=v[y];a[S]||(a[S]=[]);var _=nn(N)?n:N;a[S].push({item:g[0],stackList:g.slice(1),barSize:nn(_)?void 0:fa(_,r,0)})}}return a},Ltt=function(e){var n=e.barGap,r=e.barCategoryGap,i=e.bandSize,s=e.sizeList,a=s===void 0?[]:s,l=e.maxBarSize,c=a.length;if(c<1)return null;var u=fa(n,i,0,!0),d,f=[];if(a[0].barSize===+a[0].barSize){var h=!1,p=i/c,m=a.reduce(function(N,S){return N+S.barSize||0},0);m+=(c-1)*u,m>=i&&(m-=(c-1)*u,u=0),m>=i&&p>0&&(h=!0,p*=.9,m=c*p);var x=(i-m)/2>>0,y={offset:x-u,size:0};d=a.reduce(function(N,S){var _={item:S.item,position:{offset:y.offset+y.size+u,size:h?p:S.barSize}},j=[].concat(iK(N),[_]);return y=j[j.length-1].position,S.stackList&&S.stackList.length&&S.stackList.forEach(function(A){j.push({item:A,position:y})}),j},f)}else{var g=fa(r,i,0,!0);i-2*g-(c-1)*u<=0&&(u=0);var w=(i-2*g-(c-1)*u)/c;w>1&&(w>>=0);var v=l===+l?Math.min(w,l):w;d=a.reduce(function(N,S,_){var j=[].concat(iK(N),[{item:S.item,position:{offset:g+(w+u)*_+(w-v)/2,size:v}}]);return S.stackList&&S.stackList.length&&S.stackList.forEach(function(A){j.push({item:A,position:j[j.length-1].position})}),j},f)}return d},$tt=function(e,n,r,i){var s=r.children,a=r.width,l=r.margin,c=a-(l.left||0)-(l.right||0),u=Lde({children:s,legendWidth:c});if(u){var d=i||{},f=d.width,h=d.height,p=u.align,m=u.verticalAlign,x=u.layout;if((x==="vertical"||x==="horizontal"&&m==="middle")&&p!=="center"&&Qe(e[p]))return di(di({},e),{},My({},p,e[p]+(f||0)));if((x==="horizontal"||x==="vertical"&&p==="center")&&m!=="middle"&&Qe(e[m]))return di(di({},e),{},My({},m,e[m]+(h||0)))}return e},Ftt=function(e,n,r){return nn(n)?!0:e==="horizontal"?n==="yAxis":e==="vertical"||r==="x"?n==="xAxis":r==="y"?n==="yAxis":!0},$de=function(e,n,r,i,s){var a=n.props.children,l=So(a,KS).filter(function(u){return Ftt(i,s,u.props.direction)});if(l&&l.length){var c=l.map(function(u){return u.props.dataKey});return e.reduce(function(u,d){var f=gi(d,r);if(nn(f))return u;var h=Array.isArray(f)?[AM(f),Kf(f)]:[f,f],p=c.reduce(function(m,x){var y=gi(d,x,0),g=h[0]-Math.abs(Array.isArray(y)?y[0]:y),w=h[1]+Math.abs(Array.isArray(y)?y[1]:y);return[Math.min(g,m[0]),Math.max(w,m[1])]},[1/0,-1/0]);return[Math.min(p[0],u[0]),Math.max(p[1],u[1])]},[1/0,-1/0])}return null},Utt=function(e,n,r,i,s){var a=n.map(function(l){return $de(e,l,r,s,i)}).filter(function(l){return!nn(l)});return a&&a.length?a.reduce(function(l,c){return[Math.min(l[0],c[0]),Math.max(l[1],c[1])]},[1/0,-1/0]):null},Fde=function(e,n,r,i,s){var a=n.map(function(c){var u=c.props.dataKey;return r==="number"&&u&&$de(e,c,u,i)||Bw(e,u,r,s)});if(r==="number")return a.reduce(function(c,u){return[Math.min(c[0],u[0]),Math.max(c[1],u[1])]},[1/0,-1/0]);var l={};return a.reduce(function(c,u){for(var d=0,f=u.length;d<f;d++)l[u[d]]||(l[u[d]]=!0,c.push(u[d]));return c},[])},Ude=function(e,n){return e==="horizontal"&&n==="xAxis"||e==="vertical"&&n==="yAxis"||e==="centric"&&n==="angleAxis"||e==="radial"&&n==="radiusAxis"},zde=function(e,n,r,i){if(i)return e.map(function(c){return c.coordinate});var s,a,l=e.map(function(c){return c.coordinate===n&&(s=!0),c.coordinate===r&&(a=!0),c.coordinate});return s||l.push(n),a||l.push(r),l},nd=function(e,n,r){if(!e)return null;var i=e.scale,s=e.duplicateDomain,a=e.type,l=e.range,c=e.realScaleType==="scaleBand"?i.bandwidth()/2:2,u=(n||r)&&a==="category"&&i.bandwidth?i.bandwidth()/c:0;if(u=e.axisType==="angleAxis"&&(l==null?void 0:l.length)>=2?da(l[0]-l[1])*2*u:u,n&&(e.ticks||e.niceTicks)){var d=(e.ticks||e.niceTicks).map(function(f){var h=s?s.indexOf(f):f;return{coordinate:i(h)+u,value:f,offset:u}});return d.filter(function(f){return!$0(f.coordinate)})}return e.isCategorical&&e.categoricalDomain?e.categoricalDomain.map(function(f,h){return{coordinate:i(f)+u,value:f,index:h,offset:u}}):i.ticks&&!r?i.ticks(e.tickCount).map(function(f){return{coordinate:i(f)+u,value:f,offset:u}}):i.domain().map(function(f,h){return{coordinate:i(f)+u,value:s?s[f]:f,index:h,offset:u}})},oI=new WeakMap,mj=function(e,n){if(typeof n!="function")return e;oI.has(e)||oI.set(e,new WeakMap);var r=oI.get(e);if(r.has(n))return r.get(n);var i=function(){e.apply(void 0,arguments),n.apply(void 0,arguments)};return r.set(n,i),i},Bde=function(e,n,r){var i=e.scale,s=e.type,a=e.layout,l=e.axisType;if(i==="auto")return a==="radial"&&l==="radiusAxis"?{scale:s_(),realScaleType:"band"}:a==="radial"&&l==="angleAxis"?{scale:Ym(),realScaleType:"linear"}:s==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!r)?{scale:mh(),realScaleType:"point"}:s==="category"?{scale:s_(),realScaleType:"band"}:{scale:Ym(),realScaleType:"linear"};if(Ph(i)){var c="scale".concat(uM(i));return{scale:(Jq[c]||mh)(),realScaleType:Jq[c]?c:"point"}}return Kt(i)?{scale:i}:{scale:mh(),realScaleType:"point"}},aK=1e-4,Vde=function(e){var n=e.domain();if(!(!n||n.length<=2)){var r=n.length,i=e.range(),s=Math.min(i[0],i[1])-aK,a=Math.max(i[0],i[1])+aK,l=e(n[0]),c=e(n[r-1]);(l<s||l>a||c<s||c>a)&&e.domain([n[0],n[r-1]])}},ztt=function(e,n){if(!e)return null;for(var r=0,i=e.length;r<i;r++)if(e[r].item===n)return e[r].position;return null},Btt=function(e,n){if(!n||n.length!==2||!Qe(n[0])||!Qe(n[1]))return e;var r=Math.min(n[0],n[1]),i=Math.max(n[0],n[1]),s=[e[0],e[1]];return(!Qe(e[0])||e[0]<r)&&(s[0]=r),(!Qe(e[1])||e[1]>i)&&(s[1]=i),s[0]>i&&(s[0]=i),s[1]<r&&(s[1]=r),s},Vtt=function(e){var n=e.length;if(!(n<=0))for(var r=0,i=e[0].length;r<i;++r)for(var s=0,a=0,l=0;l<n;++l){var c=$0(e[l][r][1])?e[l][r][0]:e[l][r][1];c>=0?(e[l][r][0]=s,e[l][r][1]=s+c,s=e[l][r][1]):(e[l][r][0]=a,e[l][r][1]=a+c,a=e[l][r][1])}},Htt=function(e){var n=e.length;if(!(n<=0))for(var r=0,i=e[0].length;r<i;++r)for(var s=0,a=0;a<n;++a){var l=$0(e[a][r][1])?e[a][r][0]:e[a][r][1];l>=0?(e[a][r][0]=s,e[a][r][1]=s+l,s=e[a][r][1]):(e[a][r][0]=0,e[a][r][1]=0)}},Wtt={sign:Vtt,expand:oVe,none:pv,silhouette:lVe,wiggle:cVe,positive:Htt},Gtt=function(e,n,r){var i=n.map(function(l){return l.props.dataKey}),s=Wtt[r],a=aVe().keys(i).value(function(l,c){return+gi(l,c,0)}).order(CL).offset(s);return a(e)},qtt=function(e,n,r,i,s,a){if(!e)return null;var l=a?n.reverse():n,c={},u=l.reduce(function(f,h){var p,m=(p=h.type)!==null&&p!==void 0&&p.defaultProps?di(di({},h.type.defaultProps),h.props):h.props,x=m.stackId,y=m.hide;if(y)return f;var g=m[r],w=f[g]||{hasStack:!1,stackGroups:{}};if(Xi(x)){var v=w.stackGroups[x]||{numericAxisId:r,cateAxisId:i,items:[]};v.items.push(h),w.hasStack=!0,w.stackGroups[x]=v}else w.stackGroups[Cg("_stackId_")]={numericAxisId:r,cateAxisId:i,items:[h]};return di(di({},f),{},My({},g,w))},c),d={};return Object.keys(u).reduce(function(f,h){var p=u[h];if(p.hasStack){var m={};p.stackGroups=Object.keys(p.stackGroups).reduce(function(x,y){var g=p.stackGroups[y];return di(di({},x),{},My({},y,{numericAxisId:r,cateAxisId:i,items:g.items,stackedData:Gtt(e,g.items,s)}))},m)}return di(di({},f),{},My({},h,p))},d)},Hde=function(e,n){var r=n.realScaleType,i=n.type,s=n.tickCount,a=n.originalDomain,l=n.allowDecimals,c=r||n.scale;if(c!=="auto"&&c!=="linear")return null;if(s&&i==="number"&&a&&(a[0]==="auto"||a[1]==="auto")){var u=e.domain();if(!u.length)return null;var d=ott(u,s,l);return e.domain([AM(d),Kf(d)]),{niceTicks:d}}if(s&&i==="number"){var f=e.domain(),h=ltt(f,s,l);return{niceTicks:h}}return null};function D2(t){var e=t.axis,n=t.ticks,r=t.bandSize,i=t.entry,s=t.index,a=t.dataKey;if(e.type==="category"){if(!e.allowDuplicatedCategory&&e.dataKey&&!nn(i[e.dataKey])){var l=u2(n,"value",i[e.dataKey]);if(l)return l.coordinate+r/2}return n[s]?n[s].coordinate+r/2:null}var c=gi(i,nn(a)?e.dataKey:a);return nn(c)?null:e.scale(c)}var oK=function(e){var n=e.axis,r=e.ticks,i=e.offset,s=e.bandSize,a=e.entry,l=e.index;if(n.type==="category")return r[l]?r[l].coordinate+i:null;var c=gi(a,n.dataKey,n.domain[l]);return nn(c)?null:n.scale(c)-s/2+i},Ktt=function(e){var n=e.numericAxis,r=n.scale.domain();if(n.type==="number"){var i=Math.min(r[0],r[1]),s=Math.max(r[0],r[1]);return i<=0&&s>=0?0:s<0?s:i}return r[0]},Ytt=function(e,n){var r,i=(r=e.type)!==null&&r!==void 0&&r.defaultProps?di(di({},e.type.defaultProps),e.props):e.props,s=i.stackId;if(Xi(s)){var a=n[s];if(a){var l=a.items.indexOf(e);return l>=0?a.stackedData[l]:null}}return null},Xtt=function(e){return e.reduce(function(n,r){return[AM(r.concat([n[0]]).filter(Qe)),Kf(r.concat([n[1]]).filter(Qe))]},[1/0,-1/0])},Wde=function(e,n,r){return Object.keys(e).reduce(function(i,s){var a=e[s],l=a.stackedData,c=l.reduce(function(u,d){var f=Xtt(d.slice(n,r+1));return[Math.min(u[0],f[0]),Math.max(u[1],f[1])]},[1/0,-1/0]);return[Math.min(c[0],i[0]),Math.max(c[1],i[1])]},[1/0,-1/0]).map(function(i){return i===1/0||i===-1/0?0:i})},lK=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,cK=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,n$=function(e,n,r){if(Kt(e))return e(n,r);if(!Array.isArray(e))return n;var i=[];if(Qe(e[0]))i[0]=r?e[0]:Math.min(e[0],n[0]);else if(lK.test(e[0])){var s=+lK.exec(e[0])[1];i[0]=n[0]-s}else Kt(e[0])?i[0]=e[0](n[0]):i[0]=n[0];if(Qe(e[1]))i[1]=r?e[1]:Math.max(e[1],n[1]);else if(cK.test(e[1])){var a=+cK.exec(e[1])[1];i[1]=n[1]+a}else Kt(e[1])?i[1]=e[1](n[1]):i[1]=n[1];return i},L2=function(e,n,r){if(e&&e.scale&&e.scale.bandwidth){var i=e.scale.bandwidth();if(!r||i>0)return i}if(e&&n&&n.length>=2){for(var s=Q6(n,function(f){return f.coordinate}),a=1/0,l=1,c=s.length;l<c;l++){var u=s[l],d=s[l-1];a=Math.min((u.coordinate||0)-(d.coordinate||0),a)}return a===1/0?0:a}return r?void 0:0},uK=function(e,n,r){return!e||!e.length||Rh(e,vi(r,"type.defaultProps.domain"))?n:e},Gde=function(e,n){var r=e.type.defaultProps?di(di({},e.type.defaultProps),e.props):e.props,i=r.dataKey,s=r.name,a=r.unit,l=r.formatter,c=r.tooltipType,u=r.chartType,d=r.hide;return di(di({},Pt(e,!1)),{},{dataKey:i,unit:a,formatter:l,name:s||i,color:jB(e),value:gi(n,i),type:c,payload:n,chartType:u,hide:d})};function h_(t){"@babel/helpers - typeof";return h_=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},h_(t)}function dK(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function zu(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?dK(Object(n),!0).forEach(function(r){qde(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):dK(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function qde(t,e,n){return e=Qtt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Qtt(t){var e=Jtt(t,"string");return h_(e)=="symbol"?e:e+""}function Jtt(t,e){if(h_(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(h_(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ztt(t,e){return rnt(t)||nnt(t,e)||tnt(t,e)||ent()}function ent(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
823In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function tnt(t,e){if(t){if(typeof t=="string")return fK(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return fK(t,e)}}function fK(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function nnt(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,a,l=[],c=!0,u=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(c=(r=s.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,i=d}finally{try{if(!c&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return l}}function rnt(t){if(Array.isArray(t))return t}var $2=Math.PI/180,int=function(e){return e*180/Math.PI},Or=function(e,n,r,i){return{x:e+Math.cos(-$2*i)*r,y:n+Math.sin(-$2*i)*r}},Kde=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(e-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},snt=function(e,n,r,i,s){var a=e.width,l=e.height,c=e.startAngle,u=e.endAngle,d=fa(e.cx,a,a/2),f=fa(e.cy,l,l/2),h=Kde(a,l,r),p=fa(e.innerRadius,h,0),m=fa(e.outerRadius,h,h*.8),x=Object.keys(n);return x.reduce(function(y,g){var w=n[g],v=w.domain,N=w.reversed,S;if(nn(w.range))i==="angleAxis"?S=[c,u]:i==="radiusAxis"&&(S=[p,m]),N&&(S=[S[1],S[0]]);else{S=w.range;var _=S,j=Ztt(_,2);c=j[0],u=j[1]}var A=Bde(w,s),C=A.realScaleType,k=A.scale;k.domain(v).range(S),Vde(k);var M=Hde(k,zu(zu({},w),{},{realScaleType:C})),I=zu(zu(zu({},w),M),{},{range:S,radius:m,realScaleType:C,scale:k,cx:d,cy:f,innerRadius:p,outerRadius:m,startAngle:c,endAngle:u});return zu(zu({},y),{},qde({},g,I))},{})},ant=function(e,n){var r=e.x,i=e.y,s=n.x,a=n.y;return Math.sqrt(Math.pow(r-s,2)+Math.pow(i-a,2))},ont=function(e,n){var r=e.x,i=e.y,s=n.cx,a=n.cy,l=ant({x:r,y:i},{x:s,y:a});if(l<=0)return{radius:l};var c=(r-s)/l,u=Math.acos(c);return i>a&&(u=2*Math.PI-u),{radius:l,angle:int(u),angleInRadian:u}},lnt=function(e){var n=e.startAngle,r=e.endAngle,i=Math.floor(n/360),s=Math.floor(r/360),a=Math.min(i,s);return{startAngle:n-a*360,endAngle:r-a*360}},cnt=function(e,n){var r=n.startAngle,i=n.endAngle,s=Math.floor(r/360),a=Math.floor(i/360),l=Math.min(s,a);return e+l*360},hK=function(e,n){var r=e.x,i=e.y,s=ont({x:r,y:i},n),a=s.radius,l=s.angle,c=n.innerRadius,u=n.outerRadius;if(a<c||a>u)return!1;if(a===0)return!0;var d=lnt(n),f=d.startAngle,h=d.endAngle,p=l,m;if(f<=h){for(;p>h;)p-=360;for(;p<f;)p+=360;m=p>=f&&p<=h}else{for(;p>f;)p-=360;for(;p<h;)p+=360;m=p>=h&&p<=f}return m?zu(zu({},n),{},{radius:a,angle:cnt(p,n)}):null},Yde=function(e){return!b.isValidElement(e)&&!Kt(e)&&typeof e!="boolean"?e.className:""};function p_(t){"@babel/helpers - typeof";return p_=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},p_(t)}var unt=["offset"];function dnt(t){return mnt(t)||pnt(t)||hnt(t)||fnt()}function fnt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
824In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hnt(t,e){if(t){if(typeof t=="string")return r$(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r$(t,e)}}function pnt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function mnt(t){if(Array.isArray(t))return r$(t)}function r$(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function gnt(t,e){if(t==null)return{};var n=xnt(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function xnt(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function pK(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function zi(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?pK(Object(n),!0).forEach(function(r){ynt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):pK(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function ynt(t,e,n){return e=vnt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function vnt(t){var e=bnt(t,"string");return p_(e)=="symbol"?e:e+""}function bnt(t,e){if(p_(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(p_(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function m_(){return m_=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},m_.apply(this,arguments)}var wnt=function(e){var n=e.value,r=e.formatter,i=nn(e.children)?n:e.children;return Kt(r)?r(i):i},_nt=function(e,n){var r=da(n-e),i=Math.min(Math.abs(n-e),360);return r*i},Snt=function(e,n,r){var i=e.position,s=e.viewBox,a=e.offset,l=e.className,c=s,u=c.cx,d=c.cy,f=c.innerRadius,h=c.outerRadius,p=c.startAngle,m=c.endAngle,x=c.clockWise,y=(f+h)/2,g=_nt(p,m),w=g>=0?1:-1,v,N;i==="insideStart"?(v=p+w*a,N=x):i==="insideEnd"?(v=m-w*a,N=!x):i==="end"&&(v=m+w*a,N=x),N=g<=0?N:!N;var S=Or(u,d,y,v),_=Or(u,d,y,v+(N?1:-1)*359),j="M".concat(S.x,",").concat(S.y,`
825    A`).concat(y,",").concat(y,",0,1,").concat(N?0:1,`,
826    `).concat(_.x,",").concat(_.y),A=nn(e.id)?Cg("recharts-radial-line-"):e.id;return te.createElement("text",m_({},r,{dominantBaseline:"central",className:an("recharts-radial-bar-label",l)}),te.createElement("defs",null,te.createElement("path",{id:A,d:j})),te.createElement("textPath",{xlinkHref:"#".concat(A)},n))},Nnt=function(e){var n=e.viewBox,r=e.offset,i=e.position,s=n,a=s.cx,l=s.cy,c=s.innerRadius,u=s.outerRadius,d=s.startAngle,f=s.endAngle,h=(d+f)/2;if(i==="outside"){var p=Or(a,l,u+r,h),m=p.x,x=p.y;return{x:m,y:x,textAnchor:m>=a?"start":"end",verticalAnchor:"middle"}}if(i==="center")return{x:a,y:l,textAnchor:"middle",verticalAnchor:"middle"};if(i==="centerTop")return{x:a,y:l,textAnchor:"middle",verticalAnchor:"start"};if(i==="centerBottom")return{x:a,y:l,textAnchor:"middle",verticalAnchor:"end"};var y=(c+u)/2,g=Or(a,l,y,h),w=g.x,v=g.y;return{x:w,y:v,textAnchor:"middle",verticalAnchor:"middle"}},jnt=function(e){var n=e.viewBox,r=e.parentViewBox,i=e.offset,s=e.position,a=n,l=a.x,c=a.y,u=a.width,d=a.height,f=d>=0?1:-1,h=f*i,p=f>0?"end":"start",m=f>0?"start":"end",x=u>=0?1:-1,y=x*i,g=x>0?"end":"start",w=x>0?"start":"end";if(s==="top"){var v={x:l+u/2,y:c-f*i,textAnchor:"middle",verticalAnchor:p};return zi(zi({},v),r?{height:Math.max(c-r.y,0),width:u}:{})}if(s==="bottom"){var N={x:l+u/2,y:c+d+h,textAnchor:"middle",verticalAnchor:m};return zi(zi({},N),r?{height:Math.max(r.y+r.height-(c+d),0),width:u}:{})}if(s==="left"){var S={x:l-y,y:c+d/2,textAnchor:g,verticalAnchor:"middle"};return zi(zi({},S),r?{width:Math.max(S.x-r.x,0),height:d}:{})}if(s==="right"){var _={x:l+u+y,y:c+d/2,textAnchor:w,verticalAnchor:"middle"};return zi(zi({},_),r?{width:Math.max(r.x+r.width-_.x,0),height:d}:{})}var j=r?{width:u,height:d}:{};return s==="insideLeft"?zi({x:l+y,y:c+d/2,textAnchor:w,verticalAnchor:"middle"},j):s==="insideRight"?zi({x:l+u-y,y:c+d/2,textAnchor:g,verticalAnchor:"middle"},j):s==="insideTop"?zi({x:l+u/2,y:c+h,textAnchor:"middle",verticalAnchor:m},j):s==="insideBottom"?zi({x:l+u/2,y:c+d-h,textAnchor:"middle",verticalAnchor:p},j):s==="insideTopLeft"?zi({x:l+y,y:c+h,textAnchor:w,verticalAnchor:m},j):s==="insideTopRight"?zi({x:l+u-y,y:c+h,textAnchor:g,verticalAnchor:m},j):s==="insideBottomLeft"?zi({x:l+y,y:c+d-h,textAnchor:w,verticalAnchor:p},j):s==="insideBottomRight"?zi({x:l+u-y,y:c+d-h,textAnchor:g,verticalAnchor:p},j):R0(s)&&(Qe(s.x)||Xp(s.x))&&(Qe(s.y)||Xp(s.y))?zi({x:l+fa(s.x,u),y:c+fa(s.y,d),textAnchor:"end",verticalAnchor:"end"},j):zi({x:l+u/2,y:c+d/2,textAnchor:"middle",verticalAnchor:"middle"},j)},Cnt=function(e){return"cx"in e&&Qe(e.cx)};function fs(t){var e=t.offset,n=e===void 0?5:e,r=gnt(t,unt),i=zi({offset:n},r),s=i.viewBox,a=i.position,l=i.value,c=i.children,u=i.content,d=i.className,f=d===void 0?"":d,h=i.textBreakAll;if(!s||nn(l)&&nn(c)&&!b.isValidElement(u)&&!Kt(u))return null;if(b.isValidElement(u))return b.cloneElement(u,i);var p;if(Kt(u)){if(p=b.createElement(u,i),b.isValidElement(p))return p}else p=wnt(i);var m=Cnt(s),x=Pt(i,!0);if(m&&(a==="insideStart"||a==="insideEnd"||a==="end"))return Snt(i,p,x);var y=m?Nnt(i):jnt(i);return te.createElement(Gm,m_({className:an("recharts-label",f)},x,y,{breakAll:h}),p)}fs.displayName="Label";var Xde=function(e){var n=e.cx,r=e.cy,i=e.angle,s=e.startAngle,a=e.endAngle,l=e.r,c=e.radius,u=e.innerRadius,d=e.outerRadius,f=e.x,h=e.y,p=e.top,m=e.left,x=e.width,y=e.height,g=e.clockWise,w=e.labelViewBox;if(w)return w;if(Qe(x)&&Qe(y)){if(Qe(f)&&Qe(h))return{x:f,y:h,width:x,height:y};if(Qe(p)&&Qe(m))return{x:p,y:m,width:x,height:y}}return Qe(f)&&Qe(h)?{x:f,y:h,width:0,height:0}:Qe(n)&&Qe(r)?{cx:n,cy:r,startAngle:s||i||0,endAngle:a||i||0,innerRadius:u||0,outerRadius:d||c||l||0,clockWise:g}:e.viewBox?e.viewBox:{}},knt=function(e,n){return e?e===!0?te.createElement(fs,{key:"label-implicit",viewBox:n}):Xi(e)?te.createElement(fs,{key:"label-implicit",viewBox:n,value:e}):b.isValidElement(e)?e.type===fs?b.cloneElement(e,{key:"label-implicit",viewBox:n}):te.createElement(fs,{key:"label-implicit",content:e,viewBox:n}):Kt(e)?te.createElement(fs,{key:"label-implicit",content:e,viewBox:n}):R0(e)?te.createElement(fs,m_({viewBox:n},e,{key:"label-implicit"})):null:null},Ent=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&r&&!e.label)return null;var i=e.children,s=Xde(e),a=So(i,fs).map(function(c,u){return b.cloneElement(c,{viewBox:n||s,key:"label-".concat(u)})});if(!r)return a;var l=knt(e.label,n||s);return[l].concat(dnt(a))};fs.parseViewBox=Xde;fs.renderCallByParent=Ent;function Ant(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var Tnt=Ant;const Bt=An(Tnt);function g_(t){"@babel/helpers - typeof";return g_=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},g_(t)}var Mnt=["valueAccessor"],Pnt=["data","dataKey","clockWise","id","textBreakAll"];function Ont(t){return Lnt(t)||Dnt(t)||Int(t)||Rnt()}function Rnt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
827In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Int(t,e){if(t){if(typeof t=="string")return i$(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i$(t,e)}}function Dnt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Lnt(t){if(Array.isArray(t))return i$(t)}function i$(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function F2(){return F2=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},F2.apply(this,arguments)}function mK(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function gK(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?mK(Object(n),!0).forEach(function(r){$nt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):mK(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function $nt(t,e,n){return e=Fnt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Fnt(t){var e=Unt(t,"string");return g_(e)=="symbol"?e:e+""}function Unt(t,e){if(g_(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(g_(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function xK(t,e){if(t==null)return{};var n=znt(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function znt(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var Bnt=function(e){return Array.isArray(e.value)?Bt(e.value):e.value};function Qc(t){var e=t.valueAccessor,n=e===void 0?Bnt:e,r=xK(t,Mnt),i=r.data,s=r.dataKey,a=r.clockWise,l=r.id,c=r.textBreakAll,u=xK(r,Pnt);return!i||!i.length?null:te.createElement(kn,{className:"recharts-label-list"},i.map(function(d,f){var h=nn(s)?n(d,f):gi(d&&d.payload,s),p=nn(l)?{}:{id:"".concat(l,"-").concat(f)};return te.createElement(fs,F2({},Pt(d,!0),u,p,{parentViewBox:d.parentViewBox,value:h,textBreakAll:c,viewBox:fs.parseViewBox(nn(a)?d:gK(gK({},d),{},{clockWise:a})),key:"label-".concat(f),index:f}))}))}Qc.displayName="LabelList";function Vnt(t,e){return t?t===!0?te.createElement(Qc,{key:"labelList-implicit",data:e}):te.isValidElement(t)||Kt(t)?te.createElement(Qc,{key:"labelList-implicit",data:e,content:t}):R0(t)?te.createElement(Qc,F2({data:e},t,{key:"labelList-implicit"})):null:null}function Hnt(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&n&&!t.label)return null;var r=t.children,i=So(r,Qc).map(function(a,l){return b.cloneElement(a,{data:e,key:"labelList-".concat(l)})});if(!n)return i;var s=Vnt(t.label,e);return[s].concat(Ont(i))}Qc.renderCallByParent=Hnt;function x_(t){"@babel/helpers - typeof";return x_=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},x_(t)}function s$(){return s$=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},s$.apply(this,arguments)}function yK(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function vK(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?yK(Object(n),!0).forEach(function(r){Wnt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):yK(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Wnt(t,e,n){return e=Gnt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Gnt(t){var e=qnt(t,"string");return x_(e)=="symbol"?e:e+""}function qnt(t,e){if(x_(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(x_(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Knt=function(e,n){var r=da(n-e),i=Math.min(Math.abs(n-e),359.999);return r*i},gj=function(e){var n=e.cx,r=e.cy,i=e.radius,s=e.angle,a=e.sign,l=e.isExternal,c=e.cornerRadius,u=e.cornerIsExternal,d=c*(l?1:-1)+i,f=Math.asin(c/d)/$2,h=u?s:s+a*f,p=Or(n,r,d,h),m=Or(n,r,i,h),x=u?s-a*f:s,y=Or(n,r,d*Math.cos(f*$2),x);return{center:p,circleTangency:m,lineTangency:y,theta:f}},Qde=function(e){var n=e.cx,r=e.cy,i=e.innerRadius,s=e.outerRadius,a=e.startAngle,l=e.endAngle,c=Knt(a,l),u=a+c,d=Or(n,r,s,a),f=Or(n,r,s,u),h="M ".concat(d.x,",").concat(d.y,`
828    A `).concat(s,",").concat(s,`,0,
829    `).concat(+(Math.abs(c)>180),",").concat(+(a>u),`,
830    `).concat(f.x,",").concat(f.y,`
831  `);if(i>0){var p=Or(n,r,i,a),m=Or(n,r,i,u);h+="L ".concat(m.x,",").concat(m.y,`
832            A `).concat(i,",").concat(i,`,0,
833            `).concat(+(Math.abs(c)>180),",").concat(+(a<=u),`,
834            `).concat(p.x,",").concat(p.y," Z")}else h+="L ".concat(n,",").concat(r," Z");return h},Ynt=function(e){var n=e.cx,r=e.cy,i=e.innerRadius,s=e.outerRadius,a=e.cornerRadius,l=e.forceCornerRadius,c=e.cornerIsExternal,u=e.startAngle,d=e.endAngle,f=da(d-u),h=gj({cx:n,cy:r,radius:s,angle:u,sign:f,cornerRadius:a,cornerIsExternal:c}),p=h.circleTangency,m=h.lineTangency,x=h.theta,y=gj({cx:n,cy:r,radius:s,angle:d,sign:-f,cornerRadius:a,cornerIsExternal:c}),g=y.circleTangency,w=y.lineTangency,v=y.theta,N=c?Math.abs(u-d):Math.abs(u-d)-x-v;if(N<0)return l?"M ".concat(m.x,",").concat(m.y,`
835        a`).concat(a,",").concat(a,",0,0,1,").concat(a*2,`,0
836        a`).concat(a,",").concat(a,",0,0,1,").concat(-a*2,`,0
837      `):Qde({cx:n,cy:r,innerRadius:i,outerRadius:s,startAngle:u,endAngle:d});var S="M ".concat(m.x,",").concat(m.y,`
838    A`).concat(a,",").concat(a,",0,0,").concat(+(f<0),",").concat(p.x,",").concat(p.y,`
839    A`).concat(s,",").concat(s,",0,").concat(+(N>180),",").concat(+(f<0),",").concat(g.x,",").concat(g.y,`
840    A`).concat(a,",").concat(a,",0,0,").concat(+(f<0),",").concat(w.x,",").concat(w.y,`
841  `);if(i>0){var _=gj({cx:n,cy:r,radius:i,angle:u,sign:f,isExternal:!0,cornerRadius:a,cornerIsExternal:c}),j=_.circleTangency,A=_.lineTangency,C=_.theta,k=gj({cx:n,cy:r,radius:i,angle:d,sign:-f,isExternal:!0,cornerRadius:a,cornerIsExternal:c}),M=k.circleTangency,I=k.lineTangency,R=k.theta,E=c?Math.abs(u-d):Math.abs(u-d)-C-R;if(E<0&&a===0)return"".concat(S,"L").concat(n,",").concat(r,"Z");S+="L".concat(I.x,",").concat(I.y,`
842      A`).concat(a,",").concat(a,",0,0,").concat(+(f<0),",").concat(M.x,",").concat(M.y,`
843      A`).concat(i,",").concat(i,",0,").concat(+(E>180),",").concat(+(f>0),",").concat(j.x,",").concat(j.y,`
844      A`).concat(a,",").concat(a,",0,0,").concat(+(f<0),",").concat(A.x,",").concat(A.y,"Z")}else S+="L".concat(n,",").concat(r,"Z");return S},Xnt={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},Jde=function(e){var n=vK(vK({},Xnt),e),r=n.cx,i=n.cy,s=n.innerRadius,a=n.outerRadius,l=n.cornerRadius,c=n.forceCornerRadius,u=n.cornerIsExternal,d=n.startAngle,f=n.endAngle,h=n.className;if(a<s||d===f)return null;var p=an("recharts-sector",h),m=a-s,x=fa(l,m,0,!0),y;return x>0&&Math.abs(d-f)<360?y=Ynt({cx:r,cy:i,innerRadius:s,outerRadius:a,cornerRadius:Math.min(x,m/2),forceCornerRadius:c,cornerIsExternal:u,startAngle:d,endAngle:f}):y=Qde({cx:r,cy:i,innerRadius:s,outerRadius:a,startAngle:d,endAngle:f}),te.createElement("path",s$({},Pt(n,!0),{className:p,d:y,role:"img"}))};function y_(t){"@babel/helpers - typeof";return y_=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},y_(t)}function a$(){return a$=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},a$.apply(this,arguments)}function bK(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function wK(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?bK(Object(n),!0).forEach(function(r){Qnt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):bK(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Qnt(t,e,n){return e=Jnt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Jnt(t){var e=Znt(t,"string");return y_(e)=="symbol"?e:e+""}function Znt(t,e){if(y_(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(y_(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var _K={curveBasisClosed:Oce,curveBasisOpen:Ice,curveBasis:hM,curveBumpX:L9e,curveBumpY:$9e,curveLinearClosed:zce,curveLinear:kg,curveMonotoneX:Hce,curveMonotoneY:Wce,curveNatural:qce,curveStep:Kce,curveStepAfter:Xce,curveStepBefore:Yce},xj=function(e){return e.x===+e.x&&e.y===+e.y},jb=function(e){return e.x},Cb=function(e){return e.y},ert=function(e,n){if(Kt(e))return e;var r="curve".concat(uM(e));return(r==="curveMonotone"||r==="curveBump")&&n?_K["".concat(r).concat(n==="vertical"?"Y":"X")]:_K[r]||kg},trt=function(e){var n=e.type,r=n===void 0?"linear":n,i=e.points,s=i===void 0?[]:i,a=e.baseLine,l=e.layout,c=e.connectNulls,u=c===void 0?!1:c,d=ert(r,l),f=u?s.filter(function(x){return xj(x)}):s,h;if(Array.isArray(a)){var p=u?a.filter(function(x){return xj(x)}):a,m=f.map(function(x,y){return wK(wK({},x),{},{base:p[y]})});return l==="vertical"?h=hw().y(Cb).x1(jb).x0(function(x){return x.base.x}):h=hw().x(jb).y1(Cb).y0(function(x){return x.base.y}),h.defined(xj).curve(d),h(m)}return l==="vertical"&&Qe(a)?h=hw().y(Cb).x1(jb).x0(a):Qe(a)?h=hw().x(jb).y1(Cb).y0(a):h=T6().x(jb).y(Cb),h.defined(xj).curve(d),h(f)},jm=function(e){var n=e.className,r=e.points,i=e.path,s=e.pathRef;if((!r||!r.length)&&!i)return null;var a=r&&r.length?trt(e):i;return b.createElement("path",a$({},Pt(e,!1),d2(e),{className:an("recharts-curve",n),d:a,ref:s}))},Zde={exports:{}},nrt="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",rrt=nrt,irt=rrt;function efe(){}function tfe(){}tfe.resetWarningCache=efe;var srt=function(){function t(r,i,s,a,l,c){if(c!==irt){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}t.isRequired=t;function e(){return t}var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:tfe,resetWarningCache:efe};return n.PropTypes=n,n};Zde.exports=srt();var art=Zde.exports;const Yn=An(art),{getOwnPropertyNames:ort,getOwnPropertySymbols:lrt}=Object,{hasOwnProperty:crt}=Object.prototype;function lI(t,e){return function(r,i,s){return t(r,i,s)&&e(r,i,s)}}function yj(t){return function(n,r,i){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,i);const{cache:s}=i,a=s.get(n),l=s.get(r);if(a&&l)return a===r&&l===n;s.set(n,r),s.set(r,n);const c=t(n,r,i);return s.delete(n),s.delete(r),c}}function urt(t){return t!=null?t[Symbol.toStringTag]:void 0}function SK(t){return ort(t).concat(lrt(t))}const drt=Object.hasOwn||((t,e)=>crt.call(t,e));function Mg(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const frt="__v",hrt="__o",prt="_owner",{getOwnPropertyDescriptor:NK,keys:jK}=Object;function mrt(t,e){return t.byteLength===e.byteLength&&U2(new Uint8Array(t),new Uint8Array(e))}function grt(t,e,n){let r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function xrt(t,e){return t.byteLength===e.byteLength&&U2(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function yrt(t,e){return Mg(t.getTime(),e.getTime())}function vrt(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function brt(t,e){return t===e}function CK(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const i=new Array(r),s=t.entries();let a,l,c=0;for(;(a=s.next())&&!a.done;){const u=e.entries();let d=!1,f=0;for(;(l=u.next())&&!l.done;){if(i[f]){f++;continue}const h=a.value,p=l.value;if(n.equals(h[0],p[0],c,f,t,e,n)&&n.equals(h[1],p[1],h[0],p[0],t,e,n)){d=i[f]=!0;break}f++}if(!d)return!1;c++}return!0}const wrt=Mg;function _rt(t,e,n){const r=jK(t);let i=r.length;if(jK(e).length!==i)return!1;for(;i-- >0;)if(!nfe(t,e,n,r[i]))return!1;return!0}function kb(t,e,n){const r=SK(t);let i=r.length;if(SK(e).length!==i)return!1;let s,a,l;for(;i-- >0;)if(s=r[i],!nfe(t,e,n,s)||(a=NK(t,s),l=NK(e,s),(a||l)&&(!a||!l||a.configurable!==l.configurable||a.enumerable!==l.enumerable||a.writable!==l.writable)))return!1;return!0}function Srt(t,e){return Mg(t.valueOf(),e.valueOf())}function Nrt(t,e){return t.source===e.source&&t.flags===e.flags}function kK(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const i=new Array(r),s=t.values();let a,l;for(;(a=s.next())&&!a.done;){const c=e.values();let u=!1,d=0;for(;(l=c.next())&&!l.done;){if(!i[d]&&n.equals(a.value,l.value,a.value,l.value,t,e,n)){u=i[d]=!0;break}d++}if(!u)return!1}return!0}function U2(t,e){let n=t.byteLength;if(e.byteLength!==n||t.byteOffset!==e.byteOffset)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function jrt(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function nfe(t,e,n,r){return(r===prt||r===hrt||r===frt)&&(t.$$typeof||e.$$typeof)?!0:drt(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const Crt="[object ArrayBuffer]",krt="[object Arguments]",Ert="[object Boolean]",Art="[object DataView]",Trt="[object Date]",Mrt="[object Error]",Prt="[object Map]",Ort="[object Number]",Rrt="[object Object]",Irt="[object RegExp]",Drt="[object Set]",Lrt="[object String]",$rt={"[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},Frt="[object URL]",Urt=Object.prototype.toString;function zrt({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:s,areMapsEqual:a,areNumbersEqual:l,areObjectsEqual:c,arePrimitiveWrappersEqual:u,areRegExpsEqual:d,areSetsEqual:f,areTypedArraysEqual:h,areUrlsEqual:p,unknownTagComparators:m}){return function(y,g,w){if(y===g)return!0;if(y==null||g==null)return!1;const v=typeof y;if(v!==typeof g)return!1;if(v!=="object")return v==="number"?l(y,g,w):v==="function"?s(y,g,w):!1;const N=y.constructor;if(N!==g.constructor)return!1;if(N===Object)return c(y,g,w);if(Array.isArray(y))return e(y,g,w);if(N===Date)return r(y,g,w);if(N===RegExp)return d(y,g,w);if(N===Map)return a(y,g,w);if(N===Set)return f(y,g,w);const S=Urt.call(y);if(S===Trt)return r(y,g,w);if(S===Irt)return d(y,g,w);if(S===Prt)return a(y,g,w);if(S===Drt)return f(y,g,w);if(S===Rrt)return typeof y.then!="function"&&typeof g.then!="function"&&c(y,g,w);if(S===Frt)return p(y,g,w);if(S===Mrt)return i(y,g,w);if(S===krt)return c(y,g,w);if($rt[S])return h(y,g,w);if(S===Crt)return t(y,g,w);if(S===Art)return n(y,g,w);if(S===Ert||S===Ort||S===Lrt)return u(y,g,w);if(m){let _=m[S];if(!_){const j=urt(y);j&&(_=m[j])}if(_)return _(y,g,w)}return!1}}function Brt({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:mrt,areArraysEqual:n?kb:grt,areDataViewsEqual:xrt,areDatesEqual:yrt,areErrorsEqual:vrt,areFunctionsEqual:brt,areMapsEqual:n?lI(CK,kb):CK,areNumbersEqual:wrt,areObjectsEqual:n?kb:_rt,arePrimitiveWrappersEqual:Srt,areRegExpsEqual:Nrt,areSetsEqual:n?lI(kK,kb):kK,areTypedArraysEqual:n?lI(U2,kb):U2,areUrlsEqual:jrt,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const i=yj(r.areArraysEqual),s=yj(r.areMapsEqual),a=yj(r.areObjectsEqual),l=yj(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:i,areMapsEqual:s,areObjectsEqual:a,areSetsEqual:l})}return r}function Vrt(t){return function(e,n,r,i,s,a,l){return t(e,n,l)}}function Hrt({circular:t,comparator:e,createState:n,equals:r,strict:i}){if(n)return function(l,c){const{cache:u=t?new WeakMap:void 0,meta:d}=n();return e(l,c,{cache:u,equals:r,meta:d,strict:i})};if(t)return function(l,c){return e(l,c,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};const s={cache:void 0,equals:r,meta:void 0,strict:i};return function(l,c){return e(l,c,s)}}const rfe=np();np({strict:!0});np({circular:!0});np({circular:!0,strict:!0});np({createInternalComparator:()=>Mg});np({strict:!0,createInternalComparator:()=>Mg});np({circular:!0,createInternalComparator:()=>Mg});np({circular:!0,createInternalComparator:()=>Mg,strict:!0});function np(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:i=!1}=t,s=Brt(t),a=zrt(s),l=n?n(a):Vrt(a);return Hrt({circular:e,comparator:a,createState:r,equals:l,strict:i})}function Wrt(t){typeof requestAnimationFrame<"u"&&requestAnimationFrame(t)}function EK(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1,r=function i(s){n<0&&(n=s),s-n>e?(t(s),n=-1):Wrt(i)};requestAnimationFrame(r)}function o$(t){"@babel/helpers - typeof";return o$=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},o$(t)}function Grt(t){return Xrt(t)||Yrt(t)||Krt(t)||qrt()}function qrt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
845In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Krt(t,e){if(t){if(typeof t=="string")return AK(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return AK(t,e)}}function AK(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Yrt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Xrt(t){if(Array.isArray(t))return t}function Qrt(){var t={},e=function(){return null},n=!1,r=function i(s){if(!n){if(Array.isArray(s)){if(!s.length)return;var a=s,l=Grt(a),c=l[0],u=l.slice(1);if(typeof c=="number"){EK(i.bind(null,u),c);return}i(c),EK(i.bind(null,u));return}o$(s)==="object"&&(t=s,e(t)),typeof s=="function"&&s()}};return{stop:function(){n=!0},start:function(s){n=!1,r(s)},subscribe:function(s){return e=s,function(){e=function(){return null}}}}}function v_(t){"@babel/helpers - typeof";return v_=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},v_(t)}function TK(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function MK(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?TK(Object(n),!0).forEach(function(r){ife(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):TK(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function ife(t,e,n){return e=Jrt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Jrt(t){var e=Zrt(t,"string");return v_(e)==="symbol"?e:String(e)}function Zrt(t,e){if(v_(t)!=="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(v_(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var eit=function(e,n){return[Object.keys(e),Object.keys(n)].reduce(function(r,i){return r.filter(function(s){return i.includes(s)})})},tit=function(e){return e},nit=function(e){return e.replace(/([A-Z])/g,function(n){return"-".concat(n.toLowerCase())})},Vw=function(e,n){return Object.keys(n).reduce(function(r,i){return MK(MK({},r),{},ife({},i,e(i,n[i])))},{})},PK=function(e,n,r){return e.map(function(i){return"".concat(nit(i)," ").concat(n,"ms ").concat(r)}).join(",")};function rit(t,e){return ait(t)||sit(t,e)||sfe(t,e)||iit()}function iit(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
846In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sit(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,a,l=[],c=!0,u=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(c=(r=s.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,i=d}finally{try{if(!c&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return l}}function ait(t){if(Array.isArray(t))return t}function oit(t){return uit(t)||cit(t)||sfe(t)||lit()}function lit(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
847In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sfe(t,e){if(t){if(typeof t=="string")return l$(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return l$(t,e)}}function cit(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function uit(t){if(Array.isArray(t))return l$(t)}function l$(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var z2=1e-4,afe=function(e,n){return[0,3*e,3*n-6*e,3*e-3*n+1]},ofe=function(e,n){return e.map(function(r,i){return r*Math.pow(n,i)}).reduce(function(r,i){return r+i})},OK=function(e,n){return function(r){var i=afe(e,n);return ofe(i,r)}},dit=function(e,n){return function(r){var i=afe(e,n),s=[].concat(oit(i.map(function(a,l){return a*l}).slice(1)),[0]);return ofe(s,r)}},RK=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var i=n[0],s=n[1],a=n[2],l=n[3];if(n.length===1)switch(n[0]){case"linear":i=0,s=0,a=1,l=1;break;case"ease":i=.25,s=.1,a=.25,l=1;break;case"ease-in":i=.42,s=0,a=1,l=1;break;case"ease-out":i=.42,s=0,a=.58,l=1;break;case"ease-in-out":i=0,s=0,a=.58,l=1;break;default:{var c=n[0].split("(");if(c[0]==="cubic-bezier"&&c[1].split(")")[0].split(",").length===4){var u=c[1].split(")")[0].split(",").map(function(y){return parseFloat(y)}),d=rit(u,4);i=d[0],s=d[1],a=d[2],l=d[3]}}}var f=OK(i,a),h=OK(s,l),p=dit(i,a),m=function(g){return g>1?1:g<0?0:g},x=function(g){for(var w=g>1?1:g,v=w,N=0;N<8;++N){var S=f(v)-w,_=p(v);if(Math.abs(S-w)<z2||_<z2)return h(v);v=m(v-S/_)}return h(v)};return x.isStepper=!1,x},fit=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.stiff,r=n===void 0?100:n,i=e.damping,s=i===void 0?8:i,a=e.dt,l=a===void 0?17:a,c=function(d,f,h){var p=-(d-f)*r,m=h*s,x=h+(p-m)*l/1e3,y=h*l/1e3+d;return Math.abs(y-f)<z2&&Math.abs(x)<z2?[f,0]:[y,x]};return c.isStepper=!0,c.dt=l,c},hit=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var i=n[0];if(typeof i=="string")switch(i){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return RK(i);case"spring":return fit();default:if(i.split("(")[0]==="cubic-bezier")return RK(i)}return typeof i=="function"?i:null};function b_(t){"@babel/helpers - typeof";return b_=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},b_(t)}function IK(t){return git(t)||mit(t)||lfe(t)||pit()}function pit(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
848In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mit(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function git(t){if(Array.isArray(t))return u$(t)}function DK(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function As(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?DK(Object(n),!0).forEach(function(r){c$(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):DK(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function c$(t,e,n){return e=xit(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function xit(t){var e=yit(t,"string");return b_(e)==="symbol"?e:String(e)}function yit(t,e){if(b_(t)!=="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(b_(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function vit(t,e){return _it(t)||wit(t,e)||lfe(t,e)||bit()}function bit(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
849In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lfe(t,e){if(t){if(typeof t=="string")return u$(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u$(t,e)}}function u$(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function wit(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,a,l=[],c=!0,u=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(c=(r=s.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,i=d}finally{try{if(!c&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return l}}function _it(t){if(Array.isArray(t))return t}var B2=function(e,n,r){return e+(n-e)*r},d$=function(e){var n=e.from,r=e.to;return n!==r},Sit=function t(e,n,r){var i=Vw(function(s,a){if(d$(a)){var l=e(a.from,a.to,a.velocity),c=vit(l,2),u=c[0],d=c[1];return As(As({},a),{},{from:u,velocity:d})}return a},n);return r<1?Vw(function(s,a){return d$(a)?As(As({},a),{},{velocity:B2(a.velocity,i[s].velocity,r),from:B2(a.from,i[s].from,r)}):a},n):t(e,i,r-1)};const Nit=function(t,e,n,r,i){var s=eit(t,e),a=s.reduce(function(y,g){return As(As({},y),{},c$({},g,[t[g],e[g]]))},{}),l=s.reduce(function(y,g){return As(As({},y),{},c$({},g,{from:t[g],velocity:0,to:e[g]}))},{}),c=-1,u,d,f=function(){return null},h=function(){return Vw(function(g,w){return w.from},l)},p=function(){return!Object.values(l).filter(d$).length},m=function(g){u||(u=g);var w=g-u,v=w/n.dt;l=Sit(n,l,v),i(As(As(As({},t),e),h())),u=g,p()||(c=requestAnimationFrame(f))},x=function(g){d||(d=g);var w=(g-d)/r,v=Vw(function(S,_){return B2.apply(void 0,IK(_).concat([n(w)]))},a);if(i(As(As(As({},t),e),v)),w<1)c=requestAnimationFrame(f);else{var N=Vw(function(S,_){return B2.apply(void 0,IK(_).concat([n(1)]))},a);i(As(As(As({},t),e),N))}};return f=n.isStepper?m:x,function(){return requestAnimationFrame(f),function(){cancelAnimationFrame(c)}}};function jv(t){"@babel/helpers - typeof";return jv=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},jv(t)}var jit=["children","begin","duration","attributeName","easing","isActive","steps","from","to","canBegin","onAnimationEnd","shouldReAnimate","onAnimationReStart"];function Cit(t,e){if(t==null)return{};var n=kit(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function kit(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}function cI(t){return Mit(t)||Tit(t)||Ait(t)||Eit()}function Eit(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
850In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ait(t,e){if(t){if(typeof t=="string")return f$(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return f$(t,e)}}function Tit(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Mit(t){if(Array.isArray(t))return f$(t)}function f$(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function LK(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function El(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?LK(Object(n),!0).forEach(function(r){pw(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):LK(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function pw(t,e,n){return e=cfe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Pit(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Oit(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,cfe(r.key),r)}}function Rit(t,e,n){return e&&Oit(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function cfe(t){var e=Iit(t,"string");return jv(e)==="symbol"?e:String(e)}function Iit(t,e){if(jv(t)!=="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(jv(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Dit(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&h$(t,e)}function h$(t,e){return h$=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},h$(t,e)}function Lit(t){var e=$it();return function(){var r=V2(t),i;if(e){var s=V2(this).constructor;i=Reflect.construct(r,arguments,s)}else i=r.apply(this,arguments);return p$(this,i)}}function p$(t,e){if(e&&(jv(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return m$(t)}function m$(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function $it(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function V2(t){return V2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},V2(t)}var mc=function(t){Dit(n,t);var e=Lit(n);function n(r,i){var s;Pit(this,n),s=e.call(this,r,i);var a=s.props,l=a.isActive,c=a.attributeName,u=a.from,d=a.to,f=a.steps,h=a.children,p=a.duration;if(s.handleStyleChange=s.handleStyleChange.bind(m$(s)),s.changeStyle=s.changeStyle.bind(m$(s)),!l||p<=0)return s.state={style:{}},typeof h=="function"&&(s.state={style:d}),p$(s);if(f&&f.length)s.state={style:f[0].style};else if(u){if(typeof h=="function")return s.state={style:u},p$(s);s.state={style:c?pw({},c,u):u}}else s.state={style:{}};return s}return Rit(n,[{key:"componentDidMount",value:function(){var i=this.props,s=i.isActive,a=i.canBegin;this.mounted=!0,!(!s||!a)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(i){var s=this.props,a=s.isActive,l=s.canBegin,c=s.attributeName,u=s.shouldReAnimate,d=s.to,f=s.from,h=this.state.style;if(l){if(!a){var p={style:c?pw({},c,d):d};this.state&&h&&(c&&h[c]!==d||!c&&h!==d)&&this.setState(p);return}if(!(rfe(i.to,d)&&i.canBegin&&i.isActive)){var m=!i.canBegin||!i.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var x=m||u?f:i.to;if(this.state&&h){var y={style:c?pw({},c,x):x};(c&&h[c]!==x||!c&&h!==x)&&this.setState(y)}this.runAnimation(El(El({},this.props),{},{from:x,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var i=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),i&&i()}},{key:"handleStyleChange",value:function(i){this.changeStyle(i)}},{key:"changeStyle",value:function(i){this.mounted&&this.setState({style:i})}},{key:"runJSAnimation",value:function(i){var s=this,a=i.from,l=i.to,c=i.duration,u=i.easing,d=i.begin,f=i.onAnimationEnd,h=i.onAnimationStart,p=Nit(a,l,hit(u),c,this.changeStyle),m=function(){s.stopJSAnimation=p()};this.manager.start([h,d,m,c,f])}},{key:"runStepAnimation",value:function(i){var s=this,a=i.steps,l=i.begin,c=i.onAnimationStart,u=a[0],d=u.style,f=u.duration,h=f===void 0?0:f,p=function(x,y,g){if(g===0)return x;var w=y.duration,v=y.easing,N=v===void 0?"ease":v,S=y.style,_=y.properties,j=y.onAnimationEnd,A=g>0?a[g-1]:y,C=_||Object.keys(S);if(typeof N=="function"||N==="spring")return[].concat(cI(x),[s.runJSAnimation.bind(s,{from:A.style,to:S,duration:w,easing:N}),w]);var k=PK(C,w,N),M=El(El(El({},A.style),S),{},{transition:k});return[].concat(cI(x),[M,w,j]).filter(tit)};return this.manager.start([c].concat(cI(a.reduce(p,[d,Math.max(h,l)])),[i.onAnimationEnd]))}},{key:"runAnimation",value:function(i){this.manager||(this.manager=Qrt());var s=i.begin,a=i.duration,l=i.attributeName,c=i.to,u=i.easing,d=i.onAnimationStart,f=i.onAnimationEnd,h=i.steps,p=i.children,m=this.manager;if(this.unSubscribe=m.subscribe(this.handleStyleChange),typeof u=="function"||typeof p=="function"||u==="spring"){this.runJSAnimation(i);return}if(h.length>1){this.runStepAnimation(i);return}var x=l?pw({},l,c):c,y=PK(Object.keys(x),a,u);m.start([d,s,El(El({},x),{},{transition:y}),a,f])}},{key:"render",value:function(){var i=this.props,s=i.children;i.begin;var a=i.duration;i.attributeName,i.easing;var l=i.isActive;i.steps,i.from,i.to,i.canBegin,i.onAnimationEnd,i.shouldReAnimate,i.onAnimationReStart;var c=Cit(i,jit),u=b.Children.count(s),d=this.state.style;if(typeof s=="function")return s(d);if(!l||u===0||a<=0)return s;var f=function(p){var m=p.props,x=m.style,y=x===void 0?{}:x,g=m.className,w=b.cloneElement(p,El(El({},c),{},{style:El(El({},y),d),className:g}));return w};return u===1?f(b.Children.only(s)):te.createElement("div",null,b.Children.map(s,function(h){return f(h)}))}}]),n}(b.PureComponent);mc.displayName="Animate";mc.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};mc.propTypes={from:Yn.oneOfType([Yn.object,Yn.string]),to:Yn.oneOfType([Yn.object,Yn.string]),attributeName:Yn.string,duration:Yn.number,begin:Yn.number,easing:Yn.oneOfType([Yn.string,Yn.func]),steps:Yn.arrayOf(Yn.shape({duration:Yn.number.isRequired,style:Yn.object.isRequired,easing:Yn.oneOfType([Yn.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),Yn.func]),properties:Yn.arrayOf("string"),onAnimationEnd:Yn.func})),children:Yn.oneOfType([Yn.node,Yn.func]),isActive:Yn.bool,canBegin:Yn.bool,onAnimationEnd:Yn.func,shouldReAnimate:Yn.bool,onAnimationStart:Yn.func,onAnimationReStart:Yn.func};function w_(t){"@babel/helpers - typeof";return w_=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},w_(t)}function H2(){return H2=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},H2.apply(this,arguments)}function Fit(t,e){return Vit(t)||Bit(t,e)||zit(t,e)||Uit()}function Uit(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
851In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function zit(t,e){if(t){if(typeof t=="string")return $K(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return $K(t,e)}}function $K(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Bit(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,a,l=[],c=!0,u=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(c=(r=s.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,i=d}finally{try{if(!c&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return l}}function Vit(t){if(Array.isArray(t))return t}function FK(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function UK(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?FK(Object(n),!0).forEach(function(r){Hit(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):FK(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Hit(t,e,n){return e=Wit(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Wit(t){var e=Git(t,"string");return w_(e)=="symbol"?e:e+""}function Git(t,e){if(w_(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(w_(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var zK=function(e,n,r,i,s){var a=Math.min(Math.abs(r)/2,Math.abs(i)/2),l=i>=0?1:-1,c=r>=0?1:-1,u=i>=0&&r>=0||i<0&&r<0?1:0,d;if(a>0&&s instanceof Array){for(var f=[0,0,0,0],h=0,p=4;h<p;h++)f[h]=s[h]>a?a:s[h];d="M".concat(e,",").concat(n+l*f[0]),f[0]>0&&(d+="A ".concat(f[0],",").concat(f[0],",0,0,").concat(u,",").concat(e+c*f[0],",").concat(n)),d+="L ".concat(e+r-c*f[1],",").concat(n),f[1]>0&&(d+="A ".concat(f[1],",").concat(f[1],",0,0,").concat(u,`,
852        `).concat(e+r,",").concat(n+l*f[1])),d+="L ".concat(e+r,",").concat(n+i-l*f[2]),f[2]>0&&(d+="A ".concat(f[2],",").concat(f[2],",0,0,").concat(u,`,
853        `).concat(e+r-c*f[2],",").concat(n+i)),d+="L ".concat(e+c*f[3],",").concat(n+i),f[3]>0&&(d+="A ".concat(f[3],",").concat(f[3],",0,0,").concat(u,`,
854        `).concat(e,",").concat(n+i-l*f[3])),d+="Z"}else if(a>0&&s===+s&&s>0){var m=Math.min(a,s);d="M ".concat(e,",").concat(n+l*m,`
855            A `).concat(m,",").concat(m,",0,0,").concat(u,",").concat(e+c*m,",").concat(n,`
856            L `).concat(e+r-c*m,",").concat(n,`
857            A `).concat(m,",").concat(m,",0,0,").concat(u,",").concat(e+r,",").concat(n+l*m,`
858            L `).concat(e+r,",").concat(n+i-l*m,`
859            A `).concat(m,",").concat(m,",0,0,").concat(u,",").concat(e+r-c*m,",").concat(n+i,`
860            L `).concat(e+c*m,",").concat(n+i,`
861            A `).concat(m,",").concat(m,",0,0,").concat(u,",").concat(e,",").concat(n+i-l*m," Z")}else d="M ".concat(e,",").concat(n," h ").concat(r," v ").concat(i," h ").concat(-r," Z");return d},qit=function(e,n){if(!e||!n)return!1;var r=e.x,i=e.y,s=n.x,a=n.y,l=n.width,c=n.height;if(Math.abs(l)>0&&Math.abs(c)>0){var u=Math.min(s,s+l),d=Math.max(s,s+l),f=Math.min(a,a+c),h=Math.max(a,a+c);return r>=u&&r<=d&&i>=f&&i<=h}return!1},Kit={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},CB=function(e){var n=UK(UK({},Kit),e),r=b.useRef(),i=b.useState(-1),s=Fit(i,2),a=s[0],l=s[1];b.useEffect(function(){if(r.current&&r.current.getTotalLength)try{var N=r.current.getTotalLength();N&&l(N)}catch{}},[]);var c=n.x,u=n.y,d=n.width,f=n.height,h=n.radius,p=n.className,m=n.animationEasing,x=n.animationDuration,y=n.animationBegin,g=n.isAnimationActive,w=n.isUpdateAnimationActive;if(c!==+c||u!==+u||d!==+d||f!==+f||d===0||f===0)return null;var v=an("recharts-rectangle",p);return w?te.createElement(mc,{canBegin:a>0,from:{width:d,height:f,x:c,y:u},to:{width:d,height:f,x:c,y:u},duration:x,animationEasing:m,isActive:w},function(N){var S=N.width,_=N.height,j=N.x,A=N.y;return te.createElement(mc,{canBegin:a>0,from:"0px ".concat(a===-1?1:a,"px"),to:"".concat(a,"px 0px"),attributeName:"strokeDasharray",begin:y,duration:x,isActive:g,easing:m},te.createElement("path",H2({},Pt(n,!0),{className:v,d:zK(j,A,S,_,h),ref:r})))}):te.createElement("path",H2({},Pt(n,!0),{className:v,d:zK(c,u,d,f,h)}))},Yit=["points","className","baseLinePoints","connectNulls"];function oy(){return oy=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},oy.apply(this,arguments)}function Xit(t,e){if(t==null)return{};var n=Qit(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Qit(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function BK(t){return tst(t)||est(t)||Zit(t)||Jit()}function Jit(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
862In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Zit(t,e){if(t){if(typeof t=="string")return g$(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return g$(t,e)}}function est(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function tst(t){if(Array.isArray(t))return g$(t)}function g$(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var VK=function(e){return e&&e.x===+e.x&&e.y===+e.y},nst=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=[[]];return e.forEach(function(r){VK(r)?n[n.length-1].push(r):n[n.length-1].length>0&&n.push([])}),VK(e[0])&&n[n.length-1].push(e[0]),n[n.length-1].length<=0&&(n=n.slice(0,-1)),n},Hw=function(e,n){var r=nst(e);n&&(r=[r.reduce(function(s,a){return[].concat(BK(s),BK(a))},[])]);var i=r.map(function(s){return s.reduce(function(a,l,c){return"".concat(a).concat(c===0?"M":"L").concat(l.x,",").concat(l.y)},"")}).join("");return r.length===1?"".concat(i,"Z"):i},rst=function(e,n,r){var i=Hw(e,r);return"".concat(i.slice(-1)==="Z"?i.slice(0,-1):i,"L").concat(Hw(n.reverse(),r).slice(1))},ist=function(e){var n=e.points,r=e.className,i=e.baseLinePoints,s=e.connectNulls,a=Xit(e,Yit);if(!n||!n.length)return null;var l=an("recharts-polygon",r);if(i&&i.length){var c=a.stroke&&a.stroke!=="none",u=rst(n,i,s);return te.createElement("g",{className:l},te.createElement("path",oy({},Pt(a,!0),{fill:u.slice(-1)==="Z"?a.fill:"none",stroke:"none",d:u})),c?te.createElement("path",oy({},Pt(a,!0),{fill:"none",d:Hw(n,s)})):null,c?te.createElement("path",oy({},Pt(a,!0),{fill:"none",d:Hw(i,s)})):null)}var d=Hw(n,s);return te.createElement("path",oy({},Pt(a,!0),{fill:d.slice(-1)==="Z"?a.fill:"none",className:l,d}))};function x$(){return x$=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},x$.apply(this,arguments)}var YS=function(e){var n=e.cx,r=e.cy,i=e.r,s=e.className,a=an("recharts-dot",s);return n===+n&&r===+r&&i===+i?b.createElement("circle",x$({},Pt(e,!1),d2(e),{className:a,cx:n,cy:r,r:i})):null};function __(t){"@babel/helpers - typeof";return __=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},__(t)}var sst=["x","y","top","left","width","height","className"];function y$(){return y$=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},y$.apply(this,arguments)}function HK(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ast(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?HK(Object(n),!0).forEach(function(r){ost(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):HK(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function ost(t,e,n){return e=lst(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function lst(t){var e=cst(t,"string");return __(e)=="symbol"?e:e+""}function cst(t,e){if(__(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(__(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ust(t,e){if(t==null)return{};var n=dst(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function dst(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var fst=function(e,n,r,i,s,a){return"M".concat(e,",").concat(s,"v").concat(i,"M").concat(a,",").concat(n,"h").concat(r)},hst=function(e){var n=e.x,r=n===void 0?0:n,i=e.y,s=i===void 0?0:i,a=e.top,l=a===void 0?0:a,c=e.left,u=c===void 0?0:c,d=e.width,f=d===void 0?0:d,h=e.height,p=h===void 0?0:h,m=e.className,x=ust(e,sst),y=ast({x:r,y:s,top:l,left:u,width:f,height:p},x);return!Qe(r)||!Qe(s)||!Qe(f)||!Qe(p)||!Qe(l)||!Qe(u)?null:te.createElement("path",y$({},Pt(y,!0),{className:an("recharts-cross",m),d:fst(r,s,f,p,l,u)}))},pst=EM,mst=bde,gst=bu;function xst(t,e){return t&&t.length?pst(t,gst(e),mst):void 0}var yst=xst;const vst=An(yst);var bst=EM,wst=bu,_st=wde;function Sst(t,e){return t&&t.length?bst(t,wst(e),_st):void 0}var Nst=Sst;const jst=An(Nst);var Cst=["cx","cy","angle","ticks","axisLine"],kst=["ticks","tick","angle","tickFormatter","stroke"];function Cv(t){"@babel/helpers - typeof";return Cv=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},Cv(t)}function Ww(){return Ww=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Ww.apply(this,arguments)}function WK(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function mp(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?WK(Object(n),!0).forEach(function(r){PM(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):WK(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function GK(t,e){if(t==null)return{};var n=Est(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Est(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Ast(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function qK(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,dfe(r.key),r)}}function Tst(t,e,n){return e&&qK(t.prototype,e),n&&qK(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Mst(t,e,n){return e=W2(e),Pst(t,ufe()?Reflect.construct(e,n||[],W2(t).constructor):e.apply(t,n))}function Pst(t,e){if(e&&(Cv(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ost(t)}function Ost(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ufe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ufe=function(){return!!t})()}function W2(t){return W2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},W2(t)}function Rst(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&v$(t,e)}function v$(t,e){return v$=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},v$(t,e)}function PM(t,e,n){return e=dfe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function dfe(t){var e=Ist(t,"string");return Cv(e)=="symbol"?e:e+""}function Ist(t,e){if(Cv(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Cv(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var OM=function(t){function e(){return Ast(this,e),Mst(this,e,arguments)}return Rst(e,t),Tst(e,[{key:"getTickValueCoord",value:function(r){var i=r.coordinate,s=this.props,a=s.angle,l=s.cx,c=s.cy;return Or(l,c,i,a)}},{key:"getTickTextAnchor",value:function(){var r=this.props.orientation,i;switch(r){case"left":i="end";break;case"right":i="start";break;default:i="middle";break}return i}},{key:"getViewBox",value:function(){var r=this.props,i=r.cx,s=r.cy,a=r.angle,l=r.ticks,c=vst(l,function(d){return d.coordinate||0}),u=jst(l,function(d){return d.coordinate||0});return{cx:i,cy:s,startAngle:a,endAngle:a,innerRadius:u.coordinate||0,outerRadius:c.coordinate||0}}},{key:"renderAxisLine",value:function(){var r=this.props,i=r.cx,s=r.cy,a=r.angle,l=r.ticks,c=r.axisLine,u=GK(r,Cst),d=l.reduce(function(m,x){return[Math.min(m[0],x.coordinate),Math.max(m[1],x.coordinate)]},[1/0,-1/0]),f=Or(i,s,d[0],a),h=Or(i,s,d[1],a),p=mp(mp(mp({},Pt(u,!1)),{},{fill:"none"},Pt(c,!1)),{},{x1:f.x,y1:f.y,x2:h.x,y2:h.y});return te.createElement("line",Ww({className:"recharts-polar-radius-axis-line"},p))}},{key:"renderTicks",value:function(){var r=this,i=this.props,s=i.ticks,a=i.tick,l=i.angle,c=i.tickFormatter,u=i.stroke,d=GK(i,kst),f=this.getTickTextAnchor(),h=Pt(d,!1),p=Pt(a,!1),m=s.map(function(x,y){var g=r.getTickValueCoord(x),w=mp(mp(mp(mp({textAnchor:f,transform:"rotate(".concat(90-l,", ").concat(g.x,", ").concat(g.y,")")},h),{},{stroke:"none",fill:u},p),{},{index:y},g),{},{payload:x});return te.createElement(kn,Ww({className:an("recharts-polar-radius-axis-tick",Yde(a)),key:"tick-".concat(x.coordinate)},Wm(r.props,x,y)),e.renderTickItem(a,w,c?c(x.value,y):x.value))});return te.createElement(kn,{className:"recharts-polar-radius-axis-ticks"},m)}},{key:"render",value:function(){var r=this.props,i=r.ticks,s=r.axisLine,a=r.tick;return!i||!i.length?null:te.createElement(kn,{className:an("recharts-polar-radius-axis",this.props.className)},s&&this.renderAxisLine(),a&&this.renderTicks(),fs.renderCallByParent(this.props,this.getViewBox()))}}],[{key:"renderTickItem",value:function(r,i,s){var a;return te.isValidElement(r)?a=te.cloneElement(r,i):Kt(r)?a=r(i):a=te.createElement(Gm,Ww({},i,{className:"recharts-polar-radius-axis-tick-value"}),s),a}}])}(b.PureComponent);PM(OM,"displayName","PolarRadiusAxis");PM(OM,"axisType","radiusAxis");PM(OM,"defaultProps",{type:"number",radiusAxisId:0,cx:0,cy:0,angle:0,orientation:"right",stroke:"#ccc",axisLine:!0,tick:!0,tickCount:5,allowDataOverflow:!1,scale:"auto",allowDuplicatedCategory:!0});function kv(t){"@babel/helpers - typeof";return kv=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},kv(t)}function zp(){return zp=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},zp.apply(this,arguments)}function KK(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function gp(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?KK(Object(n),!0).forEach(function(r){RM(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):KK(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Dst(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function YK(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,hfe(r.key),r)}}function Lst(t,e,n){return e&&YK(t.prototype,e),n&&YK(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function $st(t,e,n){return e=G2(e),Fst(t,ffe()?Reflect.construct(e,n||[],G2(t).constructor):e.apply(t,n))}function Fst(t,e){if(e&&(kv(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ust(t)}function Ust(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ffe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ffe=function(){return!!t})()}function G2(t){return G2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},G2(t)}function zst(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&b$(t,e)}function b$(t,e){return b$=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},b$(t,e)}function RM(t,e,n){return e=hfe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function hfe(t){var e=Bst(t,"string");return kv(e)=="symbol"?e:e+""}function Bst(t,e){if(kv(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(kv(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var Vst=Math.PI/180,XK=1e-5,IM=function(t){function e(){return Dst(this,e),$st(this,e,arguments)}return zst(e,t),Lst(e,[{key:"getTickLineCoord",value:function(r){var i=this.props,s=i.cx,a=i.cy,l=i.radius,c=i.orientation,u=i.tickSize,d=u||8,f=Or(s,a,l,r.coordinate),h=Or(s,a,l+(c==="inner"?-1:1)*d,r.coordinate);return{x1:f.x,y1:f.y,x2:h.x,y2:h.y}}},{key:"getTickTextAnchor",value:function(r){var i=this.props.orientation,s=Math.cos(-r.coordinate*Vst),a;return s>XK?a=i==="outer"?"start":"end":s<-XK?a=i==="outer"?"end":"start":a="middle",a}},{key:"renderAxisLine",value:function(){var r=this.props,i=r.cx,s=r.cy,a=r.radius,l=r.axisLine,c=r.axisLineType,u=gp(gp({},Pt(this.props,!1)),{},{fill:"none"},Pt(l,!1));if(c==="circle")return te.createElement(YS,zp({className:"recharts-polar-angle-axis-line"},u,{cx:i,cy:s,r:a}));var d=this.props.ticks,f=d.map(function(h){return Or(i,s,a,h.coordinate)});return te.createElement(ist,zp({className:"recharts-polar-angle-axis-line"},u,{points:f}))}},{key:"renderTicks",value:function(){var r=this,i=this.props,s=i.ticks,a=i.tick,l=i.tickLine,c=i.tickFormatter,u=i.stroke,d=Pt(this.props,!1),f=Pt(a,!1),h=gp(gp({},d),{},{fill:"none"},Pt(l,!1)),p=s.map(function(m,x){var y=r.getTickLineCoord(m),g=r.getTickTextAnchor(m),w=gp(gp(gp({textAnchor:g},d),{},{stroke:"none",fill:u},f),{},{index:x,payload:m,x:y.x2,y:y.y2});return te.createElement(kn,zp({className:an("recharts-polar-angle-axis-tick",Yde(a)),key:"tick-".concat(m.coordinate)},Wm(r.props,m,x)),l&&te.createElement("line",zp({className:"recharts-polar-angle-axis-tick-line"},h,y)),a&&e.renderTickItem(a,w,c?c(m.value,x):m.value))});return te.createElement(kn,{className:"recharts-polar-angle-axis-ticks"},p)}},{key:"render",value:function(){var r=this.props,i=r.ticks,s=r.radius,a=r.axisLine;return s<=0||!i||!i.length?null:te.createElement(kn,{className:an("recharts-polar-angle-axis",this.props.className)},a&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(r,i,s){var a;return te.isValidElement(r)?a=te.cloneElement(r,i):Kt(r)?a=r(i):a=te.createElement(Gm,zp({},i,{className:"recharts-polar-angle-axis-tick-value"}),s),a}}])}(b.PureComponent);RM(IM,"displayName","PolarAngleAxis");RM(IM,"axisType","angleAxis");RM(IM,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var Hst=oue,Wst=Hst(Object.getPrototypeOf,Object),pfe=Wst,Gst=Bd,qst=pfe,Kst=vu,Yst="[object Object]",Xst=Function.prototype,Qst=Object.prototype,mfe=Xst.toString,Jst=Qst.hasOwnProperty,Zst=mfe.call(Object);function eat(t){if(!Kst(t)||Gst(t)!=Yst)return!1;var e=qst(t);if(e===null)return!0;var n=Jst.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&mfe.call(n)==Zst}var gfe=eat;const DM=An(gfe);var tat=Bd,nat=vu,rat="[object Boolean]";function iat(t){return t===!0||t===!1||nat(t)&&tat(t)==rat}var sat=iat;const aat=An(sat);function S_(t){"@babel/helpers - typeof";return S_=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},S_(t)}function q2(){return q2=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},q2.apply(this,arguments)}function oat(t,e){return dat(t)||uat(t,e)||cat(t,e)||lat()}function lat(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
863In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function cat(t,e){if(t){if(typeof t=="string")return QK(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return QK(t,e)}}function QK(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function uat(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,a,l=[],c=!0,u=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(c=(r=s.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,i=d}finally{try{if(!c&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return l}}function dat(t){if(Array.isArray(t))return t}function JK(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ZK(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?JK(Object(n),!0).forEach(function(r){fat(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):JK(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function fat(t,e,n){return e=hat(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function hat(t){var e=pat(t,"string");return S_(e)=="symbol"?e:e+""}function pat(t,e){if(S_(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(S_(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var eY=function(e,n,r,i,s){var a=r-i,l;return l="M ".concat(e,",").concat(n),l+="L ".concat(e+r,",").concat(n),l+="L ".concat(e+r-a/2,",").concat(n+s),l+="L ".concat(e+r-a/2-i,",").concat(n+s),l+="L ".concat(e,",").concat(n," Z"),l},mat={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},gat=function(e){var n=ZK(ZK({},mat),e),r=b.useRef(),i=b.useState(-1),s=oat(i,2),a=s[0],l=s[1];b.useEffect(function(){if(r.current&&r.current.getTotalLength)try{var v=r.current.getTotalLength();v&&l(v)}catch{}},[]);var c=n.x,u=n.y,d=n.upperWidth,f=n.lowerWidth,h=n.height,p=n.className,m=n.animationEasing,x=n.animationDuration,y=n.animationBegin,g=n.isUpdateAnimationActive;if(c!==+c||u!==+u||d!==+d||f!==+f||h!==+h||d===0&&f===0||h===0)return null;var w=an("recharts-trapezoid",p);return g?te.createElement(mc,{canBegin:a>0,from:{upperWidth:0,lowerWidth:0,height:h,x:c,y:u},to:{upperWidth:d,lowerWidth:f,height:h,x:c,y:u},duration:x,animationEasing:m,isActive:g},function(v){var N=v.upperWidth,S=v.lowerWidth,_=v.height,j=v.x,A=v.y;return te.createElement(mc,{canBegin:a>0,from:"0px ".concat(a===-1?1:a,"px"),to:"".concat(a,"px 0px"),attributeName:"strokeDasharray",begin:y,duration:x,easing:m},te.createElement("path",q2({},Pt(n,!0),{className:w,d:eY(j,A,N,S,_),ref:r})))}):te.createElement("g",null,te.createElement("path",q2({},Pt(n,!0),{className:w,d:eY(c,u,d,f,h)})))},xat=["option","shapeType","propTransformer","activeClassName","isActive"];function N_(t){"@babel/helpers - typeof";return N_=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},N_(t)}function yat(t,e){if(t==null)return{};var n=vat(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function vat(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function tY(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function K2(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?tY(Object(n),!0).forEach(function(r){bat(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):tY(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function bat(t,e,n){return e=wat(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function wat(t){var e=_at(t,"string");return N_(e)=="symbol"?e:e+""}function _at(t,e){if(N_(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(N_(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Sat(t,e){return K2(K2({},e),t)}function Nat(t,e){return t==="symbols"}function nY(t){var e=t.shapeType,n=t.elementProps;switch(e){case"rectangle":return te.createElement(CB,n);case"trapezoid":return te.createElement(gat,n);case"sector":return te.createElement(Jde,n);case"symbols":if(Nat(e))return te.createElement(D6,n);break;default:return null}}function jat(t){return b.isValidElement(t)?t.props:t}function xfe(t){var e=t.option,n=t.shapeType,r=t.propTransformer,i=r===void 0?Sat:r,s=t.activeClassName,a=s===void 0?"recharts-active-shape":s,l=t.isActive,c=yat(t,xat),u;if(b.isValidElement(e))u=b.cloneElement(e,K2(K2({},c),jat(e)));else if(Kt(e))u=e(c);else if(DM(e)&&!aat(e)){var d=i(e,c);u=te.createElement(nY,{shapeType:n,elementProps:d})}else{var f=c;u=te.createElement(nY,{shapeType:n,elementProps:f})}return l?te.createElement(kn,{className:a},u):u}function LM(t,e){return e!=null&&"trapezoids"in t.props}function $M(t,e){return e!=null&&"sectors"in t.props}function j_(t,e){return e!=null&&"points"in t.props}function Cat(t,e){var n,r,i=t.x===(e==null||(n=e.labelViewBox)===null||n===void 0?void 0:n.x)||t.x===e.x,s=t.y===(e==null||(r=e.labelViewBox)===null||r===void 0?void 0:r.y)||t.y===e.y;return i&&s}function kat(t,e){var n=t.endAngle===e.endAngle,r=t.startAngle===e.startAngle;return n&&r}function Eat(t,e){var n=t.x===e.x,r=t.y===e.y,i=t.z===e.z;return n&&r&&i}function Aat(t,e){var n;return LM(t,e)?n=Cat:$M(t,e)?n=kat:j_(t,e)&&(n=Eat),n}function Tat(t,e){var n;return LM(t,e)?n="trapezoids":$M(t,e)?n="sectors":j_(t,e)&&(n="points"),n}function Mat(t,e){if(LM(t,e)){var n;return(n=e.tooltipPayload)===null||n===void 0||(n=n[0])===null||n===void 0||(n=n.payload)===null||n===void 0?void 0:n.payload}if($M(t,e)){var r;return(r=e.tooltipPayload)===null||r===void 0||(r=r[0])===null||r===void 0||(r=r.payload)===null||r===void 0?void 0:r.payload}return j_(t,e)?e.payload:{}}function Pat(t){var e=t.activeTooltipItem,n=t.graphicalItem,r=t.itemData,i=Tat(n,e),s=Mat(n,e),a=r.filter(function(c,u){var d=Rh(s,c),f=n.props[i].filter(function(m){var x=Aat(n,e);return x(m,e)}),h=n.props[i].indexOf(f[f.length-1]),p=u===h;return d&&p}),l=r.indexOf(a[a.length-1]);return l}var QC;function Ev(t){"@babel/helpers - typeof";return Ev=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},Ev(t)}function ly(){return ly=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},ly.apply(this,arguments)}function rY(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Er(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?rY(Object(n),!0).forEach(function(r){el(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):rY(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Oat(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function iY(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,vfe(r.key),r)}}function Rat(t,e,n){return e&&iY(t.prototype,e),n&&iY(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Iat(t,e,n){return e=Y2(e),Dat(t,yfe()?Reflect.construct(e,n||[],Y2(t).constructor):e.apply(t,n))}function Dat(t,e){if(e&&(Ev(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Lat(t)}function Lat(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function yfe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(yfe=function(){return!!t})()}function Y2(t){return Y2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Y2(t)}function $at(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&w$(t,e)}function w$(t,e){return w$=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},w$(t,e)}function el(t,e,n){return e=vfe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function vfe(t){var e=Fat(t,"string");return Ev(e)=="symbol"?e:e+""}function Fat(t,e){if(Ev(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Ev(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var wc=function(t){function e(n){var r;return Oat(this,e),r=Iat(this,e,[n]),el(r,"pieRef",null),el(r,"sectorRefs",[]),el(r,"id",Cg("recharts-pie-")),el(r,"handleAnimationEnd",function(){var i=r.props.onAnimationEnd;r.setState({isAnimationFinished:!0}),Kt(i)&&i()}),el(r,"handleAnimationStart",function(){var i=r.props.onAnimationStart;r.setState({isAnimationFinished:!1}),Kt(i)&&i()}),r.state={isAnimationFinished:!n.isAnimationActive,prevIsAnimationActive:n.isAnimationActive,prevAnimationId:n.animationId,sectorToFocus:0},r}return $at(e,t),Rat(e,[{key:"isActiveIndex",value:function(r){var i=this.props.activeIndex;return Array.isArray(i)?i.indexOf(r)!==-1:r===i}},{key:"hasActiveIndex",value:function(){var r=this.props.activeIndex;return Array.isArray(r)?r.length!==0:r||r===0}},{key:"renderLabels",value:function(r){var i=this.props.isAnimationActive;if(i&&!this.state.isAnimationFinished)return null;var s=this.props,a=s.label,l=s.labelLine,c=s.dataKey,u=s.valueKey,d=Pt(this.props,!1),f=Pt(a,!1),h=Pt(l,!1),p=a&&a.offsetRadius||20,m=r.map(function(x,y){var g=(x.startAngle+x.endAngle)/2,w=Or(x.cx,x.cy,x.outerRadius+p,g),v=Er(Er(Er(Er({},d),x),{},{stroke:"none"},f),{},{index:y,textAnchor:e.getTextAnchor(w.x,x.cx)},w),N=Er(Er(Er(Er({},d),x),{},{fill:"none",stroke:x.fill},h),{},{index:y,points:[Or(x.cx,x.cy,x.outerRadius,g),w]}),S=c;return nn(c)&&nn(u)?S="value":nn(c)&&(S=u),te.createElement(kn,{key:"label-".concat(x.startAngle,"-").concat(x.endAngle,"-").concat(x.midAngle,"-").concat(y)},l&&e.renderLabelLineItem(l,N,"line"),e.renderLabelItem(a,v,gi(x,S)))});return te.createElement(kn,{className:"recharts-pie-labels"},m)}},{key:"renderSectorsStatically",value:function(r){var i=this,s=this.props,a=s.activeShape,l=s.blendStroke,c=s.inactiveShape;return r.map(function(u,d){if((u==null?void 0:u.startAngle)===0&&(u==null?void 0:u.endAngle)===0&&r.length!==1)return null;var f=i.isActiveIndex(d),h=c&&i.hasActiveIndex()?c:null,p=f?a:h,m=Er(Er({},u),{},{stroke:l?u.fill:u.stroke,tabIndex:-1});return te.createElement(kn,ly({ref:function(y){y&&!i.sectorRefs.includes(y)&&i.sectorRefs.push(y)},tabIndex:-1,className:"recharts-pie-sector"},Wm(i.props,u,d),{key:"sector-".concat(u==null?void 0:u.startAngle,"-").concat(u==null?void 0:u.endAngle,"-").concat(u.midAngle,"-").concat(d)}),te.createElement(xfe,ly({option:p,isActive:f,shapeType:"sector"},m)))})}},{key:"renderSectorsWithAnimation",value:function(){var r=this,i=this.props,s=i.sectors,a=i.isAnimationActive,l=i.animationBegin,c=i.animationDuration,u=i.animationEasing,d=i.animationId,f=this.state,h=f.prevSectors,p=f.prevIsAnimationActive;return te.createElement(mc,{begin:l,duration:c,isActive:a,easing:u,from:{t:0},to:{t:1},key:"pie-".concat(d,"-").concat(p),onAnimationStart:this.handleAnimationStart,onAnimationEnd:this.handleAnimationEnd},function(m){var x=m.t,y=[],g=s&&s[0],w=g.startAngle;return s.forEach(function(v,N){var S=h&&h[N],_=N>0?vi(v,"paddingAngle",0):0;if(S){var j=qi(S.endAngle-S.startAngle,v.endAngle-v.startAngle),A=Er(Er({},v),{},{startAngle:w+_,endAngle:w+j(x)+_});y.push(A),w=A.endAngle}else{var C=v.endAngle,k=v.startAngle,M=qi(0,C-k),I=M(x),R=Er(Er({},v),{},{startAngle:w+_,endAngle:w+I+_});y.push(R),w=R.endAngle}}),te.createElement(kn,null,r.renderSectorsStatically(y))})}},{key:"attachKeyboardHandlers",value:function(r){var i=this;r.onkeydown=function(s){if(!s.altKey)switch(s.key){case"ArrowLeft":{var a=++i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[a].focus(),i.setState({sectorToFocus:a});break}case"ArrowRight":{var l=--i.state.sectorToFocus<0?i.sectorRefs.length-1:i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[l].focus(),i.setState({sectorToFocus:l});break}case"Escape":{i.sectorRefs[i.state.sectorToFocus].blur(),i.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var r=this.props,i=r.sectors,s=r.isAnimationActive,a=this.state.prevSectors;return s&&i&&i.length&&(!a||!Rh(a,i))?this.renderSectorsWithAnimation():this.renderSectorsStatically(i)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var r=this,i=this.props,s=i.hide,a=i.sectors,l=i.className,c=i.label,u=i.cx,d=i.cy,f=i.innerRadius,h=i.outerRadius,p=i.isAnimationActive,m=this.state.isAnimationFinished;if(s||!a||!a.length||!Qe(u)||!Qe(d)||!Qe(f)||!Qe(h))return null;var x=an("recharts-pie",l);return te.createElement(kn,{tabIndex:this.props.rootTabIndex,className:x,ref:function(g){r.pieRef=g}},this.renderSectors(),c&&this.renderLabels(a),fs.renderCallByParent(this.props,null,!1),(!p||m)&&Qc.renderCallByParent(this.props,a,!1))}}],[{key:"getDerivedStateFromProps",value:function(r,i){return i.prevIsAnimationActive!==r.isAnimationActive?{prevIsAnimationActive:r.isAnimationActive,prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:[],isAnimationFinished:!0}:r.isAnimationActive&&r.animationId!==i.prevAnimationId?{prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:i.curSectors,isAnimationFinished:!0}:r.sectors!==i.curSectors?{curSectors:r.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(r,i){return r>i?"start":r<i?"end":"middle"}},{key:"renderLabelLineItem",value:function(r,i,s){if(te.isValidElement(r))return te.cloneElement(r,i);if(Kt(r))return r(i);var a=an("recharts-pie-label-line",typeof r!="boolean"?r.className:"");return te.createElement(jm,ly({},i,{key:s,type:"linear",className:a}))}},{key:"renderLabelItem",value:function(r,i,s){if(te.isValidElement(r))return te.cloneElement(r,i);var a=s;if(Kt(r)&&(a=r(i),te.isValidElement(a)))return a;var l=an("recharts-pie-label-text",typeof r!="boolean"&&!Kt(r)?r.className:"");return te.createElement(Gm,ly({},i,{alignmentBaseline:"middle",className:l}),a)}}])}(b.PureComponent);QC=wc;el(wc,"displayName","Pie");el(wc,"defaultProps",{stroke:"#fff",fill:"#808080",legendType:"rect",cx:"50%",cy:"50%",startAngle:0,endAngle:360,innerRadius:0,outerRadius:"80%",paddingAngle:0,labelLine:!0,hide:!1,minAngle:0,isAnimationActive:!Zh.isSsr,animationBegin:400,animationDuration:1500,animationEasing:"ease",nameKey:"name",blendStroke:!1,rootTabIndex:0});el(wc,"parseDeltaAngle",function(t,e){var n=da(e-t),r=Math.min(Math.abs(e-t),360);return n*r});el(wc,"getRealPieData",function(t){var e=t.data,n=t.children,r=Pt(t,!1),i=So(n,B0);return e&&e.length?e.map(function(s,a){return Er(Er(Er({payload:s},r),s),i&&i[a]&&i[a].props)}):i&&i.length?i.map(function(s){return Er(Er({},r),s.props)}):[]});el(wc,"parseCoordinateOfPie",function(t,e){var n=e.top,r=e.left,i=e.width,s=e.height,a=Kde(i,s),l=r+fa(t.cx,i,i/2),c=n+fa(t.cy,s,s/2),u=fa(t.innerRadius,a,0),d=fa(t.outerRadius,a,a*.8),f=t.maxRadius||Math.sqrt(i*i+s*s)/2;return{cx:l,cy:c,innerRadius:u,outerRadius:d,maxRadius:f}});el(wc,"getComposedData",function(t){var e=t.item,n=t.offset,r=e.type.defaultProps!==void 0?Er(Er({},e.type.defaultProps),e.props):e.props,i=QC.getRealPieData(r);if(!i||!i.length)return null;var s=r.cornerRadius,a=r.startAngle,l=r.endAngle,c=r.paddingAngle,u=r.dataKey,d=r.nameKey,f=r.valueKey,h=r.tooltipType,p=Math.abs(r.minAngle),m=QC.parseCoordinateOfPie(r,n),x=QC.parseDeltaAngle(a,l),y=Math.abs(x),g=u;nn(u)&&nn(f)?(lc(!1,`Use "dataKey" to specify the value of pie,
864      the props "valueKey" will be deprecated in 1.1.0`),g="value"):nn(u)&&(lc(!1,`Use "dataKey" to specify the value of pie,
865      the props "valueKey" will be deprecated in 1.1.0`),g=f);var w=i.filter(function(A){return gi(A,g,0)!==0}).length,v=(y>=360?w:w-1)*c,N=y-w*p-v,S=i.reduce(function(A,C){var k=gi(C,g,0);return A+(Qe(k)?k:0)},0),_;if(S>0){var j;_=i.map(function(A,C){var k=gi(A,g,0),M=gi(A,d,C),I=(Qe(k)?k:0)/S,R;C?R=j.endAngle+da(x)*c*(k!==0?1:0):R=a;var E=R+da(x)*((k!==0?p:0)+I*N),P=(R+E)/2,O=(m.innerRadius+m.outerRadius)/2,L=[{name:M,value:k,payload:A,dataKey:g,type:h}],T=Or(m.cx,m.cy,O,P);return j=Er(Er(Er({percent:I,cornerRadius:s,name:M,tooltipPayload:L,midAngle:P,middleRadius:O,tooltipPosition:T},A),m),{},{value:gi(A,g),startAngle:R,endAngle:E,payload:A,paddingAngle:da(x)*c}),j})}return Er(Er({},m),{},{sectors:_,data:i})});var Uat=Math.ceil,zat=Math.max;function Bat(t,e,n,r){for(var i=-1,s=zat(Uat((e-t)/(n||1)),0),a=Array(s);s--;)a[r?s:++i]=t,t+=n;return a}var Vat=Bat,Hat=Mue,sY=1/0,Wat=17976931348623157e292;function Gat(t){if(!t)return t===0?t:0;if(t=Hat(t),t===sY||t===-sY){var e=t<0?-1:1;return e*Wat}return t===t?t:0}var bfe=Gat,qat=Vat,Kat=HS,uI=bfe;function Yat(t){return function(e,n,r){return r&&typeof r!="number"&&Kat(e,n,r)&&(n=r=void 0),e=uI(e),n===void 0?(n=e,e=0):n=uI(n),r=r===void 0?e<n?1:-1:uI(r),qat(e,n,r,t)}}var Xat=Yat,Qat=Xat,Jat=Qat(),Zat=Jat;const X2=An(Zat);function C_(t){"@babel/helpers - typeof";return C_=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},C_(t)}function aY(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function oY(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?aY(Object(n),!0).forEach(function(r){wfe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):aY(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function wfe(t,e,n){return e=eot(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function eot(t){var e=tot(t,"string");return C_(e)=="symbol"?e:e+""}function tot(t,e){if(C_(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(C_(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var not=["Webkit","Moz","O","ms"],rot=function(e,n){var r=e.replace(/(\w)/,function(s){return s.toUpperCase()}),i=not.reduce(function(s,a){return oY(oY({},s),{},wfe({},a+r,n))},{});return i[e]=n,i};function Av(t){"@babel/helpers - typeof";return Av=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},Av(t)}function Q2(){return Q2=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Q2.apply(this,arguments)}function lY(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function dI(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?lY(Object(n),!0).forEach(function(r){ao(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):lY(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function iot(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function cY(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Sfe(r.key),r)}}function sot(t,e,n){return e&&cY(t.prototype,e),n&&cY(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function aot(t,e,n){return e=J2(e),oot(t,_fe()?Reflect.construct(e,n||[],J2(t).constructor):e.apply(t,n))}function oot(t,e){if(e&&(Av(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return lot(t)}function lot(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _fe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(_fe=function(){return!!t})()}function J2(t){return J2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},J2(t)}function cot(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_$(t,e)}function _$(t,e){return _$=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},_$(t,e)}function ao(t,e,n){return e=Sfe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Sfe(t){var e=uot(t,"string");return Av(e)=="symbol"?e:e+""}function uot(t,e){if(Av(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Av(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var dot=function(e){var n=e.data,r=e.startIndex,i=e.endIndex,s=e.x,a=e.width,l=e.travellerWidth;if(!n||!n.length)return{};var c=n.length,u=mh().domain(X2(0,c)).range([s,s+a-l]),d=u.domain().map(function(f){return u(f)});return{isTextActive:!1,isSlideMoving:!1,isTravellerMoving:!1,isTravellerFocused:!1,startX:u(r),endX:u(i),scale:u,scaleValues:d}},uY=function(e){return e.changedTouches&&!!e.changedTouches.length},Tv=function(t){function e(n){var r;return iot(this,e),r=aot(this,e,[n]),ao(r,"handleDrag",function(i){r.leaveTimer&&(clearTimeout(r.leaveTimer),r.leaveTimer=null),r.state.isTravellerMoving?r.handleTravellerMove(i):r.state.isSlideMoving&&r.handleSlideDrag(i)}),ao(r,"handleTouchMove",function(i){i.changedTouches!=null&&i.changedTouches.length>0&&r.handleDrag(i.changedTouches[0])}),ao(r,"handleDragEnd",function(){r.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var i=r.props,s=i.endIndex,a=i.onDragEnd,l=i.startIndex;a==null||a({endIndex:s,startIndex:l})}),r.detachDragEndListener()}),ao(r,"handleLeaveWrapper",function(){(r.state.isTravellerMoving||r.state.isSlideMoving)&&(r.leaveTimer=window.setTimeout(r.handleDragEnd,r.props.leaveTimeOut))}),ao(r,"handleEnterSlideOrTraveller",function(){r.setState({isTextActive:!0})}),ao(r,"handleLeaveSlideOrTraveller",function(){r.setState({isTextActive:!1})}),ao(r,"handleSlideDragStart",function(i){var s=uY(i)?i.changedTouches[0]:i;r.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:s.pageX}),r.attachDragEndListener()}),r.travellerDragStartHandlers={startX:r.handleTravellerDragStart.bind(r,"startX"),endX:r.handleTravellerDragStart.bind(r,"endX")},r.state={},r}return cot(e,t),sot(e,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(r){var i=r.startX,s=r.endX,a=this.state.scaleValues,l=this.props,c=l.gap,u=l.data,d=u.length-1,f=Math.min(i,s),h=Math.max(i,s),p=e.getIndexInRange(a,f),m=e.getIndexInRange(a,h);return{startIndex:p-p%c,endIndex:m===d?d:m-m%c}}},{key:"getTextOfTick",value:function(r){var i=this.props,s=i.data,a=i.tickFormatter,l=i.dataKey,c=gi(s[r],l,r);return Kt(a)?a(c,r):c}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(r){var i=this.state,s=i.slideMoveStartX,a=i.startX,l=i.endX,c=this.props,u=c.x,d=c.width,f=c.travellerWidth,h=c.startIndex,p=c.endIndex,m=c.onChange,x=r.pageX-s;x>0?x=Math.min(x,u+d-f-l,u+d-f-a):x<0&&(x=Math.max(x,u-a,u-l));var y=this.getIndex({startX:a+x,endX:l+x});(y.startIndex!==h||y.endIndex!==p)&&m&&m(y),this.setState({startX:a+x,endX:l+x,slideMoveStartX:r.pageX})}},{key:"handleTravellerDragStart",value:function(r,i){var s=uY(i)?i.changedTouches[0]:i;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:r,brushMoveStartX:s.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(r){var i=this.state,s=i.brushMoveStartX,a=i.movingTravellerId,l=i.endX,c=i.startX,u=this.state[a],d=this.props,f=d.x,h=d.width,p=d.travellerWidth,m=d.onChange,x=d.gap,y=d.data,g={startX:this.state.startX,endX:this.state.endX},w=r.pageX-s;w>0?w=Math.min(w,f+h-p-u):w<0&&(w=Math.max(w,f-u)),g[a]=u+w;var v=this.getIndex(g),N=v.startIndex,S=v.endIndex,_=function(){var A=y.length-1;return a==="startX"&&(l>c?N%x===0:S%x===0)||l<c&&S===A||a==="endX"&&(l>c?S%x===0:N%x===0)||l>c&&S===A};this.setState(ao(ao({},a,u+w),"brushMoveStartX",r.pageX),function(){m&&_()&&m(v)})}},{key:"handleTravellerMoveKeyboard",value:function(r,i){var s=this,a=this.state,l=a.scaleValues,c=a.startX,u=a.endX,d=this.state[i],f=l.indexOf(d);if(f!==-1){var h=f+r;if(!(h===-1||h>=l.length)){var p=l[h];i==="startX"&&p>=u||i==="endX"&&p<=c||this.setState(ao({},i,p),function(){s.props.onChange(s.getIndex({startX:s.state.startX,endX:s.state.endX}))})}}}},{key:"renderBackground",value:function(){var r=this.props,i=r.x,s=r.y,a=r.width,l=r.height,c=r.fill,u=r.stroke;return te.createElement("rect",{stroke:u,fill:c,x:i,y:s,width:a,height:l})}},{key:"renderPanorama",value:function(){var r=this.props,i=r.x,s=r.y,a=r.width,l=r.height,c=r.data,u=r.children,d=r.padding,f=b.Children.only(u);return f?te.cloneElement(f,{x:i,y:s,width:a,height:l,margin:d,compact:!0,data:c}):null}},{key:"renderTravellerLayer",value:function(r,i){var s,a,l=this,c=this.props,u=c.y,d=c.travellerWidth,f=c.height,h=c.traveller,p=c.ariaLabel,m=c.data,x=c.startIndex,y=c.endIndex,g=Math.max(r,this.props.x),w=dI(dI({},Pt(this.props,!1)),{},{x:g,y:u,width:d,height:f}),v=p||"Min value: ".concat((s=m[x])===null||s===void 0?void 0:s.name,", Max value: ").concat((a=m[y])===null||a===void 0?void 0:a.name);return te.createElement(kn,{tabIndex:0,role:"slider","aria-label":v,"aria-valuenow":r,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[i],onTouchStart:this.travellerDragStartHandlers[i],onKeyDown:function(S){["ArrowLeft","ArrowRight"].includes(S.key)&&(S.preventDefault(),S.stopPropagation(),l.handleTravellerMoveKeyboard(S.key==="ArrowRight"?1:-1,i))},onFocus:function(){l.setState({isTravellerFocused:!0})},onBlur:function(){l.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},e.renderTraveller(h,w))}},{key:"renderSlide",value:function(r,i){var s=this.props,a=s.y,l=s.height,c=s.stroke,u=s.travellerWidth,d=Math.min(r,i)+u,f=Math.max(Math.abs(i-r)-u,0);return te.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:c,fillOpacity:.2,x:d,y:a,width:f,height:l})}},{key:"renderText",value:function(){var r=this.props,i=r.startIndex,s=r.endIndex,a=r.y,l=r.height,c=r.travellerWidth,u=r.stroke,d=this.state,f=d.startX,h=d.endX,p=5,m={pointerEvents:"none",fill:u};return te.createElement(kn,{className:"recharts-brush-texts"},te.createElement(Gm,Q2({textAnchor:"end",verticalAnchor:"middle",x:Math.min(f,h)-p,y:a+l/2},m),this.getTextOfTick(i)),te.createElement(Gm,Q2({textAnchor:"start",verticalAnchor:"middle",x:Math.max(f,h)+c+p,y:a+l/2},m),this.getTextOfTick(s)))}},{key:"render",value:function(){var r=this.props,i=r.data,s=r.className,a=r.children,l=r.x,c=r.y,u=r.width,d=r.height,f=r.alwaysShowText,h=this.state,p=h.startX,m=h.endX,x=h.isTextActive,y=h.isSlideMoving,g=h.isTravellerMoving,w=h.isTravellerFocused;if(!i||!i.length||!Qe(l)||!Qe(c)||!Qe(u)||!Qe(d)||u<=0||d<=0)return null;var v=an("recharts-brush",s),N=te.Children.count(a)===1,S=rot("userSelect","none");return te.createElement(kn,{className:v,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:S},this.renderBackground(),N&&this.renderPanorama(),this.renderSlide(p,m),this.renderTravellerLayer(p,"startX"),this.renderTravellerLayer(m,"endX"),(x||y||g||w||f)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(r){var i=r.x,s=r.y,a=r.width,l=r.height,c=r.stroke,u=Math.floor(s+l/2)-1;return te.createElement(te.Fragment,null,te.createElement("rect",{x:i,y:s,width:a,height:l,fill:c,stroke:"none"}),te.createElement("line",{x1:i+1,y1:u,x2:i+a-1,y2:u,fill:"none",stroke:"#fff"}),te.createElement("line",{x1:i+1,y1:u+2,x2:i+a-1,y2:u+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(r,i){var s;return te.isValidElement(r)?s=te.cloneElement(r,i):Kt(r)?s=r(i):s=e.renderDefaultTraveller(i),s}},{key:"getDerivedStateFromProps",value:function(r,i){var s=r.data,a=r.width,l=r.x,c=r.travellerWidth,u=r.updateId,d=r.startIndex,f=r.endIndex;if(s!==i.prevData||u!==i.prevUpdateId)return dI({prevData:s,prevTravellerWidth:c,prevUpdateId:u,prevX:l,prevWidth:a},s&&s.length?dot({data:s,width:a,x:l,travellerWidth:c,startIndex:d,endIndex:f}):{scale:null,scaleValues:null});if(i.scale&&(a!==i.prevWidth||l!==i.prevX||c!==i.prevTravellerWidth)){i.scale.range([l,l+a-c]);var h=i.scale.domain().map(function(p){return i.scale(p)});return{prevData:s,prevTravellerWidth:c,prevUpdateId:u,prevX:l,prevWidth:a,startX:i.scale(r.startIndex),endX:i.scale(r.endIndex),scaleValues:h}}return null}},{key:"getIndexInRange",value:function(r,i){for(var s=r.length,a=0,l=s-1;l-a>1;){var c=Math.floor((a+l)/2);r[c]>i?l=c:a=c}return i>=r[l]?l:a}}])}(b.PureComponent);ao(Tv,"displayName","Brush");ao(Tv,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var fot=Y6;function hot(t,e){var n;return fot(t,function(r,i,s){return n=e(r,i,s),!n}),!!n}var pot=hot,mot=eue,got=bu,xot=pot,yot=ja,vot=HS;function bot(t,e,n){var r=yot(t)?mot:xot;return n&&vot(t,e,n)&&(e=void 0),r(t,got(e))}var wot=bot;const _ot=An(wot);var Jc=function(e,n){var r=e.alwaysShow,i=e.ifOverflow;return r&&(i="extendDomain"),i===n},dY=jue;function Sot(t,e,n){e=="__proto__"&&dY?dY(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}var FM=Sot,Not=FM,jot=_ue,Cot=bu;function kot(t,e){var n={};return e=Cot(e),jot(t,function(r,i,s){Not(n,i,e(r,i,s))}),n}var Eot=kot;const Aot=An(Eot);function Tot(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(!e(t[n],n,t))return!1;return!0}var Mot=Tot,Pot=Y6;function Oot(t,e){var n=!0;return Pot(t,function(r,i,s){return n=!!e(r,i,s),n}),n}var Rot=Oot,Iot=Mot,Dot=Rot,Lot=bu,$ot=ja,Fot=HS;function Uot(t,e,n){var r=$ot(t)?Iot:Dot;return n&&Fot(t,e,n)&&(e=void 0),r(t,Lot(e))}var zot=Uot;const Nfe=An(zot);var Bot=["x","y"];function k_(t){"@babel/helpers - typeof";return k_=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},k_(t)}function S$(){return S$=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},S$.apply(this,arguments)}function fY(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Eb(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?fY(Object(n),!0).forEach(function(r){Vot(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):fY(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Vot(t,e,n){return e=Hot(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Hot(t){var e=Wot(t,"string");return k_(e)=="symbol"?e:e+""}function Wot(t,e){if(k_(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(k_(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Got(t,e){if(t==null)return{};var n=qot(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function qot(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Kot(t,e){var n=t.x,r=t.y,i=Got(t,Bot),s="".concat(n),a=parseInt(s,10),l="".concat(r),c=parseInt(l,10),u="".concat(e.height||i.height),d=parseInt(u,10),f="".concat(e.width||i.width),h=parseInt(f,10);return Eb(Eb(Eb(Eb(Eb({},e),i),a?{x:a}:{}),c?{y:c}:{}),{},{height:d,width:h,name:e.name,radius:e.radius})}function hY(t){return te.createElement(xfe,S$({shapeType:"rectangle",propTransformer:Kot,activeClassName:"recharts-active-bar"},t))}var Yot=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(r,i){if(typeof e=="number")return e;var s=Qe(r)||S8e(r);return s?e(r,i):(s||Qm(),n)}},Xot=["value","background"],jfe;function Mv(t){"@babel/helpers - typeof";return Mv=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},Mv(t)}function Qot(t,e){if(t==null)return{};var n=Jot(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Jot(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Z2(){return Z2=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Z2.apply(this,arguments)}function pY(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ni(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?pY(Object(n),!0).forEach(function(r){Yf(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):pY(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Zot(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function mY(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,kfe(r.key),r)}}function elt(t,e,n){return e&&mY(t.prototype,e),n&&mY(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function tlt(t,e,n){return e=eE(e),nlt(t,Cfe()?Reflect.construct(e,n||[],eE(t).constructor):e.apply(t,n))}function nlt(t,e){if(e&&(Mv(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return rlt(t)}function rlt(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Cfe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Cfe=function(){return!!t})()}function eE(t){return eE=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},eE(t)}function ilt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&N$(t,e)}function N$(t,e){return N$=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},N$(t,e)}function Yf(t,e,n){return e=kfe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function kfe(t){var e=slt(t,"string");return Mv(e)=="symbol"?e:e+""}function slt(t,e){if(Mv(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Mv(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var qa=function(t){function e(){var n;Zot(this,e);for(var r=arguments.length,i=new Array(r),s=0;s<r;s++)i[s]=arguments[s];return n=tlt(this,e,[].concat(i)),Yf(n,"state",{isAnimationFinished:!1}),Yf(n,"id",Cg("recharts-bar-")),Yf(n,"handleAnimationEnd",function(){var a=n.props.onAnimationEnd;n.setState({isAnimationFinished:!0}),a&&a()}),Yf(n,"handleAnimationStart",function(){var a=n.props.onAnimationStart;n.setState({isAnimationFinished:!1}),a&&a()}),n}return ilt(e,t),elt(e,[{key:"renderRectanglesStatically",value:function(r){var i=this,s=this.props,a=s.shape,l=s.dataKey,c=s.activeIndex,u=s.activeBar,d=Pt(this.props,!1);return r&&r.map(function(f,h){var p=h===c,m=p?u:a,x=Ni(Ni(Ni({},d),f),{},{isActive:p,option:m,index:h,dataKey:l,onAnimationStart:i.handleAnimationStart,onAnimationEnd:i.handleAnimationEnd});return te.createElement(kn,Z2({className:"recharts-bar-rectangle"},Wm(i.props,f,h),{key:"rectangle-".concat(f==null?void 0:f.x,"-").concat(f==null?void 0:f.y,"-").concat(f==null?void 0:f.value,"-").concat(h)}),te.createElement(hY,x))})}},{key:"renderRectanglesWithAnimation",value:function(){var r=this,i=this.props,s=i.data,a=i.layout,l=i.isAnimationActive,c=i.animationBegin,u=i.animationDuration,d=i.animationEasing,f=i.animationId,h=this.state.prevData;return te.createElement(mc,{begin:c,duration:u,isActive:l,easing:d,from:{t:0},to:{t:1},key:"bar-".concat(f),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(p){var m=p.t,x=s.map(function(y,g){var w=h&&h[g];if(w){var v=qi(w.x,y.x),N=qi(w.y,y.y),S=qi(w.width,y.width),_=qi(w.height,y.height);return Ni(Ni({},y),{},{x:v(m),y:N(m),width:S(m),height:_(m)})}if(a==="horizontal"){var j=qi(0,y.height),A=j(m);return Ni(Ni({},y),{},{y:y.y+y.height-A,height:A})}var C=qi(0,y.width),k=C(m);return Ni(Ni({},y),{},{width:k})});return te.createElement(kn,null,r.renderRectanglesStatically(x))})}},{key:"renderRectangles",value:function(){var r=this.props,i=r.data,s=r.isAnimationActive,a=this.state.prevData;return s&&i&&i.length&&(!a||!Rh(a,i))?this.renderRectanglesWithAnimation():this.renderRectanglesStatically(i)}},{key:"renderBackground",value:function(){var r=this,i=this.props,s=i.data,a=i.dataKey,l=i.activeIndex,c=Pt(this.props.background,!1);return s.map(function(u,d){u.value;var f=u.background,h=Qot(u,Xot);if(!f)return null;var p=Ni(Ni(Ni(Ni(Ni({},h),{},{fill:"#eee"},f),c),Wm(r.props,u,d)),{},{onAnimationStart:r.handleAnimationStart,onAnimationEnd:r.handleAnimationEnd,dataKey:a,index:d,className:"recharts-bar-background-rectangle"});return te.createElement(hY,Z2({key:"background-bar-".concat(d),option:r.props.background,isActive:d===l},p))})}},{key:"renderErrorBar",value:function(r,i){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var s=this.props,a=s.data,l=s.xAxis,c=s.yAxis,u=s.layout,d=s.children,f=So(d,KS);if(!f)return null;var h=u==="vertical"?a[0].height/2:a[0].width/2,p=function(y,g){var w=Array.isArray(y.value)?y.value[1]:y.value;return{x:y.x,y:y.y,value:w,errorVal:gi(y,g)}},m={clipPath:r?"url(#clipPath-".concat(i,")"):null};return te.createElement(kn,m,f.map(function(x){return te.cloneElement(x,{key:"error-bar-".concat(i,"-").concat(x.props.dataKey),data:a,xAxis:l,yAxis:c,layout:u,offset:h,dataPointFormatter:p})}))}},{key:"render",value:function(){var r=this.props,i=r.hide,s=r.data,a=r.className,l=r.xAxis,c=r.yAxis,u=r.left,d=r.top,f=r.width,h=r.height,p=r.isAnimationActive,m=r.background,x=r.id;if(i||!s||!s.length)return null;var y=this.state.isAnimationFinished,g=an("recharts-bar",a),w=l&&l.allowDataOverflow,v=c&&c.allowDataOverflow,N=w||v,S=nn(x)?this.id:x;return te.createElement(kn,{className:g},w||v?te.createElement("defs",null,te.createElement("clipPath",{id:"clipPath-".concat(S)},te.createElement("rect",{x:w?u:u-f/2,y:v?d:d-h/2,width:w?f:f*2,height:v?h:h*2}))):null,te.createElement(kn,{className:"recharts-bar-rectangles",clipPath:N?"url(#clipPath-".concat(S,")"):null},m?this.renderBackground():null,this.renderRectangles()),this.renderErrorBar(N,S),(!p||y)&&Qc.renderCallByParent(this.props,s))}}],[{key:"getDerivedStateFromProps",value:function(r,i){return r.animationId!==i.prevAnimationId?{prevAnimationId:r.animationId,curData:r.data,prevData:i.curData}:r.data!==i.curData?{curData:r.data}:null}}])}(b.PureComponent);jfe=qa;Yf(qa,"displayName","Bar");Yf(qa,"defaultProps",{xAxisId:0,yAxisId:0,legendType:"rect",minPointSize:0,hide:!1,data:[],layout:"vertical",activeBar:!1,isAnimationActive:!Zh.isSsr,animationBegin:0,animationDuration:400,animationEasing:"ease"});Yf(qa,"getComposedData",function(t){var e=t.props,n=t.item,r=t.barPosition,i=t.bandSize,s=t.xAxis,a=t.yAxis,l=t.xAxisTicks,c=t.yAxisTicks,u=t.stackedData,d=t.dataStartIndex,f=t.displayedData,h=t.offset,p=ztt(r,n);if(!p)return null;var m=e.layout,x=n.type.defaultProps,y=x!==void 0?Ni(Ni({},x),n.props):n.props,g=y.dataKey,w=y.children,v=y.minPointSize,N=m==="horizontal"?a:s,S=u?N.scale.domain():null,_=Ktt({numericAxis:N}),j=So(w,B0),A=f.map(function(C,k){var M,I,R,E,P,O;u?M=Btt(u[d+k],S):(M=gi(C,g),Array.isArray(M)||(M=[_,M]));var L=Yot(v,jfe.defaultProps.minPointSize)(M[1],k);if(m==="horizontal"){var T,D=[a.scale(M[0]),a.scale(M[1])],F=D[0],q=D[1];I=oK({axis:s,ticks:l,bandSize:i,offset:p.offset,entry:C,index:k}),R=(T=q??F)!==null&&T!==void 0?T:void 0,E=p.size;var B=F-q;if(P=Number.isNaN(B)?0:B,O={x:I,y:a.y,width:E,height:a.height},Math.abs(L)>0&&Math.abs(P)<Math.abs(L)){var z=da(P||L)*(Math.abs(L)-Math.abs(P));R-=z,P+=z}}else{var H=[s.scale(M[0]),s.scale(M[1])],W=H[0],G=H[1];if(I=W,R=oK({axis:a,ticks:c,bandSize:i,offset:p.offset,entry:C,index:k}),E=G-W,P=p.size,O={x:s.x,y:R,width:s.width,height:P},Math.abs(L)>0&&Math.abs(E)<Math.abs(L)){var K=da(E||L)*(Math.abs(L)-Math.abs(E));E+=K}}return Ni(Ni(Ni({},C),{},{x:I,y:R,width:E,height:P,value:u?M:M[1],payload:C,background:O},j&&j[k]&&j[k].props),{},{tooltipPayload:[Gde(n,C)],tooltipPosition:{x:I+E/2,y:R+P/2}})});return Ni({data:A,layout:m},h)});function E_(t){"@babel/helpers - typeof";return E_=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},E_(t)}function alt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function gY(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Efe(r.key),r)}}function olt(t,e,n){return e&&gY(t.prototype,e),n&&gY(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function xY(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Bl(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?xY(Object(n),!0).forEach(function(r){UM(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):xY(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function UM(t,e,n){return e=Efe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Efe(t){var e=llt(t,"string");return E_(e)=="symbol"?e:e+""}function llt(t,e){if(E_(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(E_(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var kB=function(e,n,r,i,s){var a=e.width,l=e.height,c=e.layout,u=e.children,d=Object.keys(n),f={left:r.left,leftMirror:r.left,right:a-r.right,rightMirror:a-r.right,top:r.top,topMirror:r.top,bottom:l-r.bottom,bottomMirror:l-r.bottom},h=!!lo(u,qa);return d.reduce(function(p,m){var x=n[m],y=x.orientation,g=x.domain,w=x.padding,v=w===void 0?{}:w,N=x.mirror,S=x.reversed,_="".concat(y).concat(N?"Mirror":""),j,A,C,k,M;if(x.type==="number"&&(x.padding==="gap"||x.padding==="no-gap")){var I=g[1]-g[0],R=1/0,E=x.categoricalDomain.sort(C8e);if(E.forEach(function(H,W){W>0&&(R=Math.min((H||0)-(E[W-1]||0),R))}),Number.isFinite(R)){var P=R/I,O=x.layout==="vertical"?r.height:r.width;if(x.padding==="gap"&&(j=P*O/2),x.padding==="no-gap"){var L=fa(e.barCategoryGap,P*O),T=P*O/2;j=T-L-(T-L)/O*L}}}i==="xAxis"?A=[r.left+(v.left||0)+(j||0),r.left+r.width-(v.right||0)-(j||0)]:i==="yAxis"?A=c==="horizontal"?[r.top+r.height-(v.bottom||0),r.top+(v.top||0)]:[r.top+(v.top||0)+(j||0),r.top+r.height-(v.bottom||0)-(j||0)]:A=x.range,S&&(A=[A[1],A[0]]);var D=Bde(x,s,h),F=D.scale,q=D.realScaleType;F.domain(g).range(A),Vde(F);var B=Hde(F,Bl(Bl({},x),{},{realScaleType:q}));i==="xAxis"?(M=y==="top"&&!N||y==="bottom"&&N,C=r.left,k=f[_]-M*x.height):i==="yAxis"&&(M=y==="left"&&!N||y==="right"&&N,C=f[_]-M*x.width,k=r.top);var z=Bl(Bl(Bl({},x),B),{},{realScaleType:q,x:C,y:k,scale:F,width:i==="xAxis"?r.width:x.width,height:i==="yAxis"?r.height:x.height});return z.bandSize=L2(z,B),!x.hide&&i==="xAxis"?f[_]+=(M?-1:1)*z.height:x.hide||(f[_]+=(M?-1:1)*z.width),Bl(Bl({},p),{},UM({},m,z))},{})},Afe=function(e,n){var r=e.x,i=e.y,s=n.x,a=n.y;return{x:Math.min(r,s),y:Math.min(i,a),width:Math.abs(s-r),height:Math.abs(a-i)}},clt=function(e){var n=e.x1,r=e.y1,i=e.x2,s=e.y2;return Afe({x:n,y:r},{x:i,y:s})},Tfe=function(){function t(e){alt(this,t),this.scale=e}return olt(t,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=r.bandAware,s=r.position;if(n!==void 0){if(s)switch(s){case"start":return this.scale(n);case"middle":{var a=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+a}case"end":{var l=this.bandwidth?this.bandwidth():0;return this.scale(n)+l}default:return this.scale(n)}if(i){var c=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+c}return this.scale(n)}}},{key:"isInRange",value:function(n){var r=this.range(),i=r[0],s=r[r.length-1];return i<=s?n>=i&&n<=s:n>=s&&n<=i}}],[{key:"create",value:function(n){return new t(n)}}])}();UM(Tfe,"EPS",1e-4);var EB=function(e){var n=Object.keys(e).reduce(function(r,i){return Bl(Bl({},r),{},UM({},i,Tfe.create(e[i])))},{});return Bl(Bl({},n),{},{apply:function(i){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=s.bandAware,l=s.position;return Aot(i,function(c,u){return n[u].apply(c,{bandAware:a,position:l})})},isInRange:function(i){return Nfe(i,function(s,a){return n[a].isInRange(s)})}})};function ult(t){return(t%180+180)%180}var dlt=function(e){var n=e.width,r=e.height,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=ult(i),a=s*Math.PI/180,l=Math.atan(r/n),c=a>l&&a<Math.PI-l?r/Math.sin(a):n/Math.cos(a);return Math.abs(c)},flt=bu,hlt=Eg,plt=xM;function mlt(t){return function(e,n,r){var i=Object(e);if(!hlt(e)){var s=flt(n);e=plt(e),n=function(l){return s(i[l],l,i)}}var a=t(e,n,r);return a>-1?i[s?e[a]:a]:void 0}}var glt=mlt,xlt=bfe;function ylt(t){var e=xlt(t),n=e%1;return e===e?n?e-n:e:0}var vlt=ylt,blt=pue,wlt=bu,_lt=vlt,Slt=Math.max;function Nlt(t,e,n){var r=t==null?0:t.length;if(!r)return-1;var i=n==null?0:_lt(n);return i<0&&(i=Slt(r+i,0)),blt(t,wlt(e),i)}var jlt=Nlt,Clt=glt,klt=jlt,Elt=Clt(klt),Alt=Elt;const Tlt=An(Alt);var Mlt=ABe(function(t){return{x:t.left,y:t.top,width:t.width,height:t.height}},function(t){return["l",t.left,"t",t.top,"w",t.width,"h",t.height].join("")}),AB=b.createContext(void 0),TB=b.createContext(void 0),Mfe=b.createContext(void 0),Pfe=b.createContext({}),Ofe=b.createContext(void 0),Rfe=b.createContext(0),Ife=b.createContext(0),yY=function(e){var n=e.state,r=n.xAxisMap,i=n.yAxisMap,s=n.offset,a=e.clipPathId,l=e.children,c=e.width,u=e.height,d=Mlt(s);return te.createElement(AB.Provider,{value:r},te.createElement(TB.Provider,{value:i},te.createElement(Pfe.Provider,{value:s},te.createElement(Mfe.Provider,{value:d},te.createElement(Ofe.Provider,{value:a},te.createElement(Rfe.Provider,{value:u},te.createElement(Ife.Provider,{value:c},l)))))))},Plt=function(){return b.useContext(Ofe)},Dfe=function(e){var n=b.useContext(AB);n==null&&Qm();var r=n[e];return r==null&&Qm(),r},Olt=function(){var e=b.useContext(AB);return Ef(e)},Rlt=function(){var e=b.useContext(TB),n=Tlt(e,function(r){return Nfe(r.domain,Number.isFinite)});return n||Ef(e)},Lfe=function(e){var n=b.useContext(TB);n==null&&Qm();var r=n[e];return r==null&&Qm(),r},Ilt=function(){var e=b.useContext(Mfe);return e},Dlt=function(){return b.useContext(Pfe)},MB=function(){return b.useContext(Ife)},PB=function(){return b.useContext(Rfe)};function Pv(t){"@babel/helpers - typeof";return Pv=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},Pv(t)}function Llt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function $lt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ffe(r.key),r)}}function Flt(t,e,n){return e&&$lt(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ult(t,e,n){return e=tE(e),zlt(t,$fe()?Reflect.construct(e,n||[],tE(t).constructor):e.apply(t,n))}function zlt(t,e){if(e&&(Pv(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Blt(t)}function Blt(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function $fe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return($fe=function(){return!!t})()}function tE(t){return tE=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},tE(t)}function Vlt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&j$(t,e)}function j$(t,e){return j$=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},j$(t,e)}function vY(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function bY(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?vY(Object(n),!0).forEach(function(r){OB(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):vY(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function OB(t,e,n){return e=Ffe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ffe(t){var e=Hlt(t,"string");return Pv(e)=="symbol"?e:e+""}function Hlt(t,e){if(Pv(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Pv(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function Wlt(t,e){return Ylt(t)||Klt(t,e)||qlt(t,e)||Glt()}function Glt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
866In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qlt(t,e){if(t){if(typeof t=="string")return wY(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return wY(t,e)}}function wY(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Klt(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,a,l=[],c=!0,u=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(c=(r=s.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,i=d}finally{try{if(!c&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return l}}function Ylt(t){if(Array.isArray(t))return t}function C$(){return C$=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},C$.apply(this,arguments)}var Xlt=function(e,n){var r;return te.isValidElement(e)?r=te.cloneElement(e,n):Kt(e)?r=e(n):r=te.createElement("line",C$({},n,{className:"recharts-reference-line-line"})),r},Qlt=function(e,n,r,i,s,a,l,c,u){var d=s.x,f=s.y,h=s.width,p=s.height;if(r){var m=u.y,x=e.y.apply(m,{position:a});if(Jc(u,"discard")&&!e.y.isInRange(x))return null;var y=[{x:d+h,y:x},{x:d,y:x}];return c==="left"?y.reverse():y}if(n){var g=u.x,w=e.x.apply(g,{position:a});if(Jc(u,"discard")&&!e.x.isInRange(w))return null;var v=[{x:w,y:f+p},{x:w,y:f}];return l==="top"?v.reverse():v}if(i){var N=u.segment,S=N.map(function(_){return e.apply(_,{position:a})});return Jc(u,"discard")&&_ot(S,function(_){return!e.isInRange(_)})?null:S}return null};function Jlt(t){var e=t.x,n=t.y,r=t.segment,i=t.xAxisId,s=t.yAxisId,a=t.shape,l=t.className,c=t.alwaysShow,u=Plt(),d=Dfe(i),f=Lfe(s),h=Ilt();if(!u||!h)return null;lc(c===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var p=EB({x:d.scale,y:f.scale}),m=Xi(e),x=Xi(n),y=r&&r.length===2,g=Qlt(p,m,x,y,h,t.position,d.orientation,f.orientation,t);if(!g)return null;var w=Wlt(g,2),v=w[0],N=v.x,S=v.y,_=w[1],j=_.x,A=_.y,C=Jc(t,"hidden")?"url(#".concat(u,")"):void 0,k=bY(bY({clipPath:C},Pt(t,!0)),{},{x1:N,y1:S,x2:j,y2:A});return te.createElement(kn,{className:an("recharts-reference-line",l)},Xlt(a,k),fs.renderCallByParent(t,clt({x1:N,y1:S,x2:j,y2:A})))}var RB=function(t){function e(){return Llt(this,e),Ult(this,e,arguments)}return Vlt(e,t),Flt(e,[{key:"render",value:function(){return te.createElement(Jlt,this.props)}}])}(te.Component);OB(RB,"displayName","ReferenceLine");OB(RB,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,fill:"none",stroke:"#ccc",fillOpacity:1,strokeWidth:1,position:"middle"});function k$(){return k$=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},k$.apply(this,arguments)}function Ov(t){"@babel/helpers - typeof";return Ov=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},Ov(t)}function _Y(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function SY(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?_Y(Object(n),!0).forEach(function(r){zM(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):_Y(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Zlt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ect(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,zfe(r.key),r)}}function tct(t,e,n){return e&&ect(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function nct(t,e,n){return e=nE(e),rct(t,Ufe()?Reflect.construct(e,n||[],nE(t).constructor):e.apply(t,n))}function rct(t,e){if(e&&(Ov(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ict(t)}function ict(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Ufe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Ufe=function(){return!!t})()}function nE(t){return nE=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},nE(t)}function sct(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&E$(t,e)}function E$(t,e){return E$=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},E$(t,e)}function zM(t,e,n){return e=zfe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function zfe(t){var e=act(t,"string");return Ov(e)=="symbol"?e:e+""}function act(t,e){if(Ov(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Ov(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var oct=function(e){var n=e.x,r=e.y,i=e.xAxis,s=e.yAxis,a=EB({x:i.scale,y:s.scale}),l=a.apply({x:n,y:r},{bandAware:!0});return Jc(e,"discard")&&!a.isInRange(l)?null:l},BM=function(t){function e(){return Zlt(this,e),nct(this,e,arguments)}return sct(e,t),tct(e,[{key:"render",value:function(){var r=this.props,i=r.x,s=r.y,a=r.r,l=r.alwaysShow,c=r.clipPathId,u=Xi(i),d=Xi(s);if(lc(l===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.'),!u||!d)return null;var f=oct(this.props);if(!f)return null;var h=f.x,p=f.y,m=this.props,x=m.shape,y=m.className,g=Jc(this.props,"hidden")?"url(#".concat(c,")"):void 0,w=SY(SY({clipPath:g},Pt(this.props,!0)),{},{cx:h,cy:p});return te.createElement(kn,{className:an("recharts-reference-dot",y)},e.renderDot(x,w),fs.renderCallByParent(this.props,{x:h-a,y:p-a,width:2*a,height:2*a}))}}])}(te.Component);zM(BM,"displayName","ReferenceDot");zM(BM,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#fff",stroke:"#ccc",fillOpacity:1,strokeWidth:1});zM(BM,"renderDot",function(t,e){var n;return te.isValidElement(t)?n=te.cloneElement(t,e):Kt(t)?n=t(e):n=te.createElement(YS,k$({},e,{cx:e.cx,cy:e.cy,className:"recharts-reference-dot-dot"})),n});function A$(){return A$=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},A$.apply(this,arguments)}function Rv(t){"@babel/helpers - typeof";return Rv=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},Rv(t)}function NY(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function jY(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};
866e%2?NY(Object(n),!0).forEach(function(r){VM(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):NY(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function lct(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function cct(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Vfe(r.key),r)}}function uct(t,e,n){return e&&cct(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function dct(t,e,n){return e=rE(e),fct(t,Bfe()?Reflect.construct(e,n||[],rE(t).constructor):e.apply(t,n))}function fct(t,e){if(e&&(Rv(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return hct(t)}function hct(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Bfe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Bfe=function(){return!!t})()}
vendor: 92,504 bytes, lines 866-870
866function rE(t){return rE=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},rE(t)}function pct(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&T$(t,e)}function T$(t,e){return T$=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},T$(t,e)}function VM(t,e,n){return e=Vfe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Vfe(t){var e=mct(t,"string");return Rv(e)=="symbol"?e:e+""}function mct(t,e){if(Rv(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Rv(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var gct=function(e,n,r,i,s){var a=s.x1,l=s.x2,c=s.y1,u=s.y2,d=s.xAxis,f=s.yAxis;if(!d||!f)return null;var h=EB({x:d.scale,y:f.scale}),p={x:e?h.x.apply(a,{position:"start"}):h.x.rangeMin,y:r?h.y.apply(c,{position:"start"}):h.y.rangeMin},m={x:n?h.x.apply(l,{position:"end"}):h.x.rangeMax,y:i?h.y.apply(u,{position:"end"}):h.y.rangeMax};return Jc(s,"discard")&&(!h.isInRange(p)||!h.isInRange(m))?null:Afe(p,m)},Ih=function(t){function e(){return lct(this,e),dct(this,e,arguments)}return pct(e,t),uct(e,[{key:"render",value:function(){var r=this.props,i=r.x1,s=r.x2,a=r.y1,l=r.y2,c=r.className,u=r.alwaysShow,d=r.clipPathId;lc(u===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var f=Xi(i),h=Xi(s),p=Xi(a),m=Xi(l),x=this.props.shape;if(!f&&!h&&!p&&!m&&!x)return null;var y=gct(f,h,p,m,this.props);if(!y&&!x)return null;var g=Jc(this.props,"hidden")?"url(#".concat(d,")"):void 0;return te.createElement(kn,{className:an("recharts-reference-area",c)},e.renderRect(x,jY(jY({clipPath:g},Pt(this.props,!0)),y)),fs.renderCallByParent(this.props,y))}}])}(te.Component);VM(Ih,"displayName","ReferenceArea");VM(Ih,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#ccc",fillOpacity:.5,stroke:"none",strokeWidth:1});VM(Ih,"renderRect",function(t,e){var n;return te.isValidElement(t)?n=te.cloneElement(t,e):Kt(t)?n=t(e):n=te.createElement(CB,A$({},e,{className:"recharts-reference-area-rect"})),n});function Hfe(t,e,n){if(e<1)return[];if(e===1&&n===void 0)return t;for(var r=[],i=0;i<t.length;i+=e)r.push(t[i]);return r}function xct(t,e,n){var r={width:t.width+e.width,height:t.height+e.height};return dlt(r,n)}function yct(t,e,n){var r=n==="width",i=t.x,s=t.y,a=t.width,l=t.height;return e===1?{start:r?i:s,end:r?i+a:s+l}:{start:r?i+a:s+l,end:r?i:s}}function iE(t,e,n,r,i){if(t*e<t*r||t*e>t*i)return!1;var s=n();return t*(e-t*s/2-r)>=0&&t*(e+t*s/2-i)<=0}function vct(t,e){return Hfe(t,e+1)}function bct(t,e,n,r,i){for(var s=(r||[]).slice(),a=e.start,l=e.end,c=0,u=1,d=a,f=function(){var m=r==null?void 0:r[c];if(m===void 0)return{v:Hfe(r,u)};var x=c,y,g=function(){return y===void 0&&(y=n(m,x)),y},w=m.coordinate,v=c===0||iE(t,w,g,d,l);v||(c=0,d=a,u+=1),v&&(d=w+t*(g()/2+i),c+=u)},h;u<=s.length;)if(h=f(),h)return h.v;return[]}function A_(t){"@babel/helpers - typeof";return A_=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},A_(t)}function CY(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Hs(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?CY(Object(n),!0).forEach(function(r){wct(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):CY(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function wct(t,e,n){return e=_ct(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _ct(t){var e=Sct(t,"string");return A_(e)=="symbol"?e:e+""}function Sct(t,e){if(A_(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(A_(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Nct(t,e,n,r,i){for(var s=(r||[]).slice(),a=s.length,l=e.start,c=e.end,u=function(h){var p=s[h],m,x=function(){return m===void 0&&(m=n(p,h)),m};if(h===a-1){var y=t*(p.coordinate+t*x()/2-c);s[h]=p=Hs(Hs({},p),{},{tickCoord:y>0?p.coordinate-y*t:p.coordinate})}else s[h]=p=Hs(Hs({},p),{},{tickCoord:p.coordinate});var g=iE(t,p.tickCoord,x,l,c);g&&(c=p.tickCoord-t*(x()/2+i),s[h]=Hs(Hs({},p),{},{isShow:!0}))},d=a-1;d>=0;d--)u(d);return s}function jct(t,e,n,r,i,s){var a=(r||[]).slice(),l=a.length,c=e.start,u=e.end;if(s){var d=r[l-1],f=n(d,l-1),h=t*(d.coordinate+t*f/2-u);a[l-1]=d=Hs(Hs({},d),{},{tickCoord:h>0?d.coordinate-h*t:d.coordinate});var p=iE(t,d.tickCoord,function(){return f},c,u);p&&(u=d.tickCoord-t*(f/2+i),a[l-1]=Hs(Hs({},d),{},{isShow:!0}))}for(var m=s?l-1:l,x=function(w){var v=a[w],N,S=function(){return N===void 0&&(N=n(v,w)),N};if(w===0){var _=t*(v.coordinate-t*S()/2-c);a[w]=v=Hs(Hs({},v),{},{tickCoord:_<0?v.coordinate-_*t:v.coordinate})}else a[w]=v=Hs(Hs({},v),{},{tickCoord:v.coordinate});var j=iE(t,v.tickCoord,S,c,u);j&&(c=v.tickCoord+t*(S()/2+i),a[w]=Hs(Hs({},v),{},{isShow:!0}))},y=0;y<m;y++)x(y);return a}function IB(t,e,n){var r=t.tick,i=t.ticks,s=t.viewBox,a=t.minTickGap,l=t.orientation,c=t.interval,u=t.tickFormatter,d=t.unit,f=t.angle;if(!i||!i.length||!r)return[];if(Qe(c)||Zh.isSsr)return vct(i,typeof c=="number"&&Qe(c)?c:0);var h=[],p=l==="top"||l==="bottom"?"width":"height",m=d&&p==="width"?zw(d,{fontSize:e,letterSpacing:n}):{width:0,height:0},x=function(v,N){var S=Kt(u)?u(v.value,N):v.value;return p==="width"?xct(zw(S,{fontSize:e,letterSpacing:n}),m,f):zw(S,{fontSize:e,letterSpacing:n})[p]},y=i.length>=2?da(i[1].coordinate-i[0].coordinate):1,g=yct(s,y,p);return c==="equidistantPreserveStart"?bct(y,g,x,i,a):(c==="preserveStart"||c==="preserveStartEnd"?h=jct(y,g,x,i,a,c==="preserveStartEnd"):h=Nct(y,g,x,i,a),h.filter(function(w){return w.isShow}))}var Cct=["viewBox"],kct=["viewBox"],Ect=["ticks"];function Iv(t){"@babel/helpers - typeof";return Iv=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},Iv(t)}function cy(){return cy=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},cy.apply(this,arguments)}function kY(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ui(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?kY(Object(n),!0).forEach(function(r){DB(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):kY(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function fI(t,e){if(t==null)return{};var n=Act(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Act(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Tct(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function EY(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Gfe(r.key),r)}}function Mct(t,e,n){return e&&EY(t.prototype,e),n&&EY(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Pct(t,e,n){return e=sE(e),Oct(t,Wfe()?Reflect.construct(e,n||[],sE(t).constructor):e.apply(t,n))}function Oct(t,e){if(e&&(Iv(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Rct(t)}function Rct(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Wfe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Wfe=function(){return!!t})()}function sE(t){return sE=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},sE(t)}function Ict(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&M$(t,e)}function M$(t,e){return M$=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},M$(t,e)}function DB(t,e,n){return e=Gfe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Gfe(t){var e=Dct(t,"string");return Iv(e)=="symbol"?e:e+""}function Dct(t,e){if(Iv(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Iv(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var G0=function(t){function e(n){var r;return Tct(this,e),r=Pct(this,e,[n]),r.state={fontSize:"",letterSpacing:""},r}return Ict(e,t),Mct(e,[{key:"shouldComponentUpdate",value:function(r,i){var s=r.viewBox,a=fI(r,Cct),l=this.props,c=l.viewBox,u=fI(l,kct);return!Ey(s,c)||!Ey(a,u)||!Ey(i,this.state)}},{key:"componentDidMount",value:function(){var r=this.layerReference;if(r){var i=r.getElementsByClassName("recharts-cartesian-axis-tick-value")[0];i&&this.setState({fontSize:window.getComputedStyle(i).fontSize,letterSpacing:window.getComputedStyle(i).letterSpacing})}}},{key:"getTickLineCoord",value:function(r){var i=this.props,s=i.x,a=i.y,l=i.width,c=i.height,u=i.orientation,d=i.tickSize,f=i.mirror,h=i.tickMargin,p,m,x,y,g,w,v=f?-1:1,N=r.tickSize||d,S=Qe(r.tickCoord)?r.tickCoord:r.coordinate;switch(u){case"top":p=m=r.coordinate,y=a+ +!f*c,x=y-v*N,w=x-v*h,g=S;break;case"left":x=y=r.coordinate,m=s+ +!f*l,p=m-v*N,g=p-v*h,w=S;break;case"right":x=y=r.coordinate,m=s+ +f*l,p=m+v*N,g=p+v*h,w=S;break;default:p=m=r.coordinate,y=a+ +f*c,x=y+v*N,w=x+v*h,g=S;break}return{line:{x1:p,y1:x,x2:m,y2:y},tick:{x:g,y:w}}}},{key:"getTickTextAnchor",value:function(){var r=this.props,i=r.orientation,s=r.mirror,a;switch(i){case"left":a=s?"start":"end";break;case"right":a=s?"end":"start";break;default:a="middle";break}return a}},{key:"getTickVerticalAnchor",value:function(){var r=this.props,i=r.orientation,s=r.mirror,a="end";switch(i){case"left":case"right":a="middle";break;case"top":a=s?"start":"end";break;default:a=s?"end":"start";break}return a}},{key:"renderAxisLine",value:function(){var r=this.props,i=r.x,s=r.y,a=r.width,l=r.height,c=r.orientation,u=r.mirror,d=r.axisLine,f=Ui(Ui(Ui({},Pt(this.props,!1)),Pt(d,!1)),{},{fill:"none"});if(c==="top"||c==="bottom"){var h=+(c==="top"&&!u||c==="bottom"&&u);f=Ui(Ui({},f),{},{x1:i,y1:s+h*l,x2:i+a,y2:s+h*l})}else{var p=+(c==="left"&&!u||c==="right"&&u);f=Ui(Ui({},f),{},{x1:i+p*a,y1:s,x2:i+p*a,y2:s+l})}return te.createElement("line",cy({},f,{className:an("recharts-cartesian-axis-line",vi(d,"className"))}))}},{key:"renderTicks",value:function(r,i,s){var a=this,l=this.props,c=l.tickLine,u=l.stroke,d=l.tick,f=l.tickFormatter,h=l.unit,p=IB(Ui(Ui({},this.props),{},{ticks:r}),i,s),m=this.getTickTextAnchor(),x=this.getTickVerticalAnchor(),y=Pt(this.props,!1),g=Pt(d,!1),w=Ui(Ui({},y),{},{fill:"none"},Pt(c,!1)),v=p.map(function(N,S){var _=a.getTickLineCoord(N),j=_.line,A=_.tick,C=Ui(Ui(Ui(Ui({textAnchor:m,verticalAnchor:x},y),{},{stroke:"none",fill:u},g),A),{},{index:S,payload:N,visibleTicksCount:p.length,tickFormatter:f});return te.createElement(kn,cy({className:"recharts-cartesian-axis-tick",key:"tick-".concat(N.value,"-").concat(N.coordinate,"-").concat(N.tickCoord)},Wm(a.props,N,S)),c&&te.createElement("line",cy({},w,j,{className:an("recharts-cartesian-axis-tick-line",vi(c,"className"))})),d&&e.renderTickItem(d,C,"".concat(Kt(f)?f(N.value,S):N.value).concat(h||"")))});return te.createElement("g",{className:"recharts-cartesian-axis-ticks"},v)}},{key:"render",value:function(){var r=this,i=this.props,s=i.axisLine,a=i.width,l=i.height,c=i.ticksGenerator,u=i.className,d=i.hide;if(d)return null;var f=this.props,h=f.ticks,p=fI(f,Ect),m=h;return Kt(c)&&(m=h&&h.length>0?c(this.props):c(p)),a<=0||l<=0||!m||!m.length?null:te.createElement(kn,{className:an("recharts-cartesian-axis",u),ref:function(y){r.layerReference=y}},s&&this.renderAxisLine(),this.renderTicks(m,this.state.fontSize,this.state.letterSpacing),fs.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(r,i,s){var a,l=an(i.className,"recharts-cartesian-axis-tick-value");return te.isValidElement(r)?a=te.cloneElement(r,Ui(Ui({},i),{},{className:l})):Kt(r)?a=r(Ui(Ui({},i),{},{className:l})):a=te.createElement(Gm,cy({},i,{className:"recharts-cartesian-axis-tick-value"}),s),a}}])}(b.Component);DB(G0,"displayName","CartesianAxis");DB(G0,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"});var Lct=["x1","y1","x2","y2","key"],$ct=["offset"];function Jm(t){"@babel/helpers - typeof";return Jm=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},Jm(t)}function AY(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function qs(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?AY(Object(n),!0).forEach(function(r){Fct(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):AY(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Fct(t,e,n){return e=Uct(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Uct(t){var e=zct(t,"string");return Jm(e)=="symbol"?e:e+""}function zct(t,e){if(Jm(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Jm(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Zp(){return Zp=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Zp.apply(this,arguments)}function TY(t,e){if(t==null)return{};var n=Bct(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Bct(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var Vct=function(e){var n=e.fill;if(!n||n==="none")return null;var r=e.fillOpacity,i=e.x,s=e.y,a=e.width,l=e.height,c=e.ry;return te.createElement("rect",{x:i,y:s,ry:c,width:a,height:l,stroke:"none",fill:n,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function qfe(t,e){var n;if(te.isValidElement(t))n=te.cloneElement(t,e);else if(Kt(t))n=t(e);else{var r=e.x1,i=e.y1,s=e.x2,a=e.y2,l=e.key,c=TY(e,Lct),u=Pt(c,!1);u.offset;var d=TY(u,$ct);n=te.createElement("line",Zp({},d,{x1:r,y1:i,x2:s,y2:a,fill:"none",key:l}))}return n}function Hct(t){var e=t.x,n=t.width,r=t.horizontal,i=r===void 0?!0:r,s=t.horizontalPoints;if(!i||!s||!s.length)return null;var a=s.map(function(l,c){var u=qs(qs({},t),{},{x1:e,y1:l,x2:e+n,y2:l,key:"line-".concat(c),index:c});return qfe(i,u)});return te.createElement("g",{className:"recharts-cartesian-grid-horizontal"},a)}function Wct(t){var e=t.y,n=t.height,r=t.vertical,i=r===void 0?!0:r,s=t.verticalPoints;if(!i||!s||!s.length)return null;var a=s.map(function(l,c){var u=qs(qs({},t),{},{x1:l,y1:e,x2:l,y2:e+n,key:"line-".concat(c),index:c});return qfe(i,u)});return te.createElement("g",{className:"recharts-cartesian-grid-vertical"},a)}function Gct(t){var e=t.horizontalFill,n=t.fillOpacity,r=t.x,i=t.y,s=t.width,a=t.height,l=t.horizontalPoints,c=t.horizontal,u=c===void 0?!0:c;if(!u||!e||!e.length)return null;var d=l.map(function(h){return Math.round(h+i-i)}).sort(function(h,p){return h-p});i!==d[0]&&d.unshift(0);var f=d.map(function(h,p){var m=!d[p+1],x=m?i+a-h:d[p+1]-h;if(x<=0)return null;var y=p%e.length;return te.createElement("rect",{key:"react-".concat(p),y:h,x:r,height:x,width:s,stroke:"none",fill:e[y],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return te.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function qct(t){var e=t.vertical,n=e===void 0?!0:e,r=t.verticalFill,i=t.fillOpacity,s=t.x,a=t.y,l=t.width,c=t.height,u=t.verticalPoints;if(!n||!r||!r.length)return null;var d=u.map(function(h){return Math.round(h+s-s)}).sort(function(h,p){return h-p});s!==d[0]&&d.unshift(0);var f=d.map(function(h,p){var m=!d[p+1],x=m?s+l-h:d[p+1]-h;if(x<=0)return null;var y=p%r.length;return te.createElement("rect",{key:"react-".concat(p),x:h,y:a,width:x,height:c,stroke:"none",fill:r[y],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return te.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var Kct=function(e,n){var r=e.xAxis,i=e.width,s=e.height,a=e.offset;return zde(IB(qs(qs(qs({},G0.defaultProps),r),{},{ticks:nd(r,!0),viewBox:{x:0,y:0,width:i,height:s}})),a.left,a.left+a.width,n)},Yct=function(e,n){var r=e.yAxis,i=e.width,s=e.height,a=e.offset;return zde(IB(qs(qs(qs({},G0.defaultProps),r),{},{ticks:nd(r,!0),viewBox:{x:0,y:0,width:i,height:s}})),a.top,a.top+a.height,n)},sx={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function fd(t){var e,n,r,i,s,a,l=MB(),c=PB(),u=Dlt(),d=qs(qs({},t),{},{stroke:(e=t.stroke)!==null&&e!==void 0?e:sx.stroke,fill:(n=t.fill)!==null&&n!==void 0?n:sx.fill,horizontal:(r=t.horizontal)!==null&&r!==void 0?r:sx.horizontal,horizontalFill:(i=t.horizontalFill)!==null&&i!==void 0?i:sx.horizontalFill,vertical:(s=t.vertical)!==null&&s!==void 0?s:sx.vertical,verticalFill:(a=t.verticalFill)!==null&&a!==void 0?a:sx.verticalFill,x:Qe(t.x)?t.x:u.left,y:Qe(t.y)?t.y:u.top,width:Qe(t.width)?t.width:u.width,height:Qe(t.height)?t.height:u.height}),f=d.x,h=d.y,p=d.width,m=d.height,x=d.syncWithTicks,y=d.horizontalValues,g=d.verticalValues,w=Olt(),v=Rlt();if(!Qe(p)||p<=0||!Qe(m)||m<=0||!Qe(f)||f!==+f||!Qe(h)||h!==+h)return null;var N=d.verticalCoordinatesGenerator||Kct,S=d.horizontalCoordinatesGenerator||Yct,_=d.horizontalPoints,j=d.verticalPoints;if((!_||!_.length)&&Kt(S)){var A=y&&y.length,C=S({yAxis:v?qs(qs({},v),{},{ticks:A?y:v.ticks}):void 0,width:l,height:c,offset:u},A?!0:x);lc(Array.isArray(C),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(Jm(C),"]")),Array.isArray(C)&&(_=C)}if((!j||!j.length)&&Kt(N)){var k=g&&g.length,M=N({xAxis:w?qs(qs({},w),{},{ticks:k?g:w.ticks}):void 0,width:l,height:c,offset:u},k?!0:x);lc(Array.isArray(M),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(Jm(M),"]")),Array.isArray(M)&&(j=M)}return te.createElement("g",{className:"recharts-cartesian-grid"},te.createElement(Vct,{fill:d.fill,fillOpacity:d.fillOpacity,x:d.x,y:d.y,width:d.width,height:d.height,ry:d.ry}),te.createElement(Hct,Zp({},d,{offset:u,horizontalPoints:_,xAxis:w,yAxis:v})),te.createElement(Wct,Zp({},d,{offset:u,verticalPoints:j,xAxis:w,yAxis:v})),te.createElement(Gct,Zp({},d,{horizontalPoints:_})),te.createElement(qct,Zp({},d,{verticalPoints:j})))}fd.displayName="CartesianGrid";var Xct=["type","layout","connectNulls","ref"],Qct=["key"];function Dv(t){"@babel/helpers - typeof";return Dv=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},Dv(t)}function MY(t,e){if(t==null)return{};var n=Jct(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Jct(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Gw(){return Gw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Gw.apply(this,arguments)}function PY(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function so(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?PY(Object(n),!0).forEach(function(r){Vl(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):PY(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function ax(t){return nut(t)||tut(t)||eut(t)||Zct()}function Zct(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
867In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function eut(t,e){if(t){if(typeof t=="string")return P$(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return P$(t,e)}}function tut(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function nut(t){if(Array.isArray(t))return P$(t)}function P$(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function rut(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function OY(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Yfe(r.key),r)}}function iut(t,e,n){return e&&OY(t.prototype,e),n&&OY(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function sut(t,e,n){return e=aE(e),aut(t,Kfe()?Reflect.construct(e,n||[],aE(t).constructor):e.apply(t,n))}function aut(t,e){if(e&&(Dv(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return out(t)}function out(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Kfe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Kfe=function(){return!!t})()}function aE(t){return aE=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},aE(t)}function lut(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&O$(t,e)}function O$(t,e){return O$=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},O$(t,e)}function Vl(t,e,n){return e=Yfe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Yfe(t){var e=cut(t,"string");return Dv(e)=="symbol"?e:e+""}function cut(t,e){if(Dv(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Dv(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var Po=function(t){function e(){var n;rut(this,e);for(var r=arguments.length,i=new Array(r),s=0;s<r;s++)i[s]=arguments[s];return n=sut(this,e,[].concat(i)),Vl(n,"state",{isAnimationFinished:!0,totalLength:0}),Vl(n,"generateSimpleStrokeDasharray",function(a,l){return"".concat(l,"px ").concat(a-l,"px")}),Vl(n,"getStrokeDasharray",function(a,l,c){var u=c.reduce(function(g,w){return g+w});if(!u)return n.generateSimpleStrokeDasharray(l,a);for(var d=Math.floor(a/u),f=a%u,h=l-a,p=[],m=0,x=0;m<c.length;x+=c[m],++m)if(x+c[m]>f){p=[].concat(ax(c.slice(0,m)),[f-x]);break}var y=p.length%2===0?[0,h]:[h];return[].concat(ax(e.repeat(c,d)),ax(p),y).map(function(g){return"".concat(g,"px")}).join(", ")}),Vl(n,"id",Cg("recharts-line-")),Vl(n,"pathRef",function(a){n.mainCurve=a}),Vl(n,"handleAnimationEnd",function(){n.setState({isAnimationFinished:!0}),n.props.onAnimationEnd&&n.props.onAnimationEnd()}),Vl(n,"handleAnimationStart",function(){n.setState({isAnimationFinished:!1}),n.props.onAnimationStart&&n.props.onAnimationStart()}),n}return lut(e,t),iut(e,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var r=this.getTotalLength();this.setState({totalLength:r})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var r=this.getTotalLength();r!==this.state.totalLength&&this.setState({totalLength:r})}}},{key:"getTotalLength",value:function(){var r=this.mainCurve;try{return r&&r.getTotalLength&&r.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(r,i){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var s=this.props,a=s.points,l=s.xAxis,c=s.yAxis,u=s.layout,d=s.children,f=So(d,KS);if(!f)return null;var h=function(x,y){return{x:x.x,y:x.y,value:x.value,errorVal:gi(x.payload,y)}},p={clipPath:r?"url(#clipPath-".concat(i,")"):null};return te.createElement(kn,p,f.map(function(m){return te.cloneElement(m,{key:"bar-".concat(m.props.dataKey),data:a,xAxis:l,yAxis:c,layout:u,dataPointFormatter:h})}))}},{key:"renderDots",value:function(r,i,s){var a=this.props.isAnimationActive;if(a&&!this.state.isAnimationFinished)return null;var l=this.props,c=l.dot,u=l.points,d=l.dataKey,f=Pt(this.props,!1),h=Pt(c,!0),p=u.map(function(x,y){var g=so(so(so({key:"dot-".concat(y),r:3},f),h),{},{index:y,cx:x.x,cy:x.y,value:x.value,dataKey:d,payload:x.payload,points:u});return e.renderDotItem(c,g)}),m={clipPath:r?"url(#clipPath-".concat(i?"":"dots-").concat(s,")"):null};return te.createElement(kn,Gw({className:"recharts-line-dots",key:"dots"},m),p)}},{key:"renderCurveStatically",value:function(r,i,s,a){var l=this.props,c=l.type,u=l.layout,d=l.connectNulls;l.ref;var f=MY(l,Xct),h=so(so(so({},Pt(f,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:i?"url(#clipPath-".concat(s,")"):null,points:r},a),{},{type:c,layout:u,connectNulls:d});return te.createElement(jm,Gw({},h,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(r,i){var s=this,a=this.props,l=a.points,c=a.strokeDasharray,u=a.isAnimationActive,d=a.animationBegin,f=a.animationDuration,h=a.animationEasing,p=a.animationId,m=a.animateNewValues,x=a.width,y=a.height,g=this.state,w=g.prevPoints,v=g.totalLength;return te.createElement(mc,{begin:d,duration:f,isActive:u,easing:h,from:{t:0},to:{t:1},key:"line-".concat(p),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(N){var S=N.t;if(w){var _=w.length/l.length,j=l.map(function(I,R){var E=Math.floor(R*_);if(w[E]){var P=w[E],O=qi(P.x,I.x),L=qi(P.y,I.y);return so(so({},I),{},{x:O(S),y:L(S)})}if(m){var T=qi(x*2,I.x),D=qi(y/2,I.y);return so(so({},I),{},{x:T(S),y:D(S)})}return so(so({},I),{},{x:I.x,y:I.y})});return s.renderCurveStatically(j,r,i)}var A=qi(0,v),C=A(S),k;if(c){var M="".concat(c).split(/[,\s]+/gim).map(function(I){return parseFloat(I)});k=s.getStrokeDasharray(C,v,M)}else k=s.generateSimpleStrokeDasharray(v,C);return s.renderCurveStatically(l,r,i,{strokeDasharray:k})})}},{key:"renderCurve",value:function(r,i){var s=this.props,a=s.points,l=s.isAnimationActive,c=this.state,u=c.prevPoints,d=c.totalLength;return l&&a&&a.length&&(!u&&d>0||!Rh(u,a))?this.renderCurveWithAnimation(r,i):this.renderCurveStatically(a,r,i)}},{key:"render",value:function(){var r,i=this.props,s=i.hide,a=i.dot,l=i.points,c=i.className,u=i.xAxis,d=i.yAxis,f=i.top,h=i.left,p=i.width,m=i.height,x=i.isAnimationActive,y=i.id;if(s||!l||!l.length)return null;var g=this.state.isAnimationFinished,w=l.length===1,v=an("recharts-line",c),N=u&&u.allowDataOverflow,S=d&&d.allowDataOverflow,_=N||S,j=nn(y)?this.id:y,A=(r=Pt(a,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},C=A.r,k=C===void 0?3:C,M=A.strokeWidth,I=M===void 0?2:M,R=gce(a)?a:{},E=R.clipDot,P=E===void 0?!0:E,O=k*2+I;return te.createElement(kn,{className:v},N||S?te.createElement("defs",null,te.createElement("clipPath",{id:"clipPath-".concat(j)},te.createElement("rect",{x:N?h:h-p/2,y:S?f:f-m/2,width:N?p:p*2,height:S?m:m*2})),!P&&te.createElement("clipPath",{id:"clipPath-dots-".concat(j)},te.createElement("rect",{x:h-O/2,y:f-O/2,width:p+O,height:m+O}))):null,!w&&this.renderCurve(_,j),this.renderErrorBar(_,j),(w||a)&&this.renderDots(_,P,j),(!x||g)&&Qc.renderCallByParent(this.props,l))}}],[{key:"getDerivedStateFromProps",value:function(r,i){return r.animationId!==i.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,prevPoints:i.curPoints}:r.points!==i.curPoints?{curPoints:r.points}:null}},{key:"repeat",value:function(r,i){for(var s=r.length%2!==0?[].concat(ax(r),[0]):r,a=[],l=0;l<i;++l)a=[].concat(ax(a),ax(s));return a}},{key:"renderDotItem",value:function(r,i){var s;if(te.isValidElement(r))s=te.cloneElement(r,i);else if(Kt(r))s=r(i);else{var a=i.key,l=MY(i,Qct),c=an("recharts-line-dot",typeof r!="boolean"?r.className:"");s=te.createElement(YS,Gw({key:a},l,{className:c}))}return s}}])}(b.PureComponent);Vl(Po,"displayName","Line");Vl(Po,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!Zh.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});Vl(Po,"getComposedData",function(t){var e=t.props,n=t.xAxis,r=t.yAxis,i=t.xAxisTicks,s=t.yAxisTicks,a=t.dataKey,l=t.bandSize,c=t.displayedData,u=t.offset,d=e.layout,f=c.map(function(h,p){var m=gi(h,a);return d==="horizontal"?{x:D2({axis:n,ticks:i,bandSize:l,entry:h,index:p}),y:nn(m)?null:r.scale(m),value:m,payload:h}:{x:nn(m)?null:n.scale(m),y:D2({axis:r,ticks:s,bandSize:l,entry:h,index:p}),value:m,payload:h}});return so({points:f,layout:d},u)});var uut=["layout","type","stroke","connectNulls","isRange","ref"],dut=["key"],Xfe;function Lv(t){"@babel/helpers - typeof";return Lv=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},Lv(t)}function Qfe(t,e){if(t==null)return{};var n=fut(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function fut(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function em(){return em=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},em.apply(this,arguments)}function RY(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function mf(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?RY(Object(n),!0).forEach(function(r){Vc(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):RY(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function hut(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function IY(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Zfe(r.key),r)}}function put(t,e,n){return e&&IY(t.prototype,e),n&&IY(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function mut(t,e,n){return e=oE(e),gut(t,Jfe()?Reflect.construct(e,n||[],oE(t).constructor):e.apply(t,n))}function gut(t,e){if(e&&(Lv(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return xut(t)}function xut(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Jfe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Jfe=function(){return!!t})()}function oE(t){return oE=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},oE(t)}function yut(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&R$(t,e)}function R$(t,e){return R$=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},R$(t,e)}function Vc(t,e,n){return e=Zfe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Zfe(t){var e=vut(t,"string");return Lv(e)=="symbol"?e:e+""}function vut(t,e){if(Lv(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Lv(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var yl=function(t){function e(){var n;hut(this,e);for(var r=arguments.length,i=new Array(r),s=0;s<r;s++)i[s]=arguments[s];return n=mut(this,e,[].concat(i)),Vc(n,"state",{isAnimationFinished:!0}),Vc(n,"id",Cg("recharts-area-")),Vc(n,"handleAnimationEnd",function(){var a=n.props.onAnimationEnd;n.setState({isAnimationFinished:!0}),Kt(a)&&a()}),Vc(n,"handleAnimationStart",function(){var a=n.props.onAnimationStart;n.setState({isAnimationFinished:!1}),Kt(a)&&a()}),n}return yut(e,t),put(e,[{key:"renderDots",value:function(r,i,s){var a=this.props.isAnimationActive,l=this.state.isAnimationFinished;if(a&&!l)return null;var c=this.props,u=c.dot,d=c.points,f=c.dataKey,h=Pt(this.props,!1),p=Pt(u,!0),m=d.map(function(y,g){var w=mf(mf(mf({key:"dot-".concat(g),r:3},h),p),{},{index:g,cx:y.x,cy:y.y,dataKey:f,value:y.value,payload:y.payload,points:d});return e.renderDotItem(u,w)}),x={clipPath:r?"url(#clipPath-".concat(i?"":"dots-").concat(s,")"):null};return te.createElement(kn,em({className:"recharts-area-dots"},x),m)}},{key:"renderHorizontalRect",value:function(r){var i=this.props,s=i.baseLine,a=i.points,l=i.strokeWidth,c=a[0].x,u=a[a.length-1].x,d=r*Math.abs(c-u),f=Kf(a.map(function(h){return h.y||0}));return Qe(s)&&typeof s=="number"?f=Math.max(s,f):s&&Array.isArray(s)&&s.length&&(f=Math.max(Kf(s.map(function(h){return h.y||0})),f)),Qe(f)?te.createElement("rect",{x:c<u?c:c-d,y:0,width:d,height:Math.floor(f+(l?parseInt("".concat(l),10):1))}):null}},{key:"renderVerticalRect",value:function(r){var i=this.props,s=i.baseLine,a=i.points,l=i.strokeWidth,c=a[0].y,u=a[a.length-1].y,d=r*Math.abs(c-u),f=Kf(a.map(function(h){return h.x||0}));return Qe(s)&&typeof s=="number"?f=Math.max(s,f):s&&Array.isArray(s)&&s.length&&(f=Math.max(Kf(s.map(function(h){return h.x||0})),f)),Qe(f)?te.createElement("rect",{x:0,y:c<u?c:c-d,width:f+(l?parseInt("".concat(l),10):1),height:Math.floor(d)}):null}},{key:"renderClipRect",value:function(r){var i=this.props.layout;return i==="vertical"?this.renderVerticalRect(r):this.renderHorizontalRect(r)}},{key:"renderAreaStatically",value:function(r,i,s,a){var l=this.props,c=l.layout,u=l.type,d=l.stroke,f=l.connectNulls,h=l.isRange;l.ref;var p=Qfe(l,uut);return te.createElement(kn,{clipPath:s?"url(#clipPath-".concat(a,")"):null},te.createElement(jm,em({},Pt(p,!0),{points:r,connectNulls:f,type:u,baseLine:i,layout:c,stroke:"none",className:"recharts-area-area"})),d!=="none"&&te.createElement(jm,em({},Pt(this.props,!1),{className:"recharts-area-curve",layout:c,type:u,connectNulls:f,fill:"none",points:r})),d!=="none"&&h&&te.createElement(jm,em({},Pt(this.props,!1),{className:"recharts-area-curve",layout:c,type:u,connectNulls:f,fill:"none",points:i})))}},{key:"renderAreaWithAnimation",value:function(r,i){var s=this,a=this.props,l=a.points,c=a.baseLine,u=a.isAnimationActive,d=a.animationBegin,f=a.animationDuration,h=a.animationEasing,p=a.animationId,m=this.state,x=m.prevPoints,y=m.prevBaseLine;return te.createElement(mc,{begin:d,duration:f,isActive:u,easing:h,from:{t:0},to:{t:1},key:"area-".concat(p),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(g){var w=g.t;if(x){var v=x.length/l.length,N=l.map(function(A,C){var k=Math.floor(C*v);if(x[k]){var M=x[k],I=qi(M.x,A.x),R=qi(M.y,A.y);return mf(mf({},A),{},{x:I(w),y:R(w)})}return A}),S;if(Qe(c)&&typeof c=="number"){var _=qi(y,c);S=_(w)}else if(nn(c)||$0(c)){var j=qi(y,0);S=j(w)}else S=c.map(function(A,C){var k=Math.floor(C*v);if(y[k]){var M=y[k],I=qi(M.x,A.x),R=qi(M.y,A.y);return mf(mf({},A),{},{x:I(w),y:R(w)})}return A});return s.renderAreaStatically(N,S,r,i)}return te.createElement(kn,null,te.createElement("defs",null,te.createElement("clipPath",{id:"animationClipPath-".concat(i)},s.renderClipRect(w))),te.createElement(kn,{clipPath:"url(#animationClipPath-".concat(i,")")},s.renderAreaStatically(l,c,r,i)))})}},{key:"renderArea",value:function(r,i){var s=this.props,a=s.points,l=s.baseLine,c=s.isAnimationActive,u=this.state,d=u.prevPoints,f=u.prevBaseLine,h=u.totalLength;return c&&a&&a.length&&(!d&&h>0||!Rh(d,a)||!Rh(f,l))?this.renderAreaWithAnimation(r,i):this.renderAreaStatically(a,l,r,i)}},{key:"render",value:function(){var r,i=this.props,s=i.hide,a=i.dot,l=i.points,c=i.className,u=i.top,d=i.left,f=i.xAxis,h=i.yAxis,p=i.width,m=i.height,x=i.isAnimationActive,y=i.id;if(s||!l||!l.length)return null;var g=this.state.isAnimationFinished,w=l.length===1,v=an("recharts-area",c),N=f&&f.allowDataOverflow,S=h&&h.allowDataOverflow,_=N||S,j=nn(y)?this.id:y,A=(r=Pt(a,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},C=A.r,k=C===void 0?3:C,M=A.strokeWidth,I=M===void 0?2:M,R=gce(a)?a:{},E=R.clipDot,P=E===void 0?!0:E,O=k*2+I;return te.createElement(kn,{className:v},N||S?te.createElement("defs",null,te.createElement("clipPath",{id:"clipPath-".concat(j)},te.createElement("rect",{x:N?d:d-p/2,y:S?u:u-m/2,width:N?p:p*2,height:S?m:m*2})),!P&&te.createElement("clipPath",{id:"clipPath-dots-".concat(j)},te.createElement("rect",{x:d-O/2,y:u-O/2,width:p+O,height:m+O}))):null,w?null:this.renderArea(_,j),(a||w)&&this.renderDots(_,P,j),(!x||g)&&Qc.renderCallByParent(this.props,l))}}],[{key:"getDerivedStateFromProps",value:function(r,i){return r.animationId!==i.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,curBaseLine:r.baseLine,prevPoints:i.curPoints,prevBaseLine:i.curBaseLine}:r.points!==i.curPoints||r.baseLine!==i.curBaseLine?{curPoints:r.points,curBaseLine:r.baseLine}:null}}])}(b.PureComponent);Xfe=yl;Vc(yl,"displayName","Area");Vc(yl,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!Zh.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});Vc(yl,"getBaseValue",function(t,e,n,r){var i=t.layout,s=t.baseValue,a=e.props.baseValue,l=a??s;if(Qe(l)&&typeof l=="number")return l;var c=i==="horizontal"?r:n,u=c.scale.domain();if(c.type==="number"){var d=Math.max(u[0],u[1]),f=Math.min(u[0],u[1]);return l==="dataMin"?f:l==="dataMax"||d<0?d:Math.max(Math.min(u[0],u[1]),0)}return l==="dataMin"?u[0]:l==="dataMax"?u[1]:u[0]});Vc(yl,"getComposedData",function(t){var e=t.props,n=t.item,r=t.xAxis,i=t.yAxis,s=t.xAxisTicks,a=t.yAxisTicks,l=t.bandSize,c=t.dataKey,u=t.stackedData,d=t.dataStartIndex,f=t.displayedData,h=t.offset,p=e.layout,m=u&&u.length,x=Xfe.getBaseValue(e,n,r,i),y=p==="horizontal",g=!1,w=f.map(function(N,S){var _;m?_=u[d+S]:(_=gi(N,c),Array.isArray(_)?g=!0:_=[x,_]);var j=_[1]==null||m&&gi(N,c)==null;return y?{x:D2({axis:r,ticks:s,bandSize:l,entry:N,index:S}),y:j?null:i.scale(_[1]),value:_,payload:N}:{x:j?null:r.scale(_[1]),y:D2({axis:i,ticks:a,bandSize:l,entry:N,index:S}),value:_,payload:N}}),v;return m||g?v=w.map(function(N){var S=Array.isArray(N.value)?N.value[0]:null;return y?{x:N.x,y:S!=null&&N.y!=null?i.scale(S):null}:{x:S!=null?r.scale(S):null,y:N.y}}):v=y?i.scale(x):r.scale(x),mf({points:w,baseLine:v,layout:p,isRange:g},h)});Vc(yl,"renderDotItem",function(t,e){var n;if(te.isValidElement(t))n=te.cloneElement(t,e);else if(Kt(t))n=t(e);else{var r=an("recharts-area-dot",typeof t!="boolean"?t.className:""),i=e.key,s=Qfe(e,dut);n=te.createElement(YS,em({},s,{key:i,className:r}))}return n});function $v(t){"@babel/helpers - typeof";return $v=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},$v(t)}function but(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function wut(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,nhe(r.key),r)}}function _ut(t,e,n){return e&&wut(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Sut(t,e,n){return e=lE(e),Nut(t,ehe()?Reflect.construct(e,n||[],lE(t).constructor):e.apply(t,n))}function Nut(t,e){if(e&&($v(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return jut(t)}function jut(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ehe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ehe=function(){return!!t})()}function lE(t){return lE=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},lE(t)}function Cut(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&I$(t,e)}function I$(t,e){return I$=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},I$(t,e)}function the(t,e,n){return e=nhe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function nhe(t){var e=kut(t,"string");return $v(e)=="symbol"?e:e+""}function kut(t,e){if($v(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if($v(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function D$(){return D$=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},D$.apply(this,arguments)}function Eut(t){var e=t.xAxisId,n=MB(),r=PB(),i=Dfe(e);return i==null?null:b.createElement(G0,D$({},i,{className:an("recharts-".concat(i.axisType," ").concat(i.axisType),i.className),viewBox:{x:0,y:0,width:n,height:r},ticksGenerator:function(a){return nd(a,!0)}}))}var No=function(t){function e(){return but(this,e),Sut(this,e,arguments)}return Cut(e,t),_ut(e,[{key:"render",value:function(){return b.createElement(Eut,this.props)}}])}(b.Component);the(No,"displayName","XAxis");the(No,"defaultProps",{allowDecimals:!0,hide:!1,orientation:"bottom",width:0,height:30,mirror:!1,xAxisId:0,tickCount:5,type:"category",padding:{left:0,right:0},allowDataOverflow:!1,scale:"auto",reversed:!1,allowDuplicatedCategory:!0});function Fv(t){"@babel/helpers - typeof";return Fv=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},Fv(t)}function Aut(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Tut(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,she(r.key),r)}}function Mut(t,e,n){return e&&Tut(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Put(t,e,n){return e=cE(e),Out(t,rhe()?Reflect.construct(e,n||[],cE(t).constructor):e.apply(t,n))}function Out(t,e){if(e&&(Fv(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Rut(t)}function Rut(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function rhe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(rhe=function(){return!!t})()}function cE(t){return cE=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},cE(t)}function Iut(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&L$(t,e)}function L$(t,e){return L$=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},L$(t,e)}function ihe(t,e,n){return e=she(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function she(t){var e=Dut(t,"string");return Fv(e)=="symbol"?e:e+""}function Dut(t,e){if(Fv(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Fv(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function $$(){return $$=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},$$.apply(this,arguments)}var Lut=function(e){var n=e.yAxisId,r=MB(),i=PB(),s=Lfe(n);return s==null?null:b.createElement(G0,$$({},s,{className:an("recharts-".concat(s.axisType," ").concat(s.axisType),s.className),viewBox:{x:0,y:0,width:r,height:i},ticksGenerator:function(l){return nd(l,!0)}}))},jo=function(t){function e(){return Aut(this,e),Put(this,e,arguments)}return Iut(e,t),Mut(e,[{key:"render",value:function(){return b.createElement(Lut,this.props)}}])}(b.Component);ihe(jo,"displayName","YAxis");ihe(jo,"defaultProps",{allowDuplicatedCategory:!0,allowDecimals:!0,hide:!1,orientation:"left",width:60,height:0,mirror:!1,yAxisId:0,tickCount:5,type:"number",padding:{top:0,bottom:0},allowDataOverflow:!1,scale:"auto",reversed:!1});function DY(t){return zut(t)||Uut(t)||Fut(t)||$ut()}function $ut(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
868In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Fut(t,e){if(t){if(typeof t=="string")return F$(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return F$(t,e)}}function Uut(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function zut(t){if(Array.isArray(t))return F$(t)}function F$(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var U$=function(e,n,r,i,s){var a=So(e,RB),l=So(e,BM),c=[].concat(DY(a),DY(l)),u=So(e,Ih),d="".concat(i,"Id"),f=i[0],h=n;if(c.length&&(h=c.reduce(function(x,y){if(y.props[d]===r&&Jc(y.props,"extendDomain")&&Qe(y.props[f])){var g=y.props[f];return[Math.min(x[0],g),Math.max(x[1],g)]}return x},h)),u.length){var p="".concat(f,"1"),m="".concat(f,"2");h=u.reduce(function(x,y){if(y.props[d]===r&&Jc(y.props,"extendDomain")&&Qe(y.props[p])&&Qe(y.props[m])){var g=y.props[p],w=y.props[m];return[Math.min(x[0],g,w),Math.max(x[1],g,w)]}return x},h)}return s&&s.length&&(h=s.reduce(function(x,y){return Qe(y)?[Math.min(x[0],y),Math.max(x[1],y)]:x},h)),h},ahe={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function i(c,u,d){this.fn=c,this.context=u,this.once=d||!1}function s(c,u,d,f,h){if(typeof d!="function")throw new TypeError("The listener must be a function");var p=new i(d,f||c,h),m=n?n+u:u;return c._events[m]?c._events[m].fn?c._events[m]=[c._events[m],p]:c._events[m].push(p):(c._events[m]=p,c._eventsCount++),c}function a(c,u){--c._eventsCount===0?c._events=new r:delete c._events[u]}function l(){this._events=new r,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],d,f;if(this._eventsCount===0)return u;for(f in d=this._events)e.call(d,f)&&u.push(n?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},l.prototype.listeners=function(u){var d=n?n+u:u,f=this._events[d];if(!f)return[];if(f.fn)return[f.fn];for(var h=0,p=f.length,m=new Array(p);h<p;h++)m[h]=f[h].fn;return m},l.prototype.listenerCount=function(u){var d=n?n+u:u,f=this._events[d];return f?f.fn?1:f.length:0},l.prototype.emit=function(u,d,f,h,p,m){var x=n?n+u:u;if(!this._events[x])return!1;var y=this._events[x],g=arguments.length,w,v;if(y.fn){switch(y.once&&this.removeListener(u,y.fn,void 0,!0),g){case 1:return y.fn.call(y.context),!0;case 2:return y.fn.call(y.context,d),!0;case 3:return y.fn.call(y.context,d,f),!0;case 4:return y.fn.call(y.context,d,f,h),!0;case 5:return y.fn.call(y.context,d,f,h,p),!0;case 6:return y.fn.call(y.context,d,f,h,p,m),!0}for(v=1,w=new Array(g-1);v<g;v++)w[v-1]=arguments[v];y.fn.apply(y.context,w)}else{var N=y.length,S;for(v=0;v<N;v++)switch(y[v].once&&this.removeListener(u,y[v].fn,void 0,!0),g){case 1:y[v].fn.call(y[v].context);break;case 2:y[v].fn.call(y[v].context,d);break;case 3:y[v].fn.call(y[v].context,d,f);break;case 4:y[v].fn.call(y[v].context,d,f,h);break;default:if(!w)for(S=1,w=new Array(g-1);S<g;S++)w[S-1]=arguments[S];y[v].fn.apply(y[v].context,w)}}return!0},l.prototype.on=function(u,d,f){return s(this,u,d,f,!1)},l.prototype.once=function(u,d,f){return s(this,u,d,f,!0)},l.prototype.removeListener=function(u,d,f,h){var p=n?n+u:u;if(!this._events[p])return this;if(!d)return a(this,p),this;var m=this._events[p];if(m.fn)m.fn===d&&(!h||m.once)&&(!f||m.context===f)&&a(this,p);else{for(var x=0,y=[],g=m.length;x<g;x++)(m[x].fn!==d||h&&!m[x].once||f&&m[x].context!==f)&&y.push(m[x]);y.length?this._events[p]=y.length===1?y[0]:y:a(this,p)}return this},l.prototype.removeAllListeners=function(u){var d;return u?(d=n?n+u:u,this._events[d]&&a(this,d)):(this._events=new r,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=n,l.EventEmitter=l,t.exports=l})(ahe);var But=ahe.exports;const Vut=An(But);var hI=new Vut,pI="recharts.syncMouseEvents";function T_(t){"@babel/helpers - typeof";return T_=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},T_(t)}function Hut(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Wut(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ohe(r.key),r)}}function Gut(t,e,n){return e&&Wut(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function mI(t,e,n){return e=ohe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ohe(t){var e=qut(t,"string");return T_(e)=="symbol"?e:e+""}function qut(t,e){if(T_(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(T_(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var Kut=function(){function t(){Hut(this,t),mI(this,"activeIndex",0),mI(this,"coordinateList",[]),mI(this,"layout","horizontal")}return Gut(t,[{key:"setDetails",value:function(n){var r,i=n.coordinateList,s=i===void 0?null:i,a=n.container,l=a===void 0?null:a,c=n.layout,u=c===void 0?null:c,d=n.offset,f=d===void 0?null:d,h=n.mouseHandlerCallback,p=h===void 0?null:h;this.coordinateList=(r=s??this.coordinateList)!==null&&r!==void 0?r:[],this.container=l??this.container,this.layout=u??this.layout,this.offset=f??this.offset,this.mouseHandlerCallback=p??this.mouseHandlerCallback,this.activeIndex=Math.min(Math.max(this.activeIndex,0),this.coordinateList.length-1)}},{key:"focus",value:function(){this.spoofMouse()}},{key:"keyboardEvent",value:function(n){if(this.coordinateList.length!==0)switch(n.key){case"ArrowRight":{if(this.layout!=="horizontal")return;this.activeIndex=Math.min(this.activeIndex+1,this.coordinateList.length-1),this.spoofMouse();break}case"ArrowLeft":{if(this.layout!=="horizontal")return;this.activeIndex=Math.max(this.activeIndex-1,0),this.spoofMouse();break}}}},{key:"setIndex",value:function(n){this.activeIndex=n}},{key:"spoofMouse",value:function(){var n,r;if(this.layout==="horizontal"&&this.coordinateList.length!==0){var i=this.container.getBoundingClientRect(),s=i.x,a=i.y,l=i.height,c=this.coordinateList[this.activeIndex].coordinate,u=((n=window)===null||n===void 0?void 0:n.scrollX)||0,d=((r=window)===null||r===void 0?void 0:r.scrollY)||0,f=s+c+u,h=a+this.offset.top+l/2+d;this.mouseHandlerCallback({pageX:f,pageY:h})}}}])}();function Yut(t,e,n){if(n==="number"&&e===!0&&Array.isArray(t)){var r=t==null?void 0:t[0],i=t==null?void 0:t[1];if(r&&i&&Qe(r)&&Qe(i))return!0}return!1}function Xut(t,e,n,r){var i=r/2;return{stroke:"none",fill:"#ccc",x:t==="horizontal"?e.x-i:n.left+.5,y:t==="horizontal"?n.top+.5:e.y-i,width:t==="horizontal"?r:n.width-1,height:t==="horizontal"?n.height-1:r}}function lhe(t){var e=t.cx,n=t.cy,r=t.radius,i=t.startAngle,s=t.endAngle,a=Or(e,n,r,i),l=Or(e,n,r,s);return{points:[a,l],cx:e,cy:n,radius:r,startAngle:i,endAngle:s}}function Qut(t,e,n){var r,i,s,a;if(t==="horizontal")r=e.x,s=r,i=n.top,a=n.top+n.height;else if(t==="vertical")i=e.y,a=i,r=n.left,s=n.left+n.width;else if(e.cx!=null&&e.cy!=null)if(t==="centric"){var l=e.cx,c=e.cy,u=e.innerRadius,d=e.outerRadius,f=e.angle,h=Or(l,c,u,f),p=Or(l,c,d,f);r=h.x,i=h.y,s=p.x,a=p.y}else return lhe(e);return[{x:r,y:i},{x:s,y:a}]}function M_(t){"@babel/helpers - typeof";return M_=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},M_(t)}function LY(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function vj(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?LY(Object(n),!0).forEach(function(r){Jut(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):LY(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Jut(t,e,n){return e=Zut(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Zut(t){var e=edt(t,"string");return M_(e)=="symbol"?e:e+""}function edt(t,e){if(M_(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(M_(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function tdt(t){var e,n,r=t.element,i=t.tooltipEventType,s=t.isActive,a=t.activeCoordinate,l=t.activePayload,c=t.offset,u=t.activeTooltipIndex,d=t.tooltipAxisBandSize,f=t.layout,h=t.chartName,p=(e=r.props.cursor)!==null&&e!==void 0?e:(n=r.type.defaultProps)===null||n===void 0?void 0:n.cursor;if(!r||!p||!s||!a||h!=="ScatterChart"&&i!=="axis")return null;var m,x=jm;if(h==="ScatterChart")m=a,x=hst;else if(h==="BarChart")m=Xut(f,a,c,d),x=CB;else if(f==="radial"){var y=lhe(a),g=y.cx,w=y.cy,v=y.radius,N=y.startAngle,S=y.endAngle;m={cx:g,cy:w,startAngle:N,endAngle:S,innerRadius:v,outerRadius:v},x=Jde}else m={points:Qut(f,a,c)},x=jm;var _=vj(vj(vj(vj({stroke:"#ccc",pointerEvents:"none"},c),m),Pt(p,!1)),{},{payload:l,payloadIndex:u,className:an("recharts-tooltip-cursor",p.className)});return b.isValidElement(p)?b.cloneElement(p,_):b.createElement(x,_)}var ndt=["item"],rdt=["children","className","width","height","style","compact","title","desc"];function Uv(t){"@babel/helpers - typeof";return Uv=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},Uv(t)}function uy(){return uy=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},uy.apply(this,arguments)}function $Y(t,e){return adt(t)||sdt(t,e)||uhe(t,e)||idt()}function idt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
869In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sdt(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,a,l=[],c=!0,u=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(c=(r=s.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,i=d}finally{try{if(!c&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return l}}function adt(t){if(Array.isArray(t))return t}function FY(t,e){if(t==null)return{};var n=odt(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function odt(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function ldt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function cdt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,dhe(r.key),r)}}function udt(t,e,n){return e&&cdt(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function ddt(t,e,n){return e=uE(e),fdt(t,che()?Reflect.construct(e,n||[],uE(t).constructor):e.apply(t,n))}function fdt(t,e){if(e&&(Uv(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return hdt(t)}function hdt(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function che(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(che=function(){return!!t})()}function uE(t){return uE=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},uE(t)}function pdt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&z$(t,e)}function z$(t,e){return z$=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},z$(t,e)}function zv(t){return xdt(t)||gdt(t)||uhe(t)||mdt()}function mdt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
870In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function uhe(t,e){if(t){if(typeof t=="string")return B$(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return B$(t,e)}}function gdt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function xdt(t){if(Array.isArray(t))return B$(t)}function B$(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function UY(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ze(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?UY(Object(n),!0).forEach(function(r){Yt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):UY(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Yt(t,e,n){return e=dhe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function dhe(t){var e=ydt(t,"string");return Uv(e)=="symbol"?e:e+""}function ydt(t,e){if(Uv(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Uv(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var vdt={xAxis:["bottom","top"],yAxis:["left","right"]},bdt={width:"100%",height:"100%"},fhe={x:0,y:0};function bj(t){return t}var wdt=function(e,n){return n==="horizontal"?e.x:n==="vertical"?e.y:n==="centric"?e.angle:e.radius},_dt=function(e,n,r,i){var s=n.find(function(d){return d&&d.index===r});if(s){if(e==="horizontal")return{x:s.coordinate,y:i.y};if(e==="vertical")return{x:i.x,y:s.coordinate};if(e==="centric"){var a=s.coordinate,l=i.radius;return ze(ze(ze({},i),Or(i.cx,i.cy,l,a)),{},{angle:a,radius:l})}var c=s.coordinate,u=i.angle;return ze(ze(ze({},i),Or(i.cx,i.cy,c,u)),{},{angle:u,radius:c})}return fhe},HM=function(e,n){var r=n.graphicalItems,i=n.dataStartIndex,s=n.dataEndIndex,a=(r??[]).reduce(function(l,c){var u=c.props.data;return u&&u.length?[].concat(zv(l),zv(u)):l},[]);return a.length>0?a:e&&e.length&&Qe(i)&&Qe(s)?e.slice(i,s+1):[]};function hhe(t){return t==="number"?[0,"auto"]:void 0}var V$=function(e,n,r,i){var s=e.graphicalItems,a=e.tooltipAxis,l=HM(n,e);return r<0||!s||!s.length||r>=l.length?null:s.reduce(function(c,u){var d,f=(d=u.props.data)!==null&&d!==void 0?d:n;f&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=r&&(f=f.slice(e.dataStartIndex,e.dataEndIndex+1));var h;if(a.dataKey&&!a.allowDuplicatedCategory){var p=f===void 0?l:f;h=u2(p,a.dataKey,i)}else h=f&&f[r]||l[r];return h?[].concat(zv(c),[Gde(u,h)]):c},[])},zY=function(e,n,r,i){var s=i||{x:e.chartX,y:e.chartY},a=wdt(s,r),l=e.orderedTooltipTicks,c=e.tooltipAxis,u=e.tooltipTicks,d=Itt(a,l,u,c);if(d>=0&&u){var f=u[d]&&u[d].value,h=V$(e,n,d,f),p=_dt(r,l,d,s);return{activeTooltipIndex:d,activeLabel:f,activePayload:h,activeCoordinate:p}}return null},Sdt=function(e,n){var r=n.axes,i=n.graphicalItems,s=n.axisType,a=n.axisIdKey,l=n.stackGroups,c=n.dataStartIndex,u=n.dataEndIndex,d=e.layout,f=e.children,h=e.stackOffset,p=Ude(d,s);return r.reduce(function(m,x){var y,g=x.type.defaultProps!==void 0?ze(ze({},x.type.defaultProps),x.props):x.props,w=g.type,v=g.dataKey,N=g.allowDataOverflow,S=g.allowDuplicatedCategory,_=g.scale,j=g.ticks,A=g.includeHidden,C=g[a];if(m[C])return m;var k=HM(e.data,{graphicalItems:i.filter(function(B){var z,H=a in B.props?B.props[a]:(z=B.type.defaultProps)===null||z===void 0?void 0:z[a];return H===C}),dataStartIndex:c,dataEndIndex:u}),M=k.length,I,R,E;Yut(g.domain,N,w)&&(I=n$(g.domain,null,N),p&&(w==="number"||_!=="auto")&&(E=Bw(k,v,"category")));var P=hhe(w);if(!I||I.length===0){var O,L=(O=g.domain)!==null&&O!==void 0?O:P;if(v){if(I=Bw(k,v,w),w==="category"&&p){var T=j8e(I);S&&T?(R=I,I=X2(0,M)):S||(I=uK(L,I,x).reduce(function(B,z){return B.indexOf(z)>=0?B:[].concat(zv(B),[z])},[]))}else if(w==="category")S?I=I.filter(function(B){return B!==""&&!nn(B)}):I=uK(L,I,x).reduce(function(B,z){return B.indexOf(z)>=0||z===""||nn(z)?B:[].concat(zv(B),[z])},[]);else if(w==="number"){var D=Utt(k,i.filter(function(B){var z,H,W=a in B.props?B.props[a]:(z=B.type.defaultProps)===null||z===void 0?void 0:z[a],G="hide"in B.props?B.props.hide:(H=B.type.defaultProps)===null||H===void 0?void 0:H.hide;return W===C&&(A||!G)}),v,s,d);D&&(I=D)}p&&(w==="number"||_!=="auto")&&(E=Bw(k,v,"category"))}else p?I=X2(0,M):l&&l[C]&&l[C].hasStack&&w==="number"?I=h==="expand"?[0,1]:Wde(l[C].stackGroups,c,u):I=Fde(k,i.filter(function(B){var z=a in B.props?B.props[a]:B.type.defaultProps[a],H="hide"in B.props?B.props.hide:B.type.defaultProps.hide;return z===C&&(A||!H)}),w,d,!0);if(w==="number")I=U$(f,I,C,s,j),L&&(I=n$(L,I,N));else if(w==="category"&&L){var F=L,q=I.every(function(B){return F.indexOf(B)>=0});q&&(I=F)}}return ze(ze({},m),{},Yt({},C,ze(ze({},g),{},{axisType:s,domain:I,categoricalDomain:E,duplicateDomain:R,originalDomain:(y=g.domain)!==null&&y!==void 0?y:P,isCategorical:p,layout:d})))},{})},Ndt=function(e,n){var r=n.graphicalItems,i=n.Axis,s=n.axisType,a=n.axisIdKey,l=n.stackGroups,c=n.dataStartIndex,u=n.dataEndIndex,d=e.layout,f=e.children,h=HM(e.data,{graphicalItems:r,dataStartIndex:c,dataEndIndex:u}),p=h.length,m=Ude(d,s),x=-1;return r.reduce(function(y,g){var w=g.type.defaultProps!==void 0?ze(ze({},g.type.defaultProps),g.props):g.props,v=w[a],N=hhe("number");if(!y[v]){x++;var S;return m?S=X2(0,p):l&&l[v]&&l[v].hasStack?(S=Wde(l[v].stackGroups,c,u),S=U$(f,S,v,s)):(S=n$(N,Fde(h,r.filter(function(_){var j,A,C=a in _.props?_.props[a]:(j=_.type.defaultProps)===null||j===void 0?void 0:j[a],k="hide"in _.props?_.props.hide:(A=_.type.defaultProps)===null||A===void 0?void 0:A.hide;return C===v&&!k}),"number",d),i.defaultProps.allowDataOverflow),S=U$(f,S,v,s)),ze(ze({},y),{},Yt({},v,ze(ze({axisType:s},i.defaultProps),{},{hide:!0,orientation:vi(vdt,"".concat(s,".").concat(x%2),null),domain:S,originalDomain:N,isCategorical:m,layout:d})))}return y},{})},jdt=function(e,n){var r=n.axisType,i=r===void 0?"xAxis":r,s=n.AxisComp,a=n.graphicalItems,l=n.stackGroups,c=n.dataStartIndex,u=n.dataEndIndex,d=e.children,f="".concat(i,"Id"),h=So(d,s),p={};return h&&h.length?p=Sdt(e,{axes:h,graphicalItems:a,axisType:i,axisIdKey:f,stackGroups:l,dataStartIndex:c,dataEndIndex:u}):a&&a.length&&(p=Ndt(e,{Axis:s,graphicalItems:a,axisType:i,axisIdKey:f,stackGroups:l,dataStartIndex:c,dataEndIndex:u})),p},Cdt=function(e){var n=Ef(e),r=nd(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:Q6(r,function(i){return i.coordinate}),tooltipAxis:n,tooltipAxisBandSize:L2(n,r)}},BY=function(e){var n=e.children,r=e.defaultShowTooltip,i=lo(n,Tv),s=0,a=0;return e.data&&e.data.length!==0&&(a=e.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(s=i.props.startIndex),i.props.endIndex>=0&&(a=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:s,dataEndIndex:a,activeTooltipIndex:-1,isTooltipActive:!!r}},kdt=function(e){return!e||!e.length?!1:e.some(function(n){var r=ld(n&&n.type);return r&&r.indexOf("Bar")>=0})},VY=function(e){return e==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:e==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:e==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},Edt=function(e,n){var r=e.props,i=e.graphicalItems,s=e.xAxisMap,a=s===void 0?{}:s,l=e.yAxisMap,c=l===void 0?{}:l,u=r.width,d=r.height,f=r.children,h=r.margin||{},p=lo(f,Tv),m=lo(f,cd),x=Object.keys(c).reduce(function(S,_){var j=c[_],A=j.orientation;return!j.mirror&&!j.hide?ze(ze({},S),{},Yt({},A,S[A]+j.width)):S},{left:h.left||0,right:h.right||0}),y=Object.keys(a).reduce(function(S,_){var j=a[_],A=j.orientation;return!j.mirror&&!j.hide?ze(ze({},S),{},Yt({},A,vi(S,"".concat(A))+j.height)):S},{top:h.top||0,bottom:h.bottom||0}),g=ze(ze({},y),x),w=g.bottom;p&&(g.bottom+=p.props.height||Tv.defaultProps.height),m&&n&&(g=$tt(g,i,r,n));var v=u-g.left-g.right,N=d-g.top-g.bottom;return ze(ze({brushBottom:w},g),{},{width:Math.max(v,0),height:Math.max(N,0)})},Adt=function(e,n){if(n==="xAxis")return e[n].width;if(n==="yAxis")return e[n].height},WM=function(e){var n=e.chartName,r=e.GraphicalChild,i=e.defaultTooltipEventType,s=i===void 0?"axis":i,a=e.validateTooltipEventTypes,l=a===void 0?["axis"]:a,c=e.axisComponents,u=e.legendContent,d=e.formatAxisMap,f=e.defaultProps,h=function(g,w){var v=w.graphicalItems,N=w.stackGroups,S=w.offset,_=w.updateId,j=w.dataStartIndex,A=w.dataEndIndex,C=g.barSize,k=g.layout,M=g.barGap,I=g.barCategoryGap,R=g.maxBarSize,E=VY(k),P=E.numericAxisName,O=E.cateAxisName,L=kdt(v),T=[];return v.forEach(function(D,F){var q=HM(g.data,{graphicalItems:[D],dataStartIndex:j,dataEndIndex:A}),B=D.type.defaultProps!==void 0?ze(ze({},D.type.defaultProps),D.props):D.props,z=B.dataKey,H=B.maxBarSize,W=B["".concat(P,"Id")],G=B["".concat(O,"Id")],K={},ee=c.reduce(function(U,Q){var oe=w["".concat(Q.axisType,"Map")],_e=B["".concat(Q.axisType,"Id")];oe&&oe[_e]||Q.axisType==="zAxis"||Qm();var ye=oe[_e];return ze(ze({},U),{},Yt(Yt({},Q.axisType,ye),"".concat(Q.axisType,"Ticks"),nd(ye)))},K),V=ee[O],J=ee["".concat(O,"Ticks")],Y=N&&N[W]&&N[W].hasStack&&Ytt(D,N[W].stackGroups),$=ld(D.type).indexOf("Bar")>=0,fe=L2(V,J),ce=[],ve=L&&Dtt({barSize:C,stackGroups:N,totalSize:Adt(ee,O)});if($){var X,de,Te=nn(H)?R:H,Pe=(X=(de=L2(V,J,!0))!==null&&de!==void 0?de:Te)!==null&&X!==void 0?X:0;ce=Ltt({barGap:M,barCategoryGap:I,bandSize:Pe!==fe?Pe:fe,sizeList:ve[G],maxBarSize:Te}),Pe!==fe&&(ce=ce.map(function(U){return ze(ze({},U),{},{position:ze(ze({},U.position),{},{offset:U.position.offset-Pe/2})})}))}var se=D&&D.type&&D.type.getComposedData;se&&T.push({props:ze(ze({},se(ze(ze({},ee),{},{displayedData:q,props:g,dataKey:z,item:D,bandSize:fe,barPosition:ce,offset:S,stackedData:Y,layout:k,dataStartIndex:j,dataEndIndex:A}))),{},Yt(Yt(Yt({key:D.key||"item-".concat(F)},P,ee[P]),O,ee[O]),"animationId",_)),childIndex:L8e(D,g.children),item:D})}),T},p=function(g,w){var v=g.props,N=g.dataStartIndex,S=g.dataEndIndex,_=g.updateId;if(!ZW({props:v}))return null;var j=v.children,A=v.layout,C=v.stackOffset,k=v.data,M=v.reverseStackOrder,I=VY(A),R=I.numericAxisName,E=I.cateAxisName,P=So(j,r),O=qtt(k,P,"".concat(R,"Id"),"".concat(E,"Id"),C,M),L=c.reduce(function(B,z){var H="".concat(z.axisType,"Map");return ze(ze({},B),{},Yt({},H,jdt(v,ze(ze({},z),{},{graphicalItems:P,stackGroups:z.axisType===R&&O,dataStartIndex:N,dataEndIndex:S}))))},{}),T=Edt(ze(ze({},L),{},{props:v,graphicalItems:P}),w==null?void 0:w.legendBBox);Object.keys(L).forEach(function(B){L[B]=d(v,L[B],T,B.replace("Map",""),n)});var D=L["".concat(E,"Map")],F=Cdt(D),q=h(v,ze(ze({},L),{},{dataStartIndex:N,dataEndIndex:S,updateId:_,graphicalItems:P,stackGroups:O,offset:T}));return ze(ze({formattedGraphicalItems:q,graphicalItems:P,offset:T,stackGroups:O},F),L)},m=function(y){function g(w){var v,N,S;return ldt(this,g),S=ddt(this,g,[w]),Yt(S,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),Yt(S,"accessibilityManager",new Kut),Yt(S,"handleLegendBBoxUpdate",function(_){if(_){var j=S.state,A=j.dataStartIndex,C=j.dataEndIndex,k=j.updateId;S.setState(ze({legendBBox:_},p({props:S.props,dataStartIndex:A,dataEndIndex:C,updateId:k},ze(ze({},S.state),{},{legendBBox:_}))))}}),Yt(S,"handleReceiveSyncEvent",function(_,j,A){if(S.props.syncId===_){if(A===S.eventEmitterSymbol&&typeof S.props.syncMethod!="function")return;S.applySyncEvent(j)}}),Yt(S,"handleBrushChange",function(_){var j=_.startIndex,A=_.endIndex;if(j!==S.state.dataStartIndex||A!==S.state.dataEndIndex){var C=S.state.updateId;S.setState(function(){return ze({dataStartIndex:j,dataEndIndex:A},p({props:S.props,dataStartIndex:j,dataEndIndex:A,updateId:C},S.state))}),S.triggerSyncEvent({dataStartIndex:j,dataEndIndex:A})}}),Yt(S,"handleMouseEnter",function(_){var j=S.getMouseInfo(_);if(j){var A=ze(ze({},j),{},{isTooltipActive:!0});S.setState(A),S.triggerSyncEvent(A);var C=S.props.onMouseEnter;Kt(C)&&C(A,_)}}),Yt(S,"triggeredAfterMouseMove",function(_){var j=S.getMouseInfo(_),A=j?ze(ze({},j),{},{isTooltipActive:!0}):{isTooltipActive:!1};S.setState(A),S.triggerSyncEvent(A);var C=S.props.onMouseMove;Kt(C)&&C(A,_)}),Yt(S,"handleItemMouseEnter",function(_){S.setState(function(){return{isTooltipActive:!0,activeItem:_,activePayload:_.tooltipPayload,activeCoordinate:_.tooltipPosition||{x:_.cx,y:_.cy}}})}),Yt(S,"handleItemMouseLeave",function(){S.setState(function(){return{isTooltipActive:!1}})}),Yt(S,"handleMouseMove",function(_){_.persist(),S.throttleTriggeredAfterMouseMove(_)}),Yt(S,"handleMouseLeave",function(_){S.throttleTriggeredAfterMouseMove.cancel();var j={isTooltipActive:!1};S.setState(j),S.triggerSyncEvent(j);var A=S.props.onMouseLeave;Kt(A)&&A(j,_)}),Yt(S,"handleOuterEvent",function(_){var j=D8e(_),A=vi(S.props,"".concat(j));if(j&&Kt(A)){var C,k;/.*touch.*/i.test(j)?k=S.getMouseInfo(_.changedTouches[0]):k=S.getMouseInfo(_),A((C=k)!==null&&C!==void 0?C:{},_)}}),Yt(S,"handleClick",function(_){var j=S.getMouseInfo(_);if(j){var A=ze(ze({},j),{},{isTooltipActive:!0});S.setState(A),S.triggerSyncEvent(A);var C=S.props.onClick;Kt(C)&&C(A,_)}}),Yt(S,"handleMouseDown",function(_){var j=S.props.onMouseDown;if(Kt(j)){var A=S.getMouseInfo(_);j(A,_)}}),Yt(S,"handleMouseUp",function(_){var j=S.props.onMouseUp;if(Kt(j)){var A=S.getMouseInfo(_);j(A,_)}}),Yt(S,"handleTouchMove",function(_){_.changedTouches!=null&&_.changedTouches.length>0&&S.throttleTriggeredAfterMouseMove(_.changedTouches[0])}),Yt(S,"handleTouchStart",function(_){_.changedTouches!=null&&_.changedTouches.length>0&&S.handleMouseDown(_.changedTouches[0])}),Yt(S,"handleTouchEnd",function(_){_.changedTouches!=null&&_.changedTouches.length>0&&S.handleMouseUp(_.changedTouches[0])}),Yt(S,"handleDoubleClick",function(_){var j=S.props.onDoubleClick;if(Kt(j)){var A=S.getMouseInfo(_);j(A,_)}}),Yt(S,"handleContextMenu",function(_){var j=S.props.onContextMenu;if(Kt(j)){var A=S.getMouseInfo(_);j(A,_)}}),Yt(S,"triggerSyncEvent",function(_){S.props.syncId!==void 0&&hI.emit(pI,S.props.syncId,_,S.eventEmitterSymbol)}),Yt(S,"applySyncEvent",function(_){var j=S.props,A=j.layout,C=j.syncMethod,k=S.state.updateId,M=_.dataStartIndex,I=_.dataEndIndex;if(_.dataStartIndex!==void 0||_.dataEndIndex!==void 0)S.setState(ze({dataStartIndex:M,dataEndIndex:I},p({props:S.props,dataStartIndex:M,dataEndIndex:I,updateId:k},S.state)));else if(_.activeTooltipIndex!==void 0){var R=_.chartX,E=_.chartY,P=_.activeTooltipIndex,O=S.state,L=O.offset,T=O.tooltipTicks;if(!L)return;if(typeof C=="function")P=C(T,_);else if(C==="value"){P=-1;for(var D=0;D<T.length;D++)if(T[D].value===_.activeLabel){P=D;break}}var F=ze(ze({},L),{},{x:L.left,y:L.top}),q=Math.min(R,F.x+F.width),B=Math.min(E,F.y+F.height),z=T[P]&&T[P].value,H=V$(S.state,S.props.data,P),W=T[P]?{x:A==="horizontal"?T[P].coordinate:q,y:A==="horizontal"?B:T[P].coordinate}:fhe;S.setState(ze(ze({},_),{},{activeLabel:z,activeCoordinate:W,activePayload:H,activeTooltipIndex:P}))}else S.setState(_)}),Yt(S,"renderCursor",function(_){var j,A=S.state,C=A.isTooltipActive,k=A.activeCoordinate,M=A.activePayload,I=A.offset,R=A.activeTooltipIndex,E=A.tooltipAxisBandSize,P=S.getTooltipEventType(),O=(j=_.props.active)!==null&&j!==void 0?j:C,L=S.props.layout,T=_.key||"_recharts-cursor";return te.createElement(tdt,{key:T,activeCoordinate:k,activePayload:M,activeTooltipIndex:R,chartName:n,element:_,isActive:O,layout:L,offset:I,tooltipAxisBandSize:E,tooltipEventType:P})}),Yt(S,"renderPolarAxis",function(_,j,A){var C=vi(_,"type.axisType"),k=vi(S.state,"".concat(C,"Map")),M=_.type.defaultProps,I=M!==void 0?ze(ze({},M),_.props):_.props,R=k&&k[I["".concat(C,"Id")]];return b.cloneElement(_,ze(ze({},R),{},{className:an(C,R.className),key:_.key||"".concat(j,"-").concat(A),ticks:nd(R,!0)}))}),Yt(S,"renderPolarGrid",function(_){var j=_.props,A=j.radialLines,C=j.polarAngles,k=j.polarRadius,M=S.state,I=M.radiusAxisMap,R=M.angleAxisMap,E=Ef(I),P=Ef(R),O=P.cx,L=P.cy,T=P.innerRadius,D=P.outerRadius;return b.cloneElement(_,{polarAngles:Array.isArray(C)?C:nd(P,!0).map(function(F){return F.coordinate}),polarRadius:Array.isArray(k)?k:nd(E,!0).map(function(F){return F.coordinate}),cx:O,cy:L,innerRadius:T,outerRadius:D,key:_.key||"polar-grid",radialLines:A})}),Yt(S,"renderLegend",function(){var _=S.state.formattedGraphicalItems,j=S.props,A=j.children,C=j.width,k=j.height,M=S.props.margin||{},I=C-(M.left||0)-(M.right||0),R=Lde({children:A,formattedGraphicalItems:_,legendWidth:I,legendContent:u});if(!R)return null;var E=R.item,P=FY(R,ndt);return b.cloneElement(E,ze(ze({},P),{},{chartWidth:C,chartHeight:k,margin:M,onBBoxUpdate:S.handleLegendBBoxUpdate}))}),Yt(S,"renderTooltip",function(){var _,j=S.props,A=j.children,C=j.accessibilityLayer,k=lo(A,Bn);if(!k)return null;var M=S.state,I=M.isTooltipActive,R=M.activeCoordinate,E=M.activePayload,P=M.activeLabel,O=M.offset,L=(_=k.props.active)!==null&&_!==void 0?_:I;return b.cloneElement(k,{viewBox:ze(ze({},O),{},{x:O.left,y:O.top}),active:L,label:P,payload:L?E:[],coordinate:R,accessibilityLayer:C})}),Yt(S,"renderBrush",function(_){var j=S.props,A=j.margin,C=j.data,k=S.state,M=k.offset,I=k.dataStartIndex,R=k.dataEndIndex,E=k.updateId;return b.cloneElement(_,{key:_.key||"_recharts-brush",onChange:mj(S.handleBrushChange,_.props.onChange),data:C,x:Qe(_.props.x)?_.props.x:M.left,y:Qe(_.props.y)?_.props.y:M.top+M.height+M.brushBottom-(A.bottom||0),width:Qe(_.props.width)?_.props.width:M.width,startIndex:I,endIndex:R,updateId:"brush-".concat(E)})}),Yt(S,"renderReferenceElement",function(_,j,A){if(!_)return null;var C=S,k=C.clipPathId,M=S.state,I=M.xAxisMap,R=M.yAxisMap,E=M.offset,P=_.type.defaultProps||{},O=_.props,L=O.xAxisId,T=L===void 0?P.xAxisId:L,D=O.yAxisId,F=D===void 0?P.yAxisId:D;return b.cloneElement(_,{key:_.key||"".concat(j,"-").concat(A),xAxis:I[T],yAxis:R[F],viewBox:{x:E.left,y:E.top,width:E.width,height:E.height},clipPathId:k})}),Yt(S,"renderActivePoints",function(_){var j=_.item,A=_.activePoint,C=_.basePoint,k=_.childIndex,M=_.isRange,I=[],R=j.props.key,E=j.item.type.defaultProps!==void 0?ze(ze({},j.item.type.defaultProps),j.item.props):j.item.props,P=E.activeDot,O=E.dataKey,L=ze(ze({index:k,dataKey:O,cx:A.x,cy:A.y,r:4,fill:jB(j.item),strokeWidth:2,stroke:"#fff",payload:A.payload,value:A.value},Pt(P,!1)),d2(P));return I.push(g.renderActiveDot(P,L,"".concat(R,"-activePoint-").concat(k))),C?I.push(g.renderActiveDot(P,ze(ze({},L),{},{cx:C.x,cy:C.y}),"".concat(R,"-basePoint-").concat(k))):M&&I.push(null),I}),Yt(S,"renderGraphicChild",function(_,j,A){var C=S.filterFormatItem(_,j,A);if(!C)return null;var k=S.getTooltipEventType(),M=S.state,I=M.isTooltipActive,R=M.tooltipAxis,E=M.activeTooltipIndex,P=M.activeLabel,O=S.props.children,L=lo(O,Bn),T=C.props,D=T.points,F=T.isRange,q=T.baseLine,B=C.item.type.defaultProps!==void 0?ze(ze({},C.item.type.defaultProps),C.item.props):C.item.props,z=B.activeDot,H=B.hide,W=B.activeBar,G=B.activeShape,K=!!(!H&&I&&L&&(z||W||G)),ee={};k!=="axis"&&L&&L.props.trigger==="click"?ee={onClick:mj(S.handleItemMouseEnter,_.props.onClick)}:k!=="axis"&&(ee={onMouseLeave:mj(S.handleItemMouseLeave,_.props.onMouseLeave),onMouseEnter:mj(S.handleItemMouseEnter,_.props.onMouseEnter)});var V=b.cloneElement(_,ze(ze({},C.props),ee));function J(Q){return typeof R.dataKey=="function"?R.dataKey(Q.payload):null}if(K)if(E>=0){var Y,$;if(R.dataKey&&!R.allowDuplicatedCategory){var fe=typeof R.dataKey=="function"?J:"payload.".concat(R.dataKey.toString());Y=u2(D,fe,P),$=F&&q&&u2(q,fe,P)}else Y=D==null?void 0:D[E],$=F&&q&&q[E];if(G||W){var ce=_.props.activeIndex!==void 0?_.props.activeIndex:E;return[b.cloneElement(_,ze(ze(ze({},C.props),ee),{},{activeIndex:ce})),null,null]}if(!nn(Y))return[V].concat(zv(S.renderActivePoints({item:C,activePoint:Y,basePoint:$,childIndex:E,isRange:F})))}else{var ve,X=(ve=S.getItemByXY(S.state.activeCoordinate))!==null&&ve!==void 0?ve:{graphicalItem:V},de=X.graphicalItem,Te=de.item,Pe=Te===void 0?_:Te,se=de.childIndex,U=ze(ze(ze({},C.props),ee),{},{activeIndex:se});return[b.cloneElement(Pe,U),null,null]}return F?[V,null,null]:[V,null]}),Yt(S,"renderCustomized",function(_,j,A){return b.cloneElement(_,ze(ze({key:"recharts-customized-".concat(A)},S.props),S.state))}),Yt(S,"renderMap",{CartesianGrid:{handler:bj,once:!0},ReferenceArea:{handler:S.renderReferenceElement},ReferenceLine:{handler:bj},ReferenceDot:{handler:S.renderReferenceElement},XAxis:{handler:bj},YAxis:{handler:bj},Brush:{handler:S.renderBrush,once:!0},Bar:{handler:S.renderGraphicChild},Line:{handler:S.renderGraphicChild},Area:{handler:S.renderGraphicChild},Radar:{handler:S.renderGraphicChild},RadialBar:{handler:S.renderGraphicChild},Scatter:{handler:S.renderGraphicChild},Pie:{handler:S.renderGraphicChild},Funnel:{handler:S.renderGraphicChild},Tooltip:{handler:S.renderCursor,once:!0},PolarGrid:{handler:S.renderPolarGrid,once:!0},PolarAngleAxis:{handler:S.renderPolarAxis},PolarRadiusAxis:{handler:S.renderPolarAxis},Customized:{handler:S.renderCustomized}}),S.clipPathId="".concat((v=w.id)!==null&&v!==void 0?v:Cg("recharts"),"-clip"),S.throttleTriggeredAfterMouseMove=Pue(S.triggeredAfterMouseMove,(N=w.throttleDelay)!==null&&N!==void 0?N:1e3/60),S.state={},S}return pdt(g,y),udt(g,[{key:"componentDidMount",value:function(){var v,N;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(v=this.props.margin.left)!==null&&v!==void 0?v:0,top:(N=this.props.margin.top)!==null&&N!==void 0?N:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var v=this.props,N=v.children,S=v.data,_=v.height,j=v.layout,A=lo(N,Bn);if(A){var C=A.props.defaultIndex;if(!(typeof C!="number"||C<0||C>this.state.tooltipTicks.length-1)){var k=this.state.tooltipTicks[C]&&this.state.tooltipTicks[C].value,M=V$(this.state,S,C,k),I=this.state.tooltipTicks[C].coordinate,R=(this.state.offset.top+_)/2,E=j==="horizontal",P=E?{x:I,y:R}:{y:I,x:R},O=this.state.formattedGraphicalItems.find(function(T){var D=T.item;return D.type.name==="Scatter"});O&&(P=ze(ze({},P),O.props.points[C].tooltipPosition),M=O.props.points[C].tooltipPayload);var L={activeTooltipIndex:C,isTooltipActive:!0,activeLabel:k,activePayload:M,activeCoordinate:P};this.setState(L),this.renderCursor(A),this.accessibilityManager.setIndex(C)}}}},{key:"getSnapshotBeforeUpdate",value:function(v,N){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==N.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==v.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==v.margin){var S,_;this.accessibilityManager.setDetails({offset:{left:(S=this.props.margin.left)!==null&&S!==void 0?S:0,top:(_=this.props.margin.top)!==null&&_!==void 0?_:0}})}return null}},{key:"componentDidUpdate",value:function(v){xL([lo(v.children,Bn)],[lo(this.props.children,Bn)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var v=lo(this.props.children,Bn);if(v&&typeof v.props.shared=="boolean"){var N=v.props.shared?"axis":"item";return l.indexOf(N)>=0?N:s}return s}},{key:"getMouseInfo",value:function(v){if(!this.container)return null;var N=this.container,S=N.getBoundingClientRect(),_=YXe(S),j={chartX:Math.round(v.pageX-_.left),chartY:Math.round(v.pageY-_.top)},A=S.width/N.offsetWidth||1,C=this.inRange(j.chartX,j.chartY,A);if(!C)return null;var k=this.state,M=k.xAxisMap,I=k.yAxisMap,R=this.getTooltipEventType(),E=zY(this.state,this.props.data,this.props.layout,C);if(R!=="axis"&&M&&I){var P=Ef(M).scale,O=Ef(I).scale,L=P&&P.invert?P.invert(j.chartX):null,T=O&&O.invert?O.invert(j.chartY):null;return ze(ze({},j),{},{xValue:L,yValue:T},E)}return E?ze(ze({},j),E):null}},{key:"inRange",value:function(v,N){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,_=this.props.layout,j=v/S,A=N/S;if(_==="horizontal"||_==="vertical"){var C=this.state.offset,k=j>=C.left&&j<=C.left+C.width&&A>=C.top&&A<=C.top+C.height;return k?{x:j,y:A}:null}var M=this.state,I=M.angleAxisMap,R=M.radiusAxisMap;if(I&&R){var E=Ef(I);return hK({x:j,y:A},E)}return null}},{key:"parseEventsOfWrapper",value:function(){var v=this.props.children,N=this.getTooltipEventType(),S=lo(v,Bn),_={};S&&N==="axis"&&(S.props.trigger==="click"?_={onClick:this.handleClick}:_={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var j=d2(this.props,this.handleOuterEvent);return ze(ze({},j),_)}},{key:"addListener",value:function(){hI.on(pI,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){hI.removeListener(pI,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(v,N,S){for(var _=this.state.formattedGraphicalItems,j=0,A=_.length;j<A;j++){var C=_[j];if(C.item===v||C.props.key===v.key||N===ld(C.item.type)&&S===C.childIndex)return C}return null}},{key:"renderClipPath",value:function(){var v=this.clipPathId,N=this.state.offset,S=N.left,_=N.top,j=N.height,A=N.width;return te.createElement("defs",null,te.createElement("clipPath",{id:v},te.createElement("rect",{x:S,y:_,height:j,width:A})))}},{key:"getXScales",value:function(){var v=this.state.xAxisMap;return v?Object.entries(v).reduce(function(N,S){var _=$Y(S,2),j=_[0],A=_[1];return ze(ze({},N),{},Yt({},j,A.scale))},{}):null}},{key:"getYScales",value:function(){var v=this.state.yAxisMap;return v?Object.entries(v).reduce(function(N,S){var _=$Y(S,2),j=_[0],A=_[1];return ze(ze({},N),{},Yt({},j,A.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(v){var N;return(N=this.state.xAxisMap)===null||N===void 0||(N=N[v])===null||N===void 0?void 0:N.scale}},{key:"getYScaleByAxisId",value:function(v){var N;return(N=this.state.yAxisMap)===null||N===void 0||(N=N[v])===null||N===void 0?void 0:N.scale}},{key:"getItemByXY",value:function(v){var N=this.state,S=N.formattedGraphicalItems,_=N.activeItem;if(S&&S.length)for(var j=0,A=S.length;j<A;j++){var C=S[j],k=C.props,M=C.item,I=M.type.defaultProps!==void 0?ze(ze({},M.type.defaultProps),M.props):M.props,R=ld(M.type);if(R==="Bar"){var E=(k.data||[]).find(function(T){return qit(v,T)});if(E)return{graphicalItem:C,payload:E}}else if(R==="RadialBar"){var P=(k.data||[]).find(function(T){return hK(v,T)});if(P)return{graphicalItem:C,payload:P}}else if(LM(C,_)||$M(C,_)||j_(C,_)){var O=Pat({graphicalItem:C,activeTooltipItem:_,itemData:I.data}),L=I.activeIndex===void 0?O:I.activeIndex;return{graphicalItem:ze(ze({},C),{},{childIndex:L}),payload:j_(C,_)?I.data[O]:C.props.data[O]}}}return null}},{key:"render",value:function(){var v=this;if(!ZW(this))return null;var N=this.props,S=N.children,_=N.className,j=N.width,A=N.height,C=N.style,k=N.compact,M=N.title,I=N.desc,R=FY(N,rdt),E=Pt(R,!1);if(k)return te.createElement(yY,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},te.createElement(vL,uy({},E,{width:j,height:A,title:M,desc:I}),this.renderClipPath(),tG(S,this.renderMap)));if(this.props.accessibilityLayer){var P,O;E.tabIndex=(P=this.props.tabIndex)!==null&&P!==void 0?P:0,E.role=(O=this.props.role)!==null&&O!==void 0?O:"application",E.onKeyDown=function(T){v.accessibilityManager.keyboardEvent(T)},E.onFocus=function(){v.accessibilityManager.focus()}}var L=this.parseEventsOfWrapper();return te.createElement(yY,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},te.createElement("div",uy({className:an("recharts-wrapper",_),style:ze({position:"relative",cursor:"default",width:j,height:A},C)},L,{ref:function(D){v.container=D}}),te.createElement(vL,uy({},E,{width:j,height:A,title:M,desc:I,style:bdt}),this.renderClipPath(),tG(S,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])}(b.Component);Yt(m,"displayName",n),Yt(m,"defaultProps",ze({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},f)),Yt(m,"getDerivedStateFromProps",function(y,g){var w=y.dataKey,v=y.data,N=y.children,S=y.width,_=y.height,j=y.layout,A=y.stackOffset,C=y.margin,k=g.dataStartIndex,M=g.dataEndIndex;if(g.updateId===void 0){var I=BY(y);return ze(ze(ze({},I),{},{updateId:0},p(ze(ze({props:y},I),{},{updateId:0}),g)),{},{prevDataKey:w,prevData:v,prevWidth:S,prevHeight:_,prevLayout:j,prevStackOffset:A,prevMargin:C,prevChildren:N})}if(w!==g.prevDataKey||v!==g.prevData||S!==g.prevWidth||_!==g.prevHeight||j!==g.prevLayout||A!==g.prevStackOffset||!Ey(C,g.prevMargin)){var R=BY(y),E={chartX:g.chartX,chartY:g.chartY,isTooltipActive:g.isTooltipActive},P=ze(ze({},zY(g,v,j)),{},{updateId:g.updateId+1}),O=ze(ze(ze({},R),E),P);return ze(ze(ze({},O),p(ze({props:y},O),g)),{},{prevDataKey:w,prevData:v,prevWidth:S,prevHeight:_,prevLayout:j,prevStackOffset:A,prevMargin:C,prevChildren:N})}if(!xL(N,g.prevChildren)){var L,T,D,F,q=lo(N,Tv),B=q&&(L=(T=q.props)===null||T===void 0?void 0:T.startIndex)!==null&&L!==void 0?L:k,z=q&&(D=(F=q.props)===null||F===void 0?void 0:F.endIndex)!==null&&D!==void 0?D:M,H=B!==k||z!==M,W=!nn(v),G=W&&!H?g.updateId:g.updateId+1;return ze(ze({updateId:G},p(ze(ze({props:y},g),{},{updateId:G,dataStartIndex:B,dataEndIndex:z}),g)),{},{prevChildren:N,dataStartIndex:B,dataEndIndex:z})}return null}),Yt(m,"renderActiveDot",function(y,g,w){var v;return b.isValidElement(y)?v=b.cloneElement(y,g):Kt(y)?v=y(g):v=te.createElement(YS,g),te.createElement(kn,{className:"recharts-active-dot",key:w},v)});var x=b.forwardRef(function(g,w){return te.createElement(m,uy({},g,{ref:w}))});return x.displayName=m.displayName,x},Dh=WM({chartName:"LineChart",GraphicalChild:Po,axisComponents:[{axisType:"xAxis",AxisComp:No},{axisType:"yAxis",AxisComp:jo}],formatAxisMap:kB}),Lh=WM({chartName:"BarChart",GraphicalChild:qa,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:No},{axisType:"yAxis",AxisComp:jo}],formatAxisMap:kB}),LB=WM({chartName:"PieChart",GraphicalChild:wc,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:IM},{axisType:"radiusAxis",AxisComp:OM}],formatAxisMap:snt,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}}
870),Tdt=FM,Mdt=BS,Pdt=Object.prototype,Odt=Pdt.hasOwnProperty;function Rdt(t,e,n){var r=t[e];(!(Odt.call(t,e)&&Mdt(r,n))||n===void 0&&!(e in t))&&Tdt(t,e,n)}var phe=Rdt,Idt=phe,Ddt=FM;function Ldt(t,e,n,r){var i=!n;n||(n={});for(var s=-1,a=e.length;++s<a;){var l=e[s],c=r?r(n[l],t[l],l,n,t):void 0;c===void 0&&(c=t[l]),i?Ddt(n,l,c):Idt(n,l,c)}return n}var $dt=Ldt;function Fdt(t){var e=[];if(t!=null)for(var n in Object(t))e.push(n);return e}var Udt=Fdt,zdt=Lo,Bdt=G6,Vdt=Udt,Hdt=Object.prototype,Wdt=Hdt.hasOwnProperty;function Gdt(t){if(!zdt(t))return Vdt(t);var e=Bdt(t),n=[];for(var r in t)r=="constructor"&&(e||!Wdt.call(t,r))||n.push(r);return n}var qdt=Gdt,Kdt=aue,Ydt=qdt,Xdt=Eg;function Qdt(t){return Xdt(t)?Kdt(t,!0):Ydt(t)}var mhe=Qdt,dE={exports:{}};dE.exports;(function(t,e){var n=vc,r=e&&!e.nodeType&&e,i=r&&!0&&t&&!t.nodeType&&t,s=i&&i.exports===r,a=s?n.Buffer:void 0,l=a?a.allocUnsafe:void 0;function c(u,d){if(d)return u.slice();var f=u.length,h=l?l(f):new u.constructor(f);return u.copy(h),h}t.exports=c})(dE,dE.exports);var Jdt=dE.exports;function Zdt(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}var eft=Zdt,HY=nue;function tft(t){var e=new t.constructor(t.byteLength);return new HY(e).set(new HY(t)),e}var nft=tft,rft=nft;function ift(t,e){var n=e?rft(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}var sft=ift,aft=Lo,WY=Object.create,oft=function(){function t(){}return function(e){if(!aft(e))return{};if(WY)return WY(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}(),lft=oft,cft=lft,uft=pfe,dft=G6;function fft(t){return typeof t.constructor=="function"&&!dft(t)?cft(uft(t)):{}}var hft=fft,pft=K6;function mft(t){var e=t==null?0:t.length;return e?pft(t,1):[]}var gft=mft,xft=gft,yft=Nue,vft=Cue;function bft(t){return vft(yft(t,void 0,xft),t+"")}var wft=bft,fE=WM({chartName:"AreaChart",GraphicalChild:yl,axisComponents:[{axisType:"xAxis",AxisComp:No},{axisType:"yAxis",AxisComp:jo}],formatAxisMap:kB});const _ft=["var(--chart-1)","var(--chart-2)","var(--chart-3)","var(--chart-4)","var(--chart-5)","var(--primary)","var(--muted)"];function gI({active:t,payload:e,label:n}){return!t||!(e!=null&&e.length)?null:o.jsxs("div",{className:"rounded-lg border bg-background px-3 py-2 shadow-sm",children:[n&&o.jsx("p",{className:"mb-1 text-sm font-medium",children:n}),e.map((r,i)=>o.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[o.jsx("span",{className:"h-2 w-2 rounded-full",style:{backgroundColor:r.color}}),o.jsxs("span",{className:"text-muted-foreground",children:[r.name,":"]}),o.jsx("span",{className:"font-medium",children:r.value})]},i))]})}function Sft({active:t,payload:e}){if(!t||!(e!=null&&e.length))return null;const n=e[0];return n?o.jsxs("div",{className:"rounded-lg border bg-background px-3 py-2 shadow-sm",children:[o.jsx("p",{className:"text-sm font-medium",children:n.name}),o.jsx("p",{className:"text-xs text-muted-foreground",children:n.value})]}):null}function Nft({chart:t}){var l,c;const e=(l=t.colors)!=null&&l.length?t.colors:_ft,n=260,r=t.data,i=t.yKeys||["value"],s=t.xKey||(t.type==="bar"?"name":"date"),a=`agent-chart-${((c=t.title)==null?void 0:c.replace(/\s+/g,"-").toLowerCase().replace(/[^a-z0-9-]/g,""))||"default"}`;return o.jsxs("div",{className:"my-3 rounded-lg border bg-background p-3",children:[t.title&&o.jsx("p",{className:"mb-3 text-xs font-medium text-muted-foreground",children:t.title}),o.jsx(Qi,{width:"100%",height:n,children:t.type==="area"?o.jsxs(fE,{data:r,margin:{top:5,right:5,left:-20,bottom:0},children:[o.jsx("defs",{children:i.map((u,d)=>o.jsxs("linearGradient",{id:`${a}-grad-${d}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[o.jsx("stop",{offset:"5%",stopColor:e[d%e.length],stopOpacity:.3}),o.jsx("stop",{offset:"95%",stopColor:e[d%e.length],stopOpacity:0})]},u))}),o.jsx(fd,{strokeDasharray:"3 3",stroke:"var(--border)"}),o.jsx(No,{dataKey:s,tick:{fontSize:11},stroke:"var(--muted-foreground)",tickLine:!1,axisLine:!1,tickFormatter:GY(s,r)?qY:void 0}),o.jsx(jo,{tick:{fontSize:11},stroke:"var(--muted-foreground)",tickLine:!1,axisLine:!1}),o.jsx(Bn,{content:o.jsx(gI,{})}),i.map((u,d)=>o.jsx(yl,{type:"monotone",dataKey:u,name:xI(u),stroke:e[d%e.length],strokeWidth:2,fill:`url(#${a}-grad-${d})`,activeDot:{r:4,strokeWidth:0}},u))]}):t.type==="bar"?o.jsxs(Lh,{data:r,margin:{top:5,right:5,left:-20,bottom:0},children:[o.jsx(fd,{strokeDasharray:"3 3",stroke:"var(--border)"}),o.jsx(No,{dataKey:s,tick:{fontSize:11}
870,stroke:"var(--muted-foreground)",tickLine:!1,axisLine:!1}),o.jsx(jo,{tick:{fontSize:11},stroke:"var(--muted-foreground)",tickLine:!1,axisLine:!1}),o.jsx(Bn,{content:o.jsx(gI,{}),cursor:{fill:"var(--muted)",opacity:.15}}),i.map((u,d)=>o.jsx(qa,{dataKey:u,name:xI(u),fill:e[d%e.length],radius:[4,4,0,0],maxBarSize:50},u))]}):t.type==="line"?o.jsxs(Dh,{data:r,margin:{top:5,right:5,left:-20,bottom:0},children:[o.jsx(fd,{strokeDasharray:"3 3",stroke:"var(--border)"}),o.jsx(No,{dataKey:s,tick:{fontSize:11},stroke:"var(--muted-foreground)",tickLine:!1,axisLine:!1,tickFormatter:GY(s,r)?qY:void 0}),o.jsx(jo,{tick:{fontSize:11},stroke:"var(--muted-foreground)",tickLine:!1,axisLine:!1}),o.jsx(Bn,{content:o.jsx(gI,{})}),i.map((u,d)=>o.jsx(Po,{type:"monotone",dataKey:u,name:xI(u),stroke:e[d%e.length],strokeWidth:2,dot:!1,activeDot:{r:4,strokeWidth:0}},u))]}):o.jsxs(LB,{children:[o.jsx(wc,{data:r,cx:"50%",cy:"50%",innerRadius:45,outerRadius:70,paddingAngle:5,cornerRadius:2,strokeWidth:0,dataKey:t.dataKey||"value",nameKey:t.nameKey||"name",children:r.map((u,d)=>o.jsx(B0,{fill:e[d%e.length]},`cell-${d}`))}),o.jsx(Bn,{content:o.jsx(Sft,{})}),o.jsx(cd,{verticalAlign:"bottom",height:36,iconType:"circle",iconSize:8,formatter:u=>o.jsx("span",{className:"text-xs text-muted-foreground",children:u})})]})})]})}function GY(t,e){var r;if(/date|time|day|month|year/i.test(t))return!0;const n=(r=e[0])==null?void 0:r[t];return!!(typeof n=="string"&&/^\d{4}-\d{2}/.test(n))}function qY(t){try{return new Date(t).toLocaleDateString("en-US",{month:"short",day:"numeric"})}catch{return t}}function xI(t){return t.replace(/([A-Z])/g," $1").replace(/[_-]/g," ").replace(/^\w/,e=>e.toUpperCase()).trim()}const ghe={table:({children:t,...e})=>o.jsx("div",{className:"my-3 overflow-x-auto rounded-lg border border-border",children:o.jsx("table",{className:"w-full card-table",...e,children:t})}),thead:({children:t,...e})=>o.jsx("thead",{className:"border-b",...e,children:t}),tbody:({children:t,...e})=>o.jsx("tbody",{className:"text-sm",...e,children:t}),th:({children:t,...e})=>o.jsx("th",{className:"px-3 py-1.5 font-medium whitespace-nowrap text-left",...e,children:t}),td:({children:t,...e})=>o.jsx("td",{className:"px-3 py-1.5",...e,children:t}),tr:({children:t,...e})=>o.jsx("tr",{className:"border-b last:border-0",...e,children:t}),p:({children:t,...e})=>o.jsx("p",{className:"text-sm mb-2",...e,children:t}),h2:({children:t,...e})=>o.jsx("h2",{className:"text-lg font-medium my-3",...e,children:t}),h3:({children:t,...e})=>o.jsx("h3",{className:"text-base font-medium my-3",...e,children:t}),h4:({children:t,...e})=>o.jsx("h4",{className:"text-sm font-medium my-3",...e,children:t}),ul:({children:t,...e})=>o.jsx("ul",{className:"list-disc text-sm mb-2 pl-3",...e,children:t}),ol:({children:t,...e})=>o.jsx("ol",{className:"list-decimal text-sm mb-2 pl-3",...e,children:t}),li:({children:t,...e})=>o.jsx("li",{className:"mb-2",...e,children:t}),hr:({children:t,...e})=>o.jsx("hr",{className:"my-3 border-border",...e,children:t})},jft=["How is my brand visibility trending?","Which AI models mention us the most?","Who are our top competitors?","What sources cite our brand?","Analyze our share of voice"];function xhe({className:t}){const[e,n]=b.useState(""),r=b.useRef(null),i=b.useRef(null),s=b.useRef(null),a=b.useRef(!0),l=b.useRef(0),{activeConversationId:c,messages:u,isStreaming:d,streamingContent:f,currentSteps:h,sendMessage:p,createConversation:m,fetchMessages:x}=ca(),{currentCompanyId:y}=Ri(),g=c?u[c]||[]:[];b.useEffect(()=>{const S=s.current;if(!S)return;const _=()=>{const{scrollTop:j,scrollHeight:A,clientHeight:C}=S;a.current=A-j-C<120};return S.addEventListener("scroll",_,{passive:!0}),()=>S.removeEventListener("scroll",_)},[]),b.useEffect(()=>{const S=s.current;S&&(S.scrollTop=S.scrollHeight,a.current=!0,l.current=g.length)},[c]),b.useEffect(()=>{var C;if(!a.current)return;const S=s.current;if(!S)return;const _=l.current,j=g.length;if(l.current=j,_===0&&j>1){S.scrollTop=S.scrollHeight;return}d?S.scrollTop=S.scrollHeight:j>_&&((C=r.current)==null||C.scrollIntoView({behavior:"smooth"}))},[g.length,f,h,d]),b.useEffect(()=>{const S=i.current;S&&(S.style.height="auto",S.style.height=Math.min(S.scrollHeight,200)+"px")},[e]),b.useEffect(()=>{c&&y&&(u[c]||x(y,c))},[c,y,x,u]);const w=b.useCallback(async()=>
870{if(!e.trim()||!y||d)return;const S=e.trim();n(""),a.current=!0;let _=c;if(!_){const j=await m(y);if(!j)return;_=j.id}await p(y,_,S)},[e,y,d,c,m,p]),v=S=>{S.key==="Enter"&&!S.shiftKey&&(S.preventDefault(),w())},N=S=>{n(S),setTimeout(()=>{const _=S;n(""),!(!y||d)&&(async()=>{let j=c;if(!j){const A=await m(y);if(!A)return;j=A.id}await p(y,j,_)})()},0)};return o.jsxs("div",{className:ne("flex h-full flex-col",t),children:[o.jsx("div",{ref:s,className:"flex-1 overflow-y-auto px-6 py-3",children:g.length===0&&!d?o.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-4 text-center",children:[o.jsx("div",{children:o.jsx("p",{className:"text-sm mt-1 text-muted-foreground",children:"Ask me anything about your brand visibility, mentions, competitors and more."})}),o.jsx("div",{className:"flex flex-wrap justify-center gap-1.5 max-w-md",children:jft.map(S=>o.jsx("button",{onClick:()=>N(S),className:"rounded-full border border-border/60 bg-card/50 px-3 py-1.5 text-left text-xs transition-colors hover:border-primary/40 hover:bg-primary/5",children:S},S))})]}):o.jsxs("div",{className:"flex flex-col gap-3 mx-auto max-w-3xl",children:[g.map(S=>o.jsx(Cft,{message:S},S.id)),d&&o.jsxs("div",{className:"flex gap-2",children:[o.jsx("div",{className:"flex-shrink-0 rounded-lg bg-muted border flex items-center justify-center mt-0.5 w-8 h-8",children:o.jsx(Hn,{src:"/images/logo/logo-icon-current-color.svg",alt:"",className:"h-4 w-4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[h.length>0&&o.jsx(ice,{steps:h}),f&&o.jsxs("div",{className:"prose prose-invert prose-sm max-w-none",children:[o.jsx(WT,{remarkPlugins:[v6],components:ghe,children:f}),o.jsx("span",{className:"inline-block h-4 w-0.5 animate-pulse bg-primary ml-0.5"})]}),!f&&h.length===0&&o.jsxs("div",{className:"flex items-center gap-1.5 py-1",children:[o.jsx("div",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-primary/60",style:{animationDelay:"0ms"}}),o.jsx("div",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-primary/60",style:{animationDelay:"150ms"}}),o.jsx("div",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-primary/60",style:{animationDelay:"300ms"}})]})]})]}),o.jsx("div",{ref:r})]})}),o.jsx("div",{className:"border-t",children:o.jsxs("div",{className:"relative flex",children:[o.jsx("textarea",{ref:i,value:e,onChange:S=>n(S.target.value),onKeyDown:v,placeholder:"Ask the agent...",disabled:d,rows:1,className:ne("w-full resize-none border-0 bg-transparent px-6 py-3 pr-12 outline-none","placeholder:text-muted-foreground/50 focus-visible:ring-0","disabled:opacity-50","text-sm","scrollbar-none [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none]"),style:{overflow:"hidden"}}),o.jsx(le,{size:"icon",onClick:w,disabled:!e.trim()||d,className:ne("absolute bottom-2 right-6 h-7 w-7 rounded-md p-0",d||!e.trim()?"bg-muted-foreground/10 text-muted-foreground":"bg-primary text-primary-foreground hover:bg-primary/90"),children:o.jsx(RTe,{className:"h-3.5 w-3.5"})})]})})]})}function Cft({message:t}){var i,s,a;const e=t.role==="user",n=((i=t.metadata)==null?void 0:i.charts)||[],r=((s=t.metadata)==null?void 0:s.contentSuggestions)||[];return e?o.jsx("div",{className:"flex justify-end",children:o.jsx("div",{className:"max-w-[85%] rounded-2xl rounded-br-md bg-primary px-3 py-2 text-sm text-primary-foreground",children:t.content})}):o.jsxs("div",{className:"flex gap-2",children:[o.jsx("div",{className:"flex-shrink-0 rounded-lg bg-muted border flex items-center justify-center mt-0.5 w-8 h-8",children:o.jsx(Hn,{src:"/images/logo/logo-icon-current-color.svg",alt:"",className:"h-4 w-4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[t.steps&&t.steps.length>0&&o.jsx(ice,{steps:t.steps}),t.content&&o.jsx("div",{className:"prose prose-invert prose-sm max-w-none [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",children:o.jsx(WT,{remarkPlugins:[v6],components:ghe,children:t.content})}),n.map((l,c)=>o.jsx(Nft,{chart:l},c)),r.length>0&&o.jsx(Eft,{suggestions:r,messageId:t.id,conversationId:t.conversationId}),((a=t.metadata)==null?void 0:a.error)&&o.jsxs("p",{className:"mt-1 text-xs text-destructive/80",children:["Error: ",t.metadata.error]})]})]})}const kft={listicle:"Listicle",blog_post:"Blog Post",guide:"Guide",how_to:"How-to",comparison:"Comparison",news:"News"};function Eft({suggestions:t,messageId:e,conversationId:n}){const{generateArticle:r,articleGenerations:i}=ca(),{currentCompanyId:s}=Ri(),[a,l]=b.useState(new Set),c=async(d,f)=>{!s||a.has(f)||(l(h=>new Set(h).add(f)),await r(s,n,d,e))},u=Object.values(i).filter(d=>d.status==="generating"||d.status==="completed");return o.jsxs("div",{className:"mt-3 space-y-3",children:[o.jsx("h4",{className:"text-sm font-medium",children:"Content Suggestions:"}),t.map((d,f)=>{const h=a.has(f),p=u.find(x=>x.title===d.title),m=(p==null?void 0:p.status)==="completed";return o.jsxs("div",{className:ne("rounded-lg border p-3"),children:[o.jsx("div",{className:"flex items-start justify-between gap-2",children:o.jsx("div",{className:"min-w-0 flex-1",children:o.jsxs("div",{className:"flex gap-2",children:[o.jsx("div",{className:"flex-shrink-0 w-6 h-6 rounded-lg bg-primary/10 flex items-center justify-center",children:o.jsx(Ao,{className:"h-3.5 w-3.5 flex-shrink-0 text-primary"})}),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx("span",{className:"inline-block w-fit roun
870ded-full bg-muted-foreground/10 px-2 py-0.5 text-[10px] text-muted-foreground",children:kft[d.contentType]||d.contentType}),o.jsx("h4",{className:"font-medium text-sm",children:d.title}),d.description&&o.jsx("p",{className:"text-muted-foreground text-xs",children:d.description}),o.jsx("div",{children:m&&p?o.jsxs("a",{href:`/company/${s}/content/${p.articleId}`,className:"inline-flex items-center gap-1 rounded-md bg-green-500/10 px-2.5 py-1.5 text-xs font-medium text-green-500 transition-colors hover:bg-green-500/20",children:[o.jsx(wg,{className:"h-3 w-3"}),"View Article"]}):h||p?o.jsxs(le,{variant:"outline",disabled:!0,className:"h-7 text-xs gap-1",children:[o.jsx(Me,{className:"h-3 w-3 animate-spin"}),"Generating..."]}):o.jsx(le,{onClick:()=>c(d,f),className:"h-7 text-xs hover:bg-primary hover:text-primary-foreground",children:"Generate Article"})})]})]})})}),p&&p.steps.length>0&&o.jsx(Aft,{generation:p})]},f)})]})}function Aft({generation:t}){const{currentCompanyId:e}=Ri();return o.jsxs("div",{className:"mt-2 border-t border-border/40 pt-2",children:[o.jsx("div",{className:"space-y-1",children:t.steps.map((n,r)=>o.jsxs("div",{className:"flex items-center gap-2",children:[n.status==="running"?o.jsx(Me,{className:"h-3 w-3 animate-spin text-primary"}):n.status==="completed"?o.jsx(wg,{className:"h-3 w-3 text-green-500"}):o.jsx("div",{className:"h-3 w-3 rounded-full bg-destructive"}),o.jsx("span",{className:ne("text-xs text-muted-foreground",n.status==="running"&&"text-foreground"),children:n.label})]},r))}),t.status==="completed"&&o.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[t.wordCount&&o.jsxs("span",{className:"text-xs text-muted-foreground",children:[t.wordCount.toLocaleString()," words"]}),e&&o.jsxs("a",{href:`/company/${e}/content/${t.articleId}`,className:"inline-flex items-center gap-1 text-xs font-medium text-primary hover:underline",children:[o.jsx(Wr,{className:"h-3 w-3"}),"View article"]})]})]})}function yhe({className:t,onSelectConversation:e}){const[n,r]=b.useState(""),{conversations:i,isLoadingConversations:s,activeConversationId:a,fetchConversations:l,createConversation:c,deleteConversation:u,setActiveConversation:d,setActiveTab:f}=ca(),{currentCompanyId:h}=Ri();b.useEffect(()=>{h&&l(h)},[h,l]);const p=async()=>{if(!h)return;const C=await c(h);C&&(e==null||e(C.id))},m=C=>{d(C),f("conversation"),e==null||e(C)},x=async(C,k)=>{C.stopPropagation(),h&&await u(h,k)},y=n?i.filter(C=>C.title.toLowerCase().includes(n.toLowerCase())):i,g=new Date;g.setHours(0,0,0,0);const w=new Date(g);w.setDate(w.getDate()-1);const v=new Date(g);v.setDate(v.getDate()-7);const N=[],S=y.filter(C=>new Date(C.updatedAt)>=g),_=y.filter(C=>{const k=new Date(C.updatedAt);return k>=w&&k<g}),j=y.filter(C=>{const k=new Date(C.updatedAt);return k>=v&&k<w}),A=y.filter(C=>new Date(C.updatedAt)<v);return S.length>0&&N.push({label:"Today",conversations:S}),_.length>0&&N.push({label:"Yesterday",conversations:_}),j.length>0&&N.push({label:"This Week",conversations:j}),A.length>0&&N.push({label:"Older",conversations:A}),o.jsxs("div",{className:ne("flex h-full flex-col",t),children:[o.jsxs("div",{className:ne("flex items-center justify-between border-b px-6 py-3"),children:[o.jsx("h3",{className:ne("font-semibold text-sm"),children:"Conversations"}),o.jsxs(le,{variant:"outline",size:"sm",onClick:p,className:ne("h-7 px-2 gap-1"),children:[o.jsx(yi,{className:ne("h-4 w-4")})," Start new"]})]}),o.jsx("div",{className:ne("border-b"),children:o.jsxs("div",{className:"relative",children:[o.jsx(Xa,{className:ne("absolute left-6 top-1/2 -translate-y-1/2 text-muted-foreground/50","h-3.5 w-3.5")}),o.jsx(gt,{type:"text",placeholder:"Search conversations...",value:n,onChange:C=>r(C.target.value),className:ne("w-full pl-12 pr-6 outline-none h-12 border-0 focus-visible:ring-0 focus-visible:ring-offset-0 transition-colors text-sm")})]})}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:s?o.jsx("div",{className:"flex items-center justify-center h-full",children:o.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-primary border-t-transparent"})}):y.length===0?o.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center h-full",children:[o.jsx("p",{className:ne("text-muted-foreground text-sm"),children:n?"No conversations foun
870d":"Use the Hjaelp AI to generate intelligent overview and insights about your brand visibility, sources, competitors and more."}),!n&&o.jsx(le,{size:"sm",onClick:p,className:"mt-3",children:"Start a conversation"})]}):o.jsx("div",{className:"px-6 py-3",children:N.map(C=>o.jsxs("div",{children:[o.jsx("p",{className:ne("px-1 py-1.5 font-medium text-muted-foreground text-xs"),children:C.label}),C.conversations.map(k=>o.jsxs("button",{onClick:()=>m(k.id),className:ne("group flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors","hover:bg-muted/50",a===k.id&&"bg-primary/10 text-primary","text-sm"),children:[o.jsx("span",{className:"flex-1 truncate",children:k.title}),o.jsx("button",{onClick:M=>x(M,k.id),className:"flex-shrink-0 opacity-0 transition-opacity group-hover:opacity-100",children:o.jsx(Yi,{className:ne("text-muted-foreground/50 hover:text-destructive h-3.5 w-3.5")})})]},k.id))]},C.label))})})]})}function Tft(){const{isOpen:t,activeTab:e,activeConversationId:n,conversations:r,setOpen:i,setActiveTab:s,setActiveConversation:a}=ca();if(!t)return null;const l=r.find(c=>c.id===n);return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 z-40 bg-black/20",onClick:()=>i(!1)}),o.jsxs("div",{className:ne("fixed bottom-20 right-5 z-50 flex flex-col overflow-hidden rounded-xl border bg-background shadow-2xl","w-[380px] h-[520px]","animate-in slide-in-from-bottom-4 fade-in-0 duration-200"),children:[o.jsxs("div",{className:"flex items-center gap-2 border-b px-6 py-3 h-12",children:[e==="conversation"&&n?o.jsxs(o.Fragment,{children:[o.jsx(le,{variant:"ghost",size:"sm",onClick:()=>{a(null),s("list")},className:"h-6 w-6 p-0",children:o.jsx(Ii,{className:"h-3.5 w-3.5"})}),o.jsx("span",{className:"flex-1 truncate text-xs font-medium",children:(l==null?void 0:l.title)||"Conversation"})]}):o.jsx("span",{className:"flex-1 text-sm font-semibold",children:"How can we help you today?"}),o.jsx(le,{variant:"ghost",size:"sm",onClick:()=>i(!1),className:"h-6 w-6 p-0",children:o.jsx(mr,{className:"h-3.5 w-3.5"})})]}),o.jsx("div",{className:"flex-1 overflow-hidden",children:e==="conversation"&&n?o.jsx(xhe,{}):o.jsx(yhe,{})})]})]})}function Mft(){const t=Ya(),e=ca(r=>r.setPageContext),n=t.pathname.includes("/agent");return b.useEffect(()=>{const r=Pft(t.pathname);e(r)},[t.pathname,e]),n?null:o.jsxs(o.Fragment,{children:[o.jsx(rDe,{}),o.jsx(Tft,{})]})}function Pft(t){const e=t.replace(/^\/company\/[^/]+\/?/,"").split("/").filter(Boolean),n=e[0]||"",r=e[1]||"",i=e[2]||"";return!n||n==="dashboard"?{page:"dashboard",label:"Company Dashboard",description:"The main dashboard showing an overview of the company's brand visibility, key metrics, and recent activity."}:n==="prompts"?i==="studio"&&r?{page:"query-studio",label:"Query Studio",description:"The user is in the Query Studio testing AI prompts and seeing how different LLMs respond. They may ask about prompt results or visibility for a specific query.",entityId:r,entityType:"query"}:r?{page:"query-detail",label:"Query Detail",description:"Viewing details for a specific search query/prompt, including which AI models mentioned the brand and how.",entityId:r,entityType:"query"}:{page:"prompts",label:"Prompts / Queries",description:"Viewing all tracked search prompts/queries that are monitored across AI platforms for brand visibility."}:n==="competitors"?r==="hidden"?{page:"hidden-competitors",label:"Hidden Competitors",description:"Viewing competitors that have been hidden/dismissed from the main view."}:r?{page:"competitor-detail",label:"Competitor Detail",description:"Viewing detailed analytics for a specific competitor, including their visibility and mentions across AI platforms.",entityId:r,entityType:"competitor"}:{page:"competitors",label:"Competitors",description:"Viewing the competitors overview, which shows how the brand compares to competitors in AI-generated responses."}:n==="sources"&&r?{page:"source-detail",label:"Source Detail",description:"Viewing details about a specific source/website that cites or mentions the brand in AI responses.",entityId:decodeURIComponent(r),entityType:"source"}:n==="opportunities"?{page:"opportunities",label:"Opportunities",description:"Viewing AI visibility opportunities - areas where the brand could improve its presence in AI-generated answers."}:n==="content"?r==="create"?{page:"content-create",label:"Create Article",description:"The user is on the article creation page where they can create new content. They may need help with topics, titles, or content strategy."}:r?{page:"content-editor",label:"Article Editor",description:"The user is editing a specific article. They may need help improving the content, SEO, structure, or readability.",entityId:r,entityType:"article"}:{page:"content",label:"Content Library",description:"Viewing the content library with all generated articles. They may want to create new content or manage existing articles."}:n==="site-health"?r==="page"&&i?{page:"page-audit",label:"Page Audit",description:"Viewing a detailed SEO audit for a specific page on their website.",entityId:i,entityType:"page_audit"}:{page:"site-health",label:"Site Health",description:"Viewing the overall site health dashboard with SEO audits and technical issues for their website."}:n==="issues"?{page:"issues",label:"Issues",description:"Viewing detected issues and problems across the platform that need attention."}:n==="research"?r?{page:"research-topic",label:"Research Topic",description:"Viewing research details for a specific topic, including insights and findings.",entityId:r,entityType:"research_topic"}:{page:"research",label:"Research",description:"Viewing the research section with topic explorations and market insights."}:n==="analytics"?r==="visibility"?{page:"analytics-visibility",label:"Visibility Analytics",description:"Viewing detailed visibility analytics showing how the brand appears in AI-generated responses over time, across different AI platforms."}:r==="mentions"?{page:"analytics-mentions",label:"Mentions Analytics",description:"Viewing brand mentions analytics showing where and how the brand is mentioned in AI model responses."}:r==="sources"?{page:"analytics-sources",label:"Sources Analytics",description:"Viewing source analytics showing which websites and s
870ources cite the brand in AI responses."}:r==="traffic"?{page:"analytics-traffic",label:"Traffic Analytics",description:"Viewing traffic analytics showing referral traffic from AI platforms."}:{page:"analytics",label:"Analytics",description:"Viewing the analytics section."}:n==="settings"?{page:"settings",label:"Company Settings",description:"Viewing company settings including brand info, website, and configuration."}:n==="team"?{page:"team",label:"Team Management",description:"Viewing team management where they can invite and manage team members."}:{page:n||"unknown",label:"Page",description:""}}function Oft(){const{companyId:t}=Gr(),{fetchCompanies:e,setCurrentCompany:n,currentCompanyId:r}=Ri(),{subscribeToCompany:i,unsubscribeFromCompany:s,isConnected:a}=yse(),{fetchNotifications:l,setupSocketListeners:c}=Uoe();return b.useEffect(()=>{e(),l()},[e,l]),b.useEffect(()=>{t&&n(t)},[t,n]),b.useEffect(()=>{if(a&&r)return i(r),c(),()=>{s(r)}},[a,r,i,s,c]),o.jsxs(rTe,{children:[o.jsxs("div",{className:"flex h-screen overflow-hidden bg-background",children:[o.jsx(f3e,{}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[o.jsx(nDe,{}),o.jsx("main",{className:"min-h-0 flex-1 overflow-auto bg-muted/30",children:o.jsx("div",{className:"animate-fade-in relative h-full",children:o.jsx(fT,{})})})]}),o.jsx(Mft,{})]}),o.jsx(s3e,{})]})}const KY=[{label:"Features",href:"/features"},{label:"Integrations",href:"/integrations"},{label:"Models",href:"/models"},{label:"Pricing",href:"/pricing"},{label:"About",href:"/about"}];function vhe(){const[t,e]=b.useState(!1),n=Ya();return b.useEffect(()=>{e(!1)},[n.pathname]),o.jsxs(o.Fragment,{children:[o.jsxs("header",{className:"sticky top-0 z-50 w-full bg-gradient-to-b from-background to-transparent backdrop-blur supports-[backdrop-filter]:bg-background/50",children:[o.jsx("div",{className:"mx-auto max-w-6xl px-4",children:o.jsxs("div",{className:"relative flex h-16 items-center justify-between",children:[o.jsx("div",{className:"flex items-center md:w-1/2",children:o.jsxs(Mt,{to:"/",className:"flex items-center gap-2",children:[o.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg bg-accent",children:o.jsx("img",{src:"/images/logo/logo-icon-current-color.svg",alt:"Hjaelp.ai",className:"h-5 w-5"})}),o.jsx("img",{src:"/images/logo/logo-text.svg",alt:"Hjaelp.ai",className:"h-6"})]})}),o.jsx("nav",{className:"hidden lg:flex items-center gap-8 absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2",children:KY.map(r=>o.jsx(Mt,{to:r.href,className:ne("text-sm font-medium transition-colors hover:text-primary whitespace-nowrap",n.pathname===r.href?"text-foreground":"text-muted-foreground"),children:r.label},r.href))}),o.jsxs("div",{className:"hidden lg:flex items-center gap-3 justify-end lg:w-1/2",children:[o.jsx(le,{variant:"ghost",size:"sm",asChild:!0,children:o.jsx(Mt,{to:"/sign-in",children:"Sign in"})}),o.jsx(le,{size:"sm",asChild:!0,children:o.jsxs(Mt,{to:"/sign-up",children:["Get started",o.jsx(Ai,{className:"ml-2 h-4 w-4"})]})})]}),o.jsxs("div",{className:"flex items-center gap-2 lg:hidden",children:[o.jsx("button",{className:"flex items-center gap-2 px-3 py-2 text-sm font-medium rounded-md hover:bg-accent transition-colors",onClick:()=>e(!t),"aria-label":"Toggle menu",children:t?o.jsxs(o.Fragment,{children:["Menu",o.jsx(mr,{className:"h-5 w-5"})]}):o.jsxs(o.Fragment,{children:["Menu",o.jsx(jTe,{className:"h-5 w-5"})]})}),o.jsx(le,{variant:"outline",size:"icon",asChild:!0,children:o.jsx(Mt,{to:"/sign-in","aria-label":"Sign in",children:o.jsx(Az,{className:"h-5 w-5"})})})]})]})}),t&&o.jsx("div",{className:"lg:hidden border-t border-b",children:o.jsxs("nav",{className:"mx-auto max-w-6xl px-4 py-4",children:[KY.map(r=>o.jsx(Mt,{to:r.href,className:ne("block text-sm font-medium transition-colors hover:text-primary py-2",n.pathname===r.href?"text-foreground":"text-muted-foreground"),onClick:()=>e(!1),children:r.label},r.href)),o.jsxs("div",{className:"flex flex-row gap-2 pt-2",children:[o.jsx(le,{variant:"outline",asChild:!0,className:"w-full",children:o.jsxs(Mt,{to:"/sign-in",onClick:()=>e(!1),children:[o.jsx(_Te,{className:"h-4 w-4"}),"Sign In"]})}),o.jsx(le,{asChild:!0,className:"w-full",children:o.jsxs(Mt,{to:"/sign-up",onClick:()=>e(!1),children:["Get Started",o.jsx(Ai,{className:"h-4 w-4"})]})})]})]})})]}),o.jsx("div",{className:"sticky top-[64px] z-49 w-full h-8 bg-gradient-to-b from-background via-background/75 to-transparent pointer-events-none"})]})}function Rft(){const{user:t,isInitialized:e}=Rr();return e?t?o.jsx(Ju,{to:"/dashboard",replace:!0}):o.jsxs("div",{className:"flex min-h-screen flex-col",children:[o.jsx(vhe,{}),o.jsx("main",{className:"flex-1 flex items-center justify-center p-8",children:o.jsx("div",{className:"w-full max-w-md animate-slide-up",children:o.jsx(fT,{})})})]}):o.jsx("div",{className:"flex h-screen items-center justify-center bg-background",children:o.jsxs("div",{className:"flex flex-col items-center gap-4",children:[o.jsx(Me,{className:"h-8 w-8 animate-spin text-primary"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading..."})]})})}function Ift(t,e=[]){let n=[];function r(s,a){const l=b.createContext(a),c=n.length;n=[...n,a];const u=f=>{var g;const{scope:h,children:p,...m}=f,x=((g=h==null?void 0:h[t])==null?void 0:g[c])||l,y=b.useMemo(()=>m,Object.values(m));return o.jsx(x.Provider,{value:y,children:p})};u.displayName=s+"Provider";function d(f,h){var x;const p=((x=h==null?void 0:h[t])==null?void 0:x[c])||l,m=b.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[u,d]}const i=()=>{const s=n.map(a=>b.createContext(a));return function(l){const c=(l==null?void 0:l[t])||s;return b.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return i.scopeName=t,[r,Dft(i,...e)]}function Dft(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));
vendor: 32,996 bytes, line 870
870return function(s){const a=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...l,...f}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return n.scopeName=e.scopeName,n}function Lft(t){const e=$ft(t),n=b.forwardRef((r,i)=>{const{children:s,...a}=r,l=b.Children.toArray(s),c=l.find(Uft);if(c){const u=c.props.children,d=l.map(f=>f===c?b.Children.count(u)>1?b.Children.only(null):b.isValidElement(u)?u.props.children:null:f);return o.jsx(e,{...a,ref:i,children:b.isValidElement(u)?b.cloneElement(u,void 0,d):null})}return o.jsx(e,{...a,ref:i,children:s})});return n.displayName=`${t}.Slot`,n}function $ft(t){const e=b.forwardRef((n,r)=>{const{children:i,...s}=n;if(b.isValidElement(i)){const a=Bft(i),l=zft(s,i.props);return i.type!==b.Fragment&&(l.ref=r?Ir(r,a):a),b.cloneElement(i,l)}return b.Children.count(i)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Fft=Symbol("radix.slottable");function Uft(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Fft}function zft(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...l)=>{const c=s(...l);return i(...l),c}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function Bft(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var Vft=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Hft=Vft.reduce((t,e)=>{const n=Lft(`Primitive.${e}`),r=b.forwardRef((i,s)=>{const{asChild:a,...l}=i,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function Wft(t,e=[]){let n=[];function r(s,a){const l=b.createContext(a),c=n.length;n=[...n,a];const u=f=>{var g;const{scope:h,children:p,...m}=f,x=((g=h==null?void 0:h[t])==null?void 0:g[c])||l,y=b.useMemo(()=>m,Object.values(m));return o.jsx(x.Provider,{value:y,children:p})};u.displayName=s+"Provider";function d(f,h){var x;const p=((x=h==null?void 0:h[t])==null?void 0:x[c])||l,m=b.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[u,d]}const i=()=>{const s=n.map(a=>b.createContext(a));return function(l){const c=(l==null?void 0:l[t])||s;return b.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return i.scopeName=t,[r,Gft(i,...e)]}function Gft(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const a=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...l,...f}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return n.scopeName=e.scopeName,n}function YY(t){const e=qft(t),n=b.forwardRef((r,i)=>{const{children:s,...a}=r,l=b.Children.toArray(s),c=l.find(Yft);if(c){const u=c.props.children,d=l.map(f=>f===c?b.Children.count(u)>1?b.Children.only(null):b.isValidElement(u)?u.props.children:null:f);return o.jsx(e,{...a,ref:i,children:b.isValidElement(u)?b.cloneElement(u,void 0,d):null})}return o.jsx(e,{...a,ref:i,children:s})});return n.displayName=`${t}.Slot`,n}function qft(t){const e=b.forwardRef((n,r)=>{const{children:i,...s}=n;if(b.isValidElement(i)){const a=Qft(i),l=Xft(s,i.props);return i.type!==b.Fragment&&(l.ref=r?Ir(r,a):a),b.cloneElement(i,l)}return b.Children.count(i)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Kft=Symbol("radix.slottable");function Yft(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Kft}function Xft(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...l)=>{const c=s(...l);return i(...l),c}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function Qft(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function $B(t){const e=t+"CollectionProvider",[n,r]=Wft(e),[i,s]=n(e,{collectionRef:{current:null},itemMap:new Map}),a=x=>{const{scope:y,children:g}=x,w=te.useRef(null),v=te.useRef(new Map).current;return o.jsx(i,{scope:y,itemMap:v,collectionRef:w,children:g})};a.displayName=e;const l=t+"CollectionSlot",c=YY(l),u=te.forwardRef((x,y)=>{const{scope:g,children:w}=x,v=s(l,g),N=Pn(y,v.collectionRef);return o.jsx(c,{ref:N,children:w})});u.displayName=l;const d=t+"CollectionItemSlot",f="data-radix-collection-item",h=YY(d),p=te.forwardRef((x,y)=>{const{scope:g,children:w,...v}=x,N=te.useRef(null),S=Pn(y,N),_=s(d,g);return te.useEffect(()=>(_.itemMap.set(N,{ref:N,...v}),()=>void _.itemMap.delete(N))),o.jsx(h,{[f]:"",ref:S,children:w})});p.displayName=d;function m(x){const y=s(t+"CollectionConsumer",x);return te.useCallback(()=>{const w=y.collectionRef.current;if(!w)return[];const v=Array.from(w.querySelectorAll(`[${f}]`));return Array.from(y.itemMap.values()).sort((_,j)=>v.indexOf(_.ref.current)-v.indexOf(j.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:a,Slot:u,ItemSlot:p},m,r]}function Jft(t,e=[]){let n=[];function r(s,a){const l=b.createContext(a),c=n.length;n=[...n,a];const u=f=>{var g;const{scope:h,children:p,...m}=f,x=((g=h==null?void 0:h[t])==null?void 0:g[c])||l,y=b.useMemo(()=>m,Object.values(m));return o.jsx(x.Provider,{value:y,children:p})};u.displayName=s+"Provider";function d(f,h){var x;const p=((x=h==null?void 0:h[t])==null?void 0:x[c])||l,m=b.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[u,d]}const i=()=>{const s=n.map(a=>b.createContext(a));return function(l){const c=(l==null?void 0:l[t])||s;return b.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return i.scopeName=t,[r,Zft(i,...e)]}function Zft(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const a=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...l,...f}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return n.scopeName=e.scopeName,n}var eht=b.createContext(void 0);function GM(t){const e=b.useContext(eht);return t||e||"ltr"}function bhe(t){const e=tht(t),n=b.forwardRef((r,i)=>{const{children:s,...a}=r,l=b.Children.toArray(s),c=l.find(rht);if(c){const u=c.props.children,d=l.map(f=>f===c?b.Children.count(u)>1?b.Children.only(null):b.isValidElement(u)?u.props.children:null:f);return o.jsx(e,{...a,ref:i,children:b.isValidElement(u)?b.cloneElement(u,void 0,d):null})}return o.jsx(e,{...a,ref:i,children:s})});return n.displayName=`${t}.Slot`,n}function tht(t){const e=b.forwardRef((n,r)=>{const{children:i,...s}=n;if(b.isValidElement(i)){const a=sht(i),l=iht(s,i.props);return i.type!==b.Fragment&&(l.ref=r?Ir(r,a):a),b.cloneElement(i,l)}return b.Children.count(i)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var nht=Symbol("radix.slottable");function rht(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===nht}function iht(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...l)=>{const c=s(...l);return i(...l),c}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function sht(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var aht=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],XS=aht.reduce((t,e)=>{const n=bhe(`Primitive.${e}`),r=b.forwardRef((i,s)=>{const{asChild:a,...l}=i,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function oht(t,e){t&&wl.flushSync(()=>t.dispatchEvent(e))}function lht(t,e=[]){let n=[];function r(s,a){const l=b.createContext(a),c=n.length;n=[...n,a];const u=f=>{var g;const{scope:h,children:p,...m}=f,x=((g=h==null?void 0:h[t])==null?void 0:g[c])||l,y=b.useMemo(()=>m,Object.values(m));return o.jsx(x.Provider,{value:y,children:p})};u.displayName=s+"Provider";function d(f,h){var x;const p=((x=h==null?void 0:h[t])==null?void 0:x[c])||l,m=b.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[u,d]}const i=()=>{const s=n.map(a=>b.createContext(a));return function(l){const c=(l==null?void 0:l[t])||s;return b.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return i.scopeName=t,[r,cht(i,...e)]}function cht(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const a=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...l,...f}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return n.scopeName=e.scopeName,n}function uht(t){const e=dht(t),n=b.forwardRef((r,i)=>{const{children:s,...a}=r,l=b.Children.toArray(s),c=l.find(hht);if(c){const u=c.props.children,d=l.map(f=>f===c?b.Children.count(u)>1?b.Children.only(null):b.isValidElement(u)?u.props.children:null:f);return o.jsx(e,{...a,ref:i,children:b.isValidElement(u)?b.cloneElement(u,void 0,d):null})}return o.jsx(e,{...a,ref:i,children:s})});return n.displayName=`${t}.Slot`,n}function dht(t){const e=b.forwardRef((n,r)=>{const{children:i,...s}=n;if(b.isValidElement(i)){const a=mht(i),l=pht(s,i.props);return i.type!==b.Fragment&&(l.ref=r?Ir(r,a):a),b.cloneElement(i,l)}return b.Children.count(i)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var fht=Symbol("radix.slottable");function hht(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===fht}function pht(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...l)=>{const c=s(...l);return i(...l),c}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function mht(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var ght=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],whe=ght.reduce((t,e)=>{const n=uht(`Primitive.${e}`),r=b.forwardRef((i,s)=>{const{asChild:a,...l}=i,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),yI="rovingFocusGroup.onEntryFocus",xht={bubbles:!1,cancelable:!0},QS="RovingFocusGroup",[H$,_he,yht]=$B(QS),[vht,qM]=lht(QS,[yht]),[bht,wht]=vht(QS),She=b.forwardRef((t,e)=>o.jsx(H$.Provider,{scope:t.__scopeRovingFocusGroup,children:o.jsx(H$.Slot,{scope:t.__scopeRovingFocusGroup,children:o.jsx(_ht,{...t,ref:e})})}));She.displayName=QS;var _ht=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:s,currentTabStopId:a,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=t,h=b.useRef(null),p=Pn(e,h),m=GM(s),[x,y]=su({prop:a,defaultProp:l??null,onChange:c,caller:QS}),[g,w]=b.useState(!1),v=dc(u),N=_he(n),S=b.useRef(!1),[_,j]=b.useState(0);return b.useEffect(()=>{const A=h.current;if(A)return A.addEventListener(yI,v),()=>A.removeEventListener(yI,v)},[v]),o.jsx(bht,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:x,onItemFocus:b.useCallback(A=>y(A),[y]),onItemShiftTab:b.useCallback(()=>w(!0),[]),onFocusableItemAdd:b.useCallback(()=>j(A=>A+1),[]),onFocusableItemRemove:b.useCallback(()=>j(A=>A-1),[]),children:o.jsx(whe.div,{tabIndex:g||_===0?-1:0,"data-orientation":r,...f,ref:p,style:{outline:"none",...t.style},onMouseDown:at(t.onMouseDown,()=>{S.current=!0}),onFocus:at(t.onFocus,A=>{const C=!S.current;if(A.target===A.currentTarget&&C&&!g){const k=new CustomEvent(yI,xht);if(A.currentTarget.dispatchEvent(k),!k.defaultPrevented){const M=N().filter(O=>O.focusable),I=M.find(O=>O.active),R=M.find(O=>O.id===x),P=[I,R,...M].filter(Boolean).map(O=>O.ref.current);Che(P,d)}}S.current=!1}),onBlur:at(t.onBlur,()=>w(!1))})})}),Nhe="RovingFocusGroupItem",jhe=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:s,children:a,...l}=t,c=ys(),u=s||c,d=wht(Nhe,n),f=d.currentTabStopId===u,h=_he(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:x}=d;return b.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),o.jsx(H$.ItemSlot,{scope:n,id:u,focusable:r,active:i,children:o.jsx(whe.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...l,ref:e,onMouseDown:at(t.onMouseDown,y=>{r?d.onItemFocus(u):y.preventDefault()}),onFocus:at(t.onFocus,()=>d.onItemFocus(u)),onKeyDown:at(t.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){d.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const g=jht(y,d.orientation,d.dir);if(g!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let v=h().filter(N=>N.focusable).map(N=>N.ref.current);if(g==="last")v.reverse();else if(g==="prev"||g==="next"){g==="prev"&&v.reverse();const N=v.indexOf(y.currentTarget);v=d.loop?Cht(v,N+1):v.slice(N+1)}setTimeout(()=>Che(v))}}),children:typeof a=="function"?a({isCurrentTabStop:f,hasTabStop:x!=null}):a})})});jhe.displayName=Nhe;var Sht={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Nht(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function jht(t,e,n){const r=Nht(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Sht[r]}function Che(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function Cht(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var khe=She,Ehe=jhe,W$=["Enter"," "],kht=["ArrowDown","PageUp","Home"],Ahe=["ArrowUp","PageDown","End"],Eht=[...kht,...Ahe],Aht={ltr:[...W$,"ArrowRight"],rtl:[...W$,"ArrowLeft"]},Tht={ltr:["ArrowLeft"],rtl:["ArrowRight"]},JS="Menu",[P_,Mht,Pht]=$B(JS),[Pg,The]=Jft(JS,[Pht,xu,qM]),KM=xu(),Mhe=qM(),[Oht,Og]=Pg(JS),[Rht,ZS]=Pg(JS),Phe=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:i,onOpenChange:s,modal:a=!0}=t,l=KM(e),[c,u]=b.useState(null),d=b.useRef(!1),f=dc(s),h=GM(i);return b.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})}},[]),o.jsx(TS,{...l,children:o.jsx(Oht,{scope:e,open:n,onOpenChange:f,content:c,onContentChange:u,children:o.jsx(Rht,{scope:e,onClose:b.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:h,modal:a,children:r})})})};Phe.displayName=JS;var Iht="MenuAnchor",FB=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=KM(n);return o.jsx(T0,{...i,...r,ref:e})});FB.displayName=Iht;var UB="MenuPortal",[Dht,Ohe]=Pg(UB,{forceMount:void 0}),Rhe=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:i}=t,s=Og(UB,e);return o.jsx(Dht,{scope:e,forceMount:n,children:o.jsx(Na,{present:n||s.open,children:o.jsx(Sg,{asChild:!0,container:i,children:r})})})};Rhe.displayName=UB;var cl="MenuContent",[Lht,zB]=Pg(cl),Ihe=b.forwardRef((t,e)=>{const n=Ohe(cl,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,s=Og(cl,t.__scopeMenu),a=ZS(cl,t.__scopeMenu);return o.jsx(P_.Provider,{scope:t.__scopeMenu,children:o.jsx(Na,{present:r||s.open,children:o.jsx(P_.Slot,{scope:t.__scopeMenu,children:a.modal?o.jsx($ht,{...i,ref:e}):o.jsx(Fht,{...i,ref:e})})})})}),$ht=b.forwardRef((t,e)=>{const n=Og(cl,t.__scopeMenu),r=b.useRef(null),i=Pn(e,r);return b.useEffect(()=>{const s=r.current;if(s)return jT(s)},[]),o.jsx(BB,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:at(t.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Fht=b.forwardRef((t,e)=>{const n=Og(cl,t.__scopeMenu);return o.jsx(BB,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Uht=bhe("MenuContent.ScrollLock"),BB=b.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:h,onDismiss:p,disableOutsideScroll:m,...x}=t,y=Og(cl,n),g=ZS(cl,n),w=KM(n),v=Mhe(n),N=Mht(n),[S,_]=b.useState(null),j=b.useRef(null),A=Pn(e,j,y.onContentChange),C=b.useRef(0),k=b.useRef(""),M=b.useRef(0),I=b.useRef(null),R=b.useRef("right"),E=b.useRef(0),P=m?kS:b.Fragment,O=m?{as:Uht,allowPinchZoom:!0}:void 0,L=D=>{var K,ee;const F=k.current+D,q=N().filter(V=>!V.disabled),B=document.activeElement,z=(K=q.find(V=>V.ref.current===B))==null?void 0:K.textValue,H=q.map(V=>V.textValue),W=Jht(H,F,z),G=(ee=q.find(V=>V.textValue===W))==null?void 0:ee.ref.current;(function V(J){k.current=J,window.clearTimeout(C.current),J!==""&&(C.current=window.setTimeout(()=>V(""),1e3))})(F),G&&setTimeout(()=>G.focus())};b.useEffect(()=>()=>window.clearTimeout(C.current),[]),ST();const T=b.useCallback(D=>{var q,B;return R.current===((q=I.current)==null?void 0:q.side)&&ept(D,(B=I.current)==null?void 0:B.area)},[]);return o.jsx(Lht,{scope:n,searchRef:k,onItemEnter:b.useCallback(D=>{T(D)&&D.preventDefault()},[T]),onItemLeave:b.useCallback(D=>{var F;T(D)||((F=j.current)==null||F.focus(),_(null))},[T]),onTriggerLeave:b.useCallback(D=>{T(D)&&D.preventDefault()},[T]),pointerGraceTimerRef:M,onPointerGraceIntentChange:b.useCallback(D=>{I.current=D},[]),children:o.jsx(P,{...O,children:o.jsx(jS,{asChild:!0,trapped:i,onMountAutoFocus:at(s,D=>{var F;D.preventDefault(),(F=j.current)==null||F.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:o.jsx(_g,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:h,onDismiss:p,children:o.jsx(khe,{asChild:!0,...v,dir:g.dir,orientation:"vertical",loop:r,currentTabStopId:S,onCurrentTabStopIdChange:_,onEntryFocus:at(c,D=>{g.isUsingKeyboardRef.current||D.preventDefault()}),preventScrollOnEntryFocus:!0,children:o.jsx(MS,{role:"menu","aria-orientation":"vertical","data-state":Qhe(y.open),"data-radix-menu-content":"",dir:g.dir,...w,...x,ref:A,style:{outline:"none",...x.style},onKeyDown:at(x.onKeyDown,D=>{const q=D.target.closest("[data-radix-menu-content]")===D.currentTarget,B=D.ctrlKey||D.altKey||D.metaKey,z=D.key.length===1;q&&(D.key==="Tab"&&D.preventDefault(),!B&&z&&L(D.key));const H=j.current;if(D.target!==H||!Eht.includes(D.key))return;D.preventDefault();const G=N().filter(K=>!K.disabled).map(K=>K.ref.current);Ahe.includes(D.key)&&G.reverse(),Xht(G)}),onBlur:at(t.onBlur,D=>{D.currentTarget.contains(D.target)||(window.clearTimeout(C.current),k.current="")}),onPointerMove:at(t.onPointerMove,O_(D=>{const F=D.target,q=E.current!==D.clientX;if(D.currentTarget.contains(F)&&q){const B=D.clientX>E.current?"right":"left";R.current=B,E.current=D.clientX}}))})})})})})})});Ihe.displayName=cl;var zht="MenuGroup",VB=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return o.jsx(XS.div,{role:"group",...r,ref:e})});VB.displayName=zht;var Bht="MenuLabel",Dhe=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return o.jsx(XS.div,{...r,ref:e})});Dhe.displayName=Bht;var hE="MenuItem",XY="menu.itemSelect",YM=b.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...i}=t,s=b.useRef(null),a=ZS(hE,t.__scopeMenu),l=zB(hE,t.__scopeMenu),c=Pn(e,s),u=b.useRef(!1),d=()=>{const f=s.current;if(!n&&f){const h=new CustomEvent(XY,{bubbles:!0,cancelable:!0});f.addEventListener(XY,p=>r==null?void 0:r(p),{once:!0}),oht(f,h),h.defaultPrevented?u.current=!1:a.onClose()}};return o.jsx(Lhe,{...i,ref:c,disabled:n,onClick:at(t.onClick,d),onPointerDown:f=>{var h;(h=t.onPointerDown)==null||h.call(t,f),u.current=!0},onPointerUp:at(t.onPointerUp,f=>{var h;u.current||(h=f.currentTarget)==null||h.click()}),onKeyDown:at(t.onKeyDown,f=>{const h=l.searchRef.current!=="";n||h&&f.key===" "||W$.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});YM.displayName=hE;var Lhe=b.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...s}=t,a=zB(hE,n),l=Mhe(n),c=b.useRef(null),u=Pn(e,c),[d,f]=b.useState(!1),[h,p]=b.useState("");return b.useEffect(()=>{const m=c.current;m&&p((m.textContent??"").trim())},[s.children]),o.jsx(P_.ItemSlot,{scope:n,disabled:r,textValue:i??h,children:o.jsx(Ehe,{asChild:!0,...l,focusable:!r,children:o.jsx(XS.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:u,onPointerMove:at(t.onPointerMove,O_(m=>{r?a.onItemLeave(m):(a.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:at(t.onPointerLeave,O_(m=>a.onItemLeave(m))),onFocus:at(t.onFocus,()=>f(!0)),onBlur:at(t.onBlur,()=>f(!1))})})})}),Vht="MenuCheckboxItem",$he=b.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...i}=t;return o.jsx(Vhe,{scope:t.__scopeMenu,checked:n,children:o.jsx(YM,{role:"menuitemcheckbox","aria-checked":pE(n)?"mixed":n,...i,ref:e,"data-state":WB(n),onSelect:at(i.onSelect,()=>r==null?void 0:r(pE(n)?!0:!n),{checkForDefaultPrevented:!1})})})});$he.displayName=Vht;var Fhe="MenuRadioGroup",[Hht,Wht]=Pg(Fhe,{value:void 0,onValueChange:()=>{}}),Uhe=b.forwardRef((t,e)=>{const{value:n,onValueChange:r,...i}=t,s=dc(r);return o.jsx(Hht,{scope:t.__scopeMenu,value:n,onValueChange:s,children:o.jsx(VB,{...i,ref:e})})});Uhe.displayName=Fhe;var zhe="MenuRadioItem",Bhe=b.forwardRef((t,e)=>{const{value:n,...r}=t,i=Wht(zhe,t.__scopeMenu),s=n===i.value;return o.jsx(Vhe,{scope:t.__scopeMenu,checked:s,children:o.jsx(YM,{role:"menuitemradio","aria-checked":s,...r,ref:e,"data-state":WB(s),onSelect:at(r.onSelect,()=>{var a;return(a=i.onValueChange)==null?void 0:a.call(i,n)},{checkForDefaultPrevented:!1})})})});Bhe.displayName=zhe;var HB="MenuItemIndicator",[Vhe,Ght]=Pg(HB,{checked:!1}),Hhe=b.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...i}=t,s=Ght(HB,n);return o.jsx(Na,{present:r||pE(s.checked)||s.checked===!0,children:o.jsx(XS.span,{...i,ref:e,"data-state":WB(s.checked)})})});Hhe.displayName=HB;var qht="MenuSeparator",Whe=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return o.jsx(XS.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});Whe.displayName=qht;var Kht="MenuArrow",Ghe=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=KM(n);return o.jsx(PS,{...i,...r,ref:e})});Ghe.displayName=Kht;var Yht="MenuSub",[z8t,qhe]=Pg(Yht),mw="MenuSubTrigger",Khe=b.forwardRef((t,e)=>{const n=Og(mw,t.__scopeMenu),r=ZS(mw,t.__scopeMenu),i=qhe(mw,t.__scopeMenu),s=zB(mw,t.__scopeMenu),a=b.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=s,u={__scopeMenu:t.__scopeMenu},d=b.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return b.useEffect(()=>d,[d]),b.useEffect(()=>{const f=l.current;return()=>{window.clearTimeout(f),c(null)}},[l,c]),o.jsx(FB,{asChild:!0,...u,children:o.jsx(Lhe,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":Qhe(n.open),...t,ref:Ir(e,i.onTriggerChange),onClick:f=>{var h;(h=t.onClick)==null||h.call(t,f),!(t.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:at(t.onPointerMove,O_(f=>{s.onItemEnter(f),!f.defaultPrevented&&!t.disabled&&!n.open&&!a.current&&(s.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:at(t.onPointerLeave,O_(f=>{var p,m;d();const h=(p=n.content)==null?void 0:p.getBoundingClientRect();if(h){const x=(m=n.content)==null?void 0:m.dataset.side,y=x==="right",g=y?-5:5,w=h[y?"left":"right"],v=h[y?"right":"left"];s.onPointerGraceIntentChange({area:[{x:f.clientX+g,y:f.clientY},{x:w,y:h.top},{x:v,y:h.top},{x:v,y:h.bottom},{x:w,y:h.bottom}],side:x}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(f),f.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:at(t.onKeyDown,f=>{var p;const h=s.searchRef.current!=="";t.disabled||h&&f.key===" "||Aht[r.dir].includes(f.key)&&(n.onOpenChange(!0),(p=n.content)==null||p.focus(),f.preventDefault())})})})});Khe.displayName=mw;var Yhe="MenuSubContent",Xhe=b.forwardRef((t,e)=>{const n=Ohe(cl,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,s=Og(cl,t.__scopeMenu),a=ZS(cl,t.__scopeMenu),l=qhe(Yhe,t.__scopeMenu),c=b.useRef(null),u=Pn(e,c);return o.jsx(P_.Provider,{scope:t.__scopeMenu,children:o.jsx(Na,{present:r||s.open,children:o.jsx(P_.Slot,{scope:t.__scopeMenu,children:o.jsx(BB,{id:l.contentId,"aria-labelledby":l.triggerId,...i,ref:u,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var f;a.isUsingKeyboardRef.current&&((f=c.current)==null||f.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:at(t.onFocusOutside,d=>{d.target!==l.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:at(t.onEscapeKeyDown,d=>{a.onClose(),d.preventDefault()}),onKeyDown:at(t.onKeyDown,d=>{var p;const f=d.currentTarget.contains(d.target),h=Tht[a.dir].includes(d.key);f&&h&&(s.onOpenChange(!1),(p=l.trigger)==null||p.focus(),d.preventDefault())})})})})})});Xhe.displayName=Yhe;function Qhe(t){return t?"open":"closed"}function pE(t){return t==="indeterminate"}function WB(t){return pE(t)?"indeterminate":t?"checked":"unchecked"}function Xht(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function Qht(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function Jht(t,e,n){const i=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,s=n?t.indexOf(n):-1;let a=Qht(t,Math.max(s,0));i.length===1&&(a=a.filter(u=>u!==n));const c=a.find(u=>u.toLowerCase().startsWith(i.toLowerCase()));return c!==n?c:void 0}function Zht(t,e){const{x:n,y:r}=t;let i=!1;for(let s=0,a=e.length-1;s<e.length;a=s++){const l=e[s],c=e[a],u=l.x,d=l.y,f=c.x,h=c.y;d>r!=h>r&&n<(f-u)*(r-d)/(h-d)+u&&(i=!i)}return i}function ept(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return Zht(n,e)}function O_(t){return e=>e.pointerType==="mouse"?t(e):void 0}var tpt=Phe,npt=FB,rpt=Rhe,ipt=Ihe,spt=VB,apt=Dhe,opt=YM,lpt=$he,cpt=Uhe,upt=Bhe,dpt=Hhe,fpt=Whe,hpt=Ghe,ppt=Khe,mpt=Xhe,XM="DropdownMenu",[gpt]=Ift(XM,[The]),Ca=The(),[xpt,Jhe]=gpt(XM),Zhe=t=>{const{__scopeDropdownMenu:e,children:n,dir:r,open:i,defaultOpen:s,onOpenChange:a,modal:l=!0}=t,c=Ca(e),u=b.useRef(null),[d,f]=su({prop:i,defaultProp:s??!1,onChange:a,caller:XM});return o.jsx(xpt,{scope:e,triggerId:ys(),triggerRef:u,contentId:ys(),open:d,onOpenChange:f,onOpenToggle:b.useCallback(()=>f(h=>!h),[f]),modal:l,children:o.jsx(tpt,{...c,open:d,onOpenChange:f,dir:r,modal:l,children:n})})};Zhe.displayName=XM;var epe="DropdownMenuTrigger",tpe=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...i}=t,s=Jhe(epe,n),a=Ca(n);return o.jsx(npt,{asChild:!0,...a,children:o.jsx(Hft.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...i,ref:Ir(e,s.triggerRef),onPointerDown:at(t.onPointerDown,l=>{!r&&l.button===0&&l.ctrlKey===!1&&(s.onOpenToggle(),s.open||l.preventDefault())}),onKeyDown:at(t.onKeyDown,l=>{r||(["Enter"," "].includes(l.key)&&s.onOpenToggle(),l.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});tpe.displayName=epe;var ypt="DropdownMenuPortal",npe=t=>{const{__scopeDropdownMenu:e,...n}=t,r=Ca(e);return o.jsx(rpt,{...r,...n})};npe.displayName=ypt;var rpe="DropdownMenuContent",ipe=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Jhe(rpe,n),s=Ca(n),a=b.useRef(!1);return o.jsx(ipt,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...r,ref:e,onCloseAutoFocus:at(t.onCloseAutoFocus,l=>{var c;a.current||(c=i.triggerRef.current)==null||c.focus(),a.current=!1,l.preventDefault()}),onInteractOutside:at(t.onInteractOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;(!i.modal||d)&&(a.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});ipe.displayName=rpe;var vpt="DropdownMenuGroup",bpt=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Ca(n);return o.jsx(spt,{...i,...r,ref:e})});bpt.displayName=vpt;var wpt="DropdownMenuLabel",spe=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Ca(n);return o.jsx(apt,{...i,...r,ref:e})});spe.displayName=wpt;var _pt="DropdownMenuItem",ape=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Ca(n);return o.jsx(opt,{...i,...r,ref:e})});ape.displayName=_pt;var Spt="DropdownMenuCheckboxItem",Npt=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Ca(n);return o.jsx(lpt,{...i,...r,ref:e})});Npt.displayName=Spt;var jpt="DropdownMenuRadioGroup",Cpt=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Ca(n);return o.jsx(cpt,{...i,...r,ref:e})});Cpt.displayName=jpt;var kpt="DropdownMenuRadioItem",Ept=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Ca(n);return o.jsx(upt,{...i,...r,ref:e})});Ept.displayName=kpt;var Apt="DropdownMenuItemIndicator",Tpt=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Ca(n);return o.jsx(dpt,{...i,...r,ref:e})});Tpt.displayName=Apt;var Mpt="DropdownMenuSeparator",ope=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Ca(n);return o.jsx(fpt,{...i,...r,ref:e})});ope.displayName=Mpt;var Ppt="DropdownMenuArrow",Opt=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Ca(n);return o.jsx(hpt,{...i,...r,ref:e})});Opt.displayName=Ppt;var Rpt="DropdownMenuSubTrigger",lpe=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Ca(n);return o.jsx(ppt,{...i,...r,ref:e})});lpe.displayName=Rpt;var Ipt="DropdownMenuSubContent",cpe=b.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Ca(n);return o.jsx(mpt,{...i,...r,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});cpe.displayName=Ipt;var Dpt=Zhe,Lpt=tpe,$pt=npe,upe=ipe,dpe=spe,fpe=ape,hpe=ope,ppe=lpe,mpe=cpe;const gc=Dpt,xc=Lpt,Fpt=b.forwardRef(({className:t,inset:e,children:n,...r},i)=>o.jsxs(ppe,{ref:i,className:ne("flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e&&"pl-8",t),...r,children:[n,o.jsx(Ga,{className:"ml-auto"})]}));Fpt.displayName=ppe.displayName;const Upt=b.forwardRef(({className:t,...e},n)=>o.jsx(mpe,{ref:n,className:ne("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
870de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...e}));Upt.displayName=mpe.displayName;const vl=b.forwardRef(({className:t,sideOffset:e=4,...n},r)=>o.jsx($pt,{children:o.jsx(upe,{ref:r,sideOffset:e,className:ne("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n})}));vl.displayName=upe.displayName;const lr=b.forwardRef(({className:t,inset:e,...n},r)=>o.jsx(fpe,{ref:r,className:ne("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e&&"pl-8",t),...n}));lr.displayName=fpe.displayName;const zpt=b.forwardRef(({className:t,inset:e,...n},r)=>o.jsx(dpe,{ref:r,className:ne("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...n}));zpt.displayName=dpe.displayName;const Ad=b.forwardRef(({className:t,...e},n)=>o.jsx(hpe,{ref:n,className:ne("-mx-1 my-1 h-px bg-muted",t),...e}));Ad.displayName=hpe.displayName;const Bpt=[{icon:Bse,label:"Overview",path:"/admin"},{icon:qse,label:"Packages",path:"/admin/packages"},{icon:pr,label:"Features",path:"/admin/features"},{icon:ga,label:"LLM Providers",path:"/admin/llm-providers"},{icon:ll,label:"Issue Types",path:"/admin/issue-types"},{icon:wT,label:"Settings",path:"/admin/settings"}];function Vpt(){var a,l;const t=Ya(),e=Nr(),{user:n,profile:r,logout:i}=Rr(),s=async()=>{await i(),e("/login")};return o.jsxs("aside",{className:"flex w-64 flex-col border-r border-border bg-card/50",children:[o.jsxs("div",{className:"flex h-16 items-center gap-3 border-b border-border px-4",children:[o.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg bg-destructive",children:o.jsx(wT,{className:"h-5 w-5 text-destructive-foreground"})}),o.jsx("span",{className:"font-semibold",children:"Admin Panel"})]}),o.jsx("div",{className:"border-b border-border p-4",children:o.jsxs(le,{variant:"outline",className:"w-full justify-start",onClick:()=>e("/dashboard"),children:[o.jsx(Ii,{className:"h-4 w-4"}),"Back to App"]})}),o.jsx("nav",{className:"flex-1 flex flex-col p-4",children:o.jsxs("div",{className:"flex-1 space-y-1",children:[o.jsx("div",{className:"mb-2 px-3 text-xs font-medium tracking-wider text-muted-foreground",children:"Admin"}),Bpt.map(c=>{const u=t.pathname===c.path;return o.jsxs(Mt,{to:c.path,className:ne("flex items-center gap-3 rounded-lg px-3 py-2 text-sm transition-colors",u?"bg-primary/10 text-primary":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:[o.jsx(c.icon,{className:"h-4 w-4"}),o.jsx("span",{children:c.label})]},c.path)})]})}),o.jsx("div",{className:"border-t border-border p-4",children:o.jsxs(gc,{children:[o.jsx(xc,{asChild:!0,children:o.jsxs(le,{variant:"ghost",className:"w-full justify-between px-3",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-destructive/10 text-sm font-medium text-destructive",children:((l=(a=r==null?void 0:r.fullName)==null?void 0:a.charAt(0))==null?void 0:l.toUpperCase())||"A"}),o.jsxs("div",{className:"text-left",children:[o.jsx("p",{className:"text-sm font-medium truncate max-w-[120px]",children:(r==null?void 0:r.fullName)||"Admin"}),o.jsx("p",{className:"text-xs text-muted-foreground truncate max-w-[120px]",children:n==null?void 0:n.email})]})]}),o.jsx(Kc,{className:"h-4 w-4 text-muted-foreground"})]})}),o.jsxs(vl,{align:"end",className:"w-56",children:[o.jsxs(lr,{onClick:()=>e("/dashboard"),children:[o.jsx(Ii,{className:"h-4 w-4"}),"Back to App"]}),o.jsx(Ad,{}),o.jsxs(lr,{onClick:s,className:"text-destructive focus:text-destructive",children:[o.jsx(Gse,{className:"h-4 w-4"}),"Log out"]})]})]})})]})}function Hpt(){const{session:t,profile:e,isInitialized:n}=Rr();return n?t?e?e.isAdmin?o.jsxs("div",{className:"flex h-screen bg-background",children:[o.jsx(Vpt,{}),o.jsx("main",{className:"flex-1 overflow-auto",children:o.jsx("div",{className:"container mx-auto py-8 px-6",children:o.jsx(fT,{})})})]}):o.jsx(Ju,{to:"/dashboard",replace:!0}):o.jsx("div",{className:"flex h-screen items-center justify-center bg-background",children:o.jsxs("div",{className:"flex flex-col items-center gap-4",children:[o.jsx(Me,{className:"h-8 w-8 animate-spin text-primary"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading profile..."})]})}):o.jsx(Ju,{to:"/login",replace:!0}):o.jsx("div",{className:"flex h-screen items-center justify-center bg-background",children:o.jsxs("div",{className:"flex flex-col items-center gap-4",children:[o.jsx(Me,{className:"h-8 w-8 animate-spin text-primary"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading..."})]})})}/**
871 * @license
872 * Copyright 2010-2024 Three.js Authors
873 * SPDX-License-Identifier: MIT
874 */const GB="167",Wpt=0,QY=1,Gpt=2,gpe=1,qpt=2,Lu=3,$h=0,Va=1,Yu=2,gh=0,Py=1,JY=2,ZY=3,eX=4,Kpt=5,Bp=100,Ypt=101,Xpt=102,Qpt=103,Jpt=104,Zpt=200,emt=201,tmt=202,nmt=2
vendor: 5,128 bytes, line 874
87403,G$=204,q$=205,rmt=206,imt=207,smt=208,amt=209,omt=210,lmt=211,cmt=212,umt=213,dmt=214,fmt=0,hmt=1,pmt=2,mE=3,mmt=4,gmt=5,xmt=6,ymt=7,xpe=0,vmt=1,bmt=2,xh=0,wmt=1,_mt=2,Smt=3,Nmt=4,jmt=5,Cmt=6,kmt=7,ype=300,Bv=301,Vv=302,K$=303,Y$=304,QM=306,X$=1e3,tm=1001,Q$=1002,sl=1003,Emt=1004,wj=1005,Xl=1006,vI=1007,nm=1008,Td=1009,vpe=1010,bpe=1011,R_=1012,qB=1013,Zm=1014,rd=1015,eN=1016,KB=1017,YB=1018,Hv=1020,wpe=35902,_pe=1021,Spe=1022,ec=1023,Npe=1024,jpe=1025,Oy=1026,Wv=1027,Cpe=1028,XB=1029,kpe=1030,QB=1031,JB=1033,JC=33776,ZC=33777,ek=33778,tk=33779,J$=35840,Z$=35841,e5=35842,t5=35843,n5=36196,r5=37492,i5=37496,s5=37808,a5=37809,o5=37810,l5=37811,c5=37812,u5=37813,d5=37814,f5=37815,h5=37816,p5=37817,m5=37818,g5=37819,x5=37820,y5=37821,nk=36492,v5=36494,b5=36495,Epe=36283,w5=36284,_5=36285,S5=36286,Amt=3200,Tmt=3201,Mmt=0,Pmt=1,Af="",Mc="srgb",rp="srgb-linear",ZB="display-p3",JM="display-p3-linear",gE="linear",Fr="srgb",xE="rec709",yE="p3",ox=7680,tX=519,Omt=512,Rmt=513,Imt=514,Ape=515,Dmt=516,Lmt=517,$mt=518,Fmt=519,nX=35044,rX="300 es",id=2e3,vE=2001;class q0{addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(n)===-1&&r[e].push(n)}hasEventListener(e,n){if(this._listeners===void 0)return!1;const r=this._listeners;return r[e]!==void 0&&r[e].indexOf(n)!==-1}removeEventListener(e,n){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(n);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const r=this._listeners[e.type];if(r!==void 0){e.target=this;const i=r.slice(0);for(let s=0,a=i.length;s<a;s++)i[s].call(this,e);e.target=null}}}const zs=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],bI=Math.PI/180,N5=180/Math.PI;function tN(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(zs[t&255]+zs[t>>8&255]+zs[t>>16&255]+zs[t>>24&255]+"-"+zs[e&255]+zs[e>>8&255]+"-"+zs[e>>16&15|64]+zs[e>>24&255]+"-"+zs[n&63|128]+zs[n>>8&255]+"-"+zs[n>>16&255]+zs[n>>24&255]+zs[r&255]+zs[r>>8&255]+zs[r>>16&255]+zs[r>>24&255]).toLowerCase()}function La(t,e,n){return Math.max(e,Math.min(n,t))}function Umt(t,e){return(t%e+e)%e}function wI(t,e,n){return(1-n)*t+n*e}function Ab(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function Aa(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(t*4294967295);case Uint16Array:return Math.round(t*65535);case Uint8Array:return Math.round(t*255);case Int32Array:return Math.round(t*2147483647);case Int16Array:return Math.round(t*32767);case Int8Array:return Math.round(t*127);default:throw new Error("Invalid component type.")}}class Mn{constructor(e=0,n=0){Mn.prototype.isVector2=!0,this.x=e,this.y=n}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,n){return this.x=e,this.y=n,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this}
vendor: 34,561 bytes, line 874
874sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const n=this.x,r=this.y,i=e.elements;return this.x=i[0]*n+i[3]*r+i[6],this.y=i[1]*n+i[4]*r+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(n,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const r=this.dot(e)/n;return Math.acos(La(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,r=this.y-e.y;return n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this}rotateAround(e,n){const r=Math.cos(n),i=Math.sin(n),s=this.x-e.x,a=this.y-e.y;return this.x=s*r-a*i+e.x,this.y=s*i+a*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class wn{constructor(e,n,r,i,s,a,l,c,u){wn.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,n,r,i,s,a,l,c,u)}set(e,n,r,i,s,a,l,c,u){const d=this.elements;return d[0]=e,d[1]=i,d[2]=l,d[3]=n,d[4]=s,d[5]=c,d[6]=r,d[7]=a,d[8]=u,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const n=this.elements,r=e.elements;return n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],this}extractBasis(e,n,r){return e.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const n=e.elements;return this.set(n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const r=e.elements,i=n.elements,s=this.elements,a=r[0],l=r[3],c=r[6],u=r[1],d=r[4],f=r[7],h=r[2],p=r[5],m=r[8],x=i[0],y=i[3],g=i[6],w=i[1],v=i[4],N=i[7],S=i[2],_=i[5],j=i[8];return s[0]=a*x+l*w+c*S,s[3]=a*y+l*v+c*_,s[6]=a*g+l*N+c*j,s[1]=u*x+d*w+f*S,s[4]=u*y+d*v+f*_,s[7]=u*g+d*N+f*j,s[2]=h*x+p*w+m*S,s[5]=h*y+p*v+m*_,s[8]=h*g+p*N+m*j,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=e,n[4]*=e,n[7]*=e,n[2]*=e,n[5]*=e,n[8]*=e,this}determinant(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],a=e[4],l=e[5],c=e[6],u=e[7],d=e[8];return n*a*d-n*l*u-r*s*d+r*l*c+i*s*u-i*a*c}invert(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],a=e[4],l=e[5],c=e[6],u=e[7],d=e[8],f=d*a-l*u,h=l*c-d*s,p=u*s-a*c,m=n*f+r*h+i*p;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const x=1/m;return e[0]=f*x,e[1]=(i*u-d*r)*x,e[2]=(l*r-i*a)*x,e[3]=h*x,e[4]=(d*n-i*c)*x,e[5]=(i*s-l*n)*x,e[6]=p*x,e[7]=(r*c-u*n)*x,e[8]=(a*n-r*s)*x,this}transpose(){let e;const n=this.elements;return e=n[1],n[1]=n[3],n[3]=e,e=n[2],n[2]=n[6],n[6]=e,e=n[5],n[5]=n[7],n[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const n=this.elements;return e[0]=n[0],e[1]=n[3],e[2]=n[6],e[3]=n[1],e[4]=n[4],e[5]=n[7],e[6]=n[2],e[7]=n[5],e[8]=n[8],this}setUvTransform(e,n,r,i,s,a,l){const c=Math.cos(s),u=Math.sin(s);return this.set(r*c,r*u,-r*(c*a+u*l)+a+e,-i*u,i*c,-i*(-u*a+c*l)+l+n,0,0,1),this}scale(e,n){return this.premultiply(_I.makeScale(e,n)),this}rotate(e){return this.premultiply(_I.makeRotation(-e)),this}translate(e,n){return this.premultiply(_I.makeTranslation(e,n)),this}makeTranslation(e,n){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,n,0,0,1),this}makeRotation(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,-r,0,r,n,0,0,0,1),this}makeScale(e,n){return this.set(e,0,0,0,n,0,0,0,1),this}equals(e){const n=this.elements,r=e.elements;for(let i=0;i<9;i++)if(n[i]!==r[i])return!1;return!0}fromArray(e,n=0){for(let r=0;r<9;r++)this.elements[r]=e[r+n];return this}toArray(e=[],n=0){const r=this.elements;return e[n]=r[0],e[n+1]=r[1],e[n+2]=r[2],e[n+3]=r[3],e[n+4]=r[4],e[n+5]=r[5],e[n+6]=r[6],e[n+7]=r[7],e[n+8]=r[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const _I=new wn;function Tpe(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}function bE(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function zmt(){const t=bE("canvas");return t.style.display="block",t}const iX={};function qw(t){t in iX||(iX[t]=!0,console.warn(t))}function Bmt(t,e,n){return new Promise(function(r,i){function s(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:i();break;case t.TIMEOUT_EXPIRED:setTimeout(s,n);break;default:r()}}setTimeout(s,n)})}const sX=new wn().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),aX=new wn().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Tb={[rp]:{transfer:gE,primaries:xE,luminanceCoefficients:[.2126,.7152,.0722],toReference:t=>t,fromReference:t=>t},[Mc]:{transfer:Fr,primaries:xE,luminanceCoefficients:[.2126,.7152,.0722],toReference:t=>t.convertSRGBToLinear(),fromReference:t=>t.convertLinearToSRGB()},[JM]:{transfer:gE,primaries:yE,luminanceCoefficients:[.2289,.6917,.0793],toReference:t=>t.applyMatrix3(aX),fromReference:t=>t.applyMatrix3(sX)},[ZB]:{transfer:Fr,primaries:yE,luminanceCoefficients:[.2289,.6917,.0793],toReference:t=>t.convertSRGBToLinear().applyMatrix3(aX),fromReference:t=>t.applyMatrix3(sX).convertLinearToSRGB()}},Vmt=new Set([rp,JM]),Xn={enabled:!0,_workingColorSpace:rp,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(t){if(!Vmt.has(t))throw new Error(`Unsupported working color space, "${t}".`);this._workingColorSpace=t},convert:function(t,e,n){if(this.enabled===!1||e===n||!e||!n)return t;const r=Tb[e].toReference,i=Tb[n].fromReference;return i(r(t))},fromWorkingColorSpace:function(t,e){return this.convert(t,this._workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this._workingColorSpace)},getPrimaries:function(t){return Tb[t].primaries},getTransfer:function(t){return t===Af?gE:Tb[t].transfer},getLuminanceCoefficients:function(t,e=this._workingColorSpace){return t.fromArray(Tb[e].luminanceCoefficients)}};function Ry(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function SI(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let lx;class Hmt{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{lx===void 0&&(lx=bE("canvas")),lx.width=e.width,lx.height=e.height;const r=lx.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=lx}return n.width>2048||n.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),n.toDataURL("image/jpeg",.6)):n.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const n=bE("canvas");n.width=e.width,n.height=e.height;const r=n.getContext("2d");r.drawImage(e,0,0,e.width,e.height);const i=r.getImageData(0,0,e.width,e.height),s=i.data;for(let a=0;a<s.length;a++)s[a]=Ry(s[a]/255)*255;return r.putImageData(i,0,0),n}else if(e.data){const n=e.data.slice(0);for(let r=0;r<n.length;r++)n instanceof Uint8Array||n instanceof Uint8ClampedArray?n[r]=Math.floor(Ry(n[r]/255)*255):n[r]=Ry(n[r]);return{data:n,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let Wmt=0;class Mpe{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Wmt++}),this.uuid=tN(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const n=e===void 0||typeof e=="string";if(!n&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const r={uuid:this.uuid,url:""},i=this.data;if(i!==null){let s;if(Array.isArray(i)){s=[];for(let a=0,l=i.length;a<l;a++)i[a].isDataTexture?s.push(NI(i[a].image)):s.push(NI(i[a]))}else s=NI(i);r.url=s}return n||(e.images[this.uuid]=r),r}}function NI(t){return typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap?Hmt.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let Gmt=0;class Ha extends q0{constructor(e=Ha.DEFAULT_IMAGE,n=Ha.DEFAULT_MAPPING,r=tm,i=tm,s=Xl,a=nm,l=ec,c=Td,u=Ha.DEFAULT_ANISOTROPY,d=Af){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Gmt++}),this.uuid=tN(),this.name="",this.source=new Mpe(e),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=r,this.wrapT=i,this.magFilter=s,this.minFilter=a,this.anisotropy=u,this.format=l,this.internalFormat=null,this.type=c,this.offset=new Mn(0,0),this.repeat=new Mn(1,1),this.center=new Mn(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new wn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=d,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const n=e===void 0||typeof e=="string";if(!n&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const r={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(r.userData=this.userData),n||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==ype)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case X$:e.x=e.x-Math.floor(e.x);break;case tm:e.x=e.x<0?0:1;break;case Q$:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case X$:e.y=e.y-Math.floor(e.y);break;case tm:e.y=e.y<0?0:1;break;case Q$:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}Ha.DEFAULT_IMAGE=null;Ha.DEFAULT_MAPPING=ype;Ha.DEFAULT_ANISOTROPY=1;class ps{constructor(e=0,n=0,r=0,i=1){ps.prototype.isVector4=!0,this.x=e,this.y=n,this.z=r,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,n,r,i){return this.x=e,this.y=n,this.z=r,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;case 3:this.w=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this.w=e.w+n.w,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this.w+=e.w*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this.w=e.w-n.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const n=this.x,r=this.y,i=this.z,s=this.w,a=e.elements;return this.x=a[0]*n+a[4]*r+a[8]*i+a[12]*s,this.y=a[1]*n+a[5]*r+a[9]*i+a[13]*s,this.z=a[2]*n+a[6]*r+a[10]*i+a[14]*s,this.w=a[3]*n+a[7]*r+a[11]*i+a[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const n=Math.sqrt(1-e.w*e.w);return n<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/n,this.y=e.y/n,this.z=e.z/n),this}setAxisAngleFromRotationMatrix(e){let n,r,i,s;const c=e.elements,u=c[0],d=c[4],f=c[8],h=c[1],p=c[5],m=c[9],x=c[2],y=c[6],g=c[10];if(Math.abs(d-h)<.01&&Math.abs(f-x)<.01&&Math.abs(m-y)<.01){if(Math.abs(d+h)<.1&&Math.abs(f+x)<.1&&Math.abs(m+y)<.1&&Math.abs(u+p+g-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const v=(u+1)/2,N=(p+1)/2,S=(g+1)/2,_=(d+h)/4,j=(f+x)/4,A=(m+y)/4;return v>N&&v>S?v<.01?(r=0,i=.707106781,s=.707106781):(r=Math.sqrt(v),i=_/r,s=j/r):N>S?N<.01?(r=.707106781,i=0,s=.707106781):(i=Math.sqrt(N),r=_/i,s=A/i):S<.01?(r=.707106781,i=.707106781,s=0):(s=Math.sqrt(S),r=j/s,i=A/s),this.set(r,i,s,n),this}let w=Math.sqrt((y-m)*(y-m)+(f-x)*(f-x)+(h-d)*(h-d));return Math.abs(w)<.001&&(w=1),this.x=(y-m)/w,this.y=(f-x)/w,this.z=(h-d)/w,this.w=Math.acos((u+p+g-1)/2),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this.w=n[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this.z=Math.max(e.z,Math.min(n.z,this.z)),this.w=Math.max(e.w,Math.min(n.w,this.w)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this.z=Math.max(e,Math.min(n,this.z)),this.w=Math.max(e,Math.min(n,this.w)),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(n,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this.w+=(e.w-this.w)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this.z=e.z+(n.z-e.z)*r,this.w=e.w+(n.w-e.w)*r,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this.w=e[n+3],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e[n+3]=this.w,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this.w=e.getW(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class qmt extends q0{constructor(e=1,n=1,r={}){super(),this.isRenderTarget=!0,this.width=e,this.height=n,this.depth=1,this.scissor=new ps(0,0,e,n),this.scissorTest=!1,this.viewport=new ps(0,0,e,n);const i={width:e,height:n,depth:1};r=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Xl,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},r);const s=new Ha(i,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.colorSpace);s.flipY=!1,s.generateMipmaps=r.generateMipmaps,s.internalFormat=r.internalFormat,this.textures=[];const a=r.count;for(let l=0;l<a;l++)this.textures[l]=s.clone(),this.textures[l].isRenderTargetTexture=!0;this.depthBuffer=r.depthBuffer,this.stencilBuffer=r.stencilBuffer,this.resolveDepthBuffer=r.resolveDepthBuffer,this.resolveStencilBuffer=r.resolveStencilBuffer,this.depthTexture=r.depthTexture,this.samples=r.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}setSize(e,n,r=1){if(this.width!==e||this.height!==n||this.depth!==r){this.width=e,this.height=n,this.depth=r;for(let i=0,s=this.textures.length;i<s;i++)this.textures[i].image.width=e,this.textures[i].image.height=n,this.textures[i].image.depth=r;this.dispose()}this.viewport.set(0,0,e,n),this.scissor.set(0,0,e,n)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let r=0,i=e.textures.length;r<i;r++)this.textures[r]=e.textures[r].clone(),this.textures[r].isRenderTargetTexture=!0;const n=Object.assign({},e.texture.image);return this.texture.source=new Mpe(n),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class eg extends qmt{constructor(e=1,n=1,r={}){super(e,n,r),this.isWebGLRenderTarget=!0}}class Ppe extends Ha{constructor(e=null,n=1,r=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:n,height:r,depth:i},this.magFilter=sl,this.minFilter=sl,this.wrapR=tm,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Kmt extends Ha{constructor(e=null,n=1,r=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:n,height:r,depth:i},this.magFilter=sl,this.minFilter=sl,this.wrapR=tm,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class nN{constructor(e=0,n=0,r=0,i=1){this.isQuaternion=!0,this._x=e,this._y=n,this._z=r,this._w=i}static slerpFlat(e,n,r,i,s,a,l){let c=r[i+0],u=r[i+1],d=r[i+2],f=r[i+3];const h=s[a+0],p=s[a+1],m=s[a+2],x=s[a+3];if(l===0){e[n+0]=c,e[n+1]=u,e[n+2]=d,e[n+3]=f;return}if(l===1){e[n+0]=h,e[n+1]=p,e[n+2]=m,e[n+3]=x;return}if(f!==x||c!==h||u!==p||d!==m){let y=1-l;const g=c*h+u*p+d*m+f*x,w=g>=0?1:-1,v=1-g*g;if(v>Number.EPSILON){const S=Math.sqrt(v),_=Math.atan2(S,g*w);y=Math.sin(y*_)/S,l=Math.sin(l*_)/S}const N=l*w;if(c=c*y+h*N,u=u*y+p*N,d=d*y+m*N,f=f*y+x*N,y===1-l){const S=1/Math.sqrt(c*c+u*u+d*d+f*f);c*=S,u*=S,d*=S,f*=S}}e[n]=c,e[n+1]=u,e[n+2]=d,e[n+3]=f}static multiplyQuaternionsFlat(e,n,r,i,s,a){const l=r[i],c=r[i+1],u=r[i+2],d=r[i+3],f=s[a],h=s[a+1],p=s[a+2],m=s[a+3];return e[n]=l*m+d*f+c*p-u*h,e[n+1]=c*m+d*h+u*f-l*p,e[n+2]=u*m+d*p+l*h-c*f,e[n+3]=d*m-l*f-c*h-u*p,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,n,r,i){return this._x=e,this._y=n,this._z=r,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,n=!0){const r=e._x,i=e._y,s=e._z,a=e._order,l=Math.cos,c=Math.sin,u=l(r/2),d=l(i/2),f=l(s/2),h=c(r/2),p=c(i/2),m=c(s/2);switch(a){case"XYZ":this._x=h*d*f+u*p*m,this._y=u*p*f-h*d*m,this._z=u*d*m+h*p*f,this._w=u*d*f-h*p*m;break;case"YXZ":this._x=h*d*f+u*p*m,this._y=u*p*f-h*d*m,this._z=u*d*m-h*p*f,this._w=u*d*f+h*p*m;break;case"ZXY":this._x=h*d*f-u*p*m,this._y=u*p*f+h*d*m,this._z=u*d*m+h*p*f,this._w=u*d*f-h*p*m;break;case"ZYX":this._x=h*d*f-u*p*m,this._y=u*p*f+h*d*m,this._z=u*d*m-h*p*f,this._w=u*d*f+h*p*m;break;case"YZX":this._x=h*d*f+u*p*m,this._y=u*p*f+h*d*m,this._z=u*d*m-h*p*f,this._w=u*d*f-h*p*m;break;case"XZY":this._x=h*d*f-u*p*m,this._y=u*p*f-h*d*m,this._z=u*d*m+h*p*f,this._w=u*d*f+h*p*m;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return n===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,n){const r=n/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){const n=e.elements,r=n[0],i=n[4],s=n[8],a=n[1],l=n[5],c=n[9],u=n[2],d=n[6],f=n[10],h=r+l+f;if(h>0){const p=.5/Math.sqrt(h+1);this._w=.25/p,this._x=(d-c)*p,this._y=(s-u)*p,this._z=(a-i)*p}else if(r>l&&r>f){const p=2*Math.sqrt(1+r-l-f);this._w=(d-c)/p,this._x=.25*p,this._y=(i+a)/p,this._z=(s+u)/p}else if(l>f){const p=2*Math.sqrt(1+l-r-f);this._w=(s-u)/p,this._x=(i+a)/p,this._y=.25*p,this._z=(c+d)/p}else{const p=2*Math.sqrt(1+f-r-l);this._w=(a-i)/p,this._x=(s+u)/p,this._y=(c+d)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,n){let r=e.dot(n)+1;return r<Number.EPSILON?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*n.z-e.z*n.y,this._y=e.z*n.x-e.x*n.z,this._z=e.x*n.y-e.y*n.x,this._w=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(La(this.dot(e),-1,1)))}rotateTowards(e,n){const r=this.angleTo(e);if(r===0)return this;const i=Math.min(1,n/r);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,n){const r=e._x,i=e._y,s=e._z,a=e._w,l=n._x,c=n._y,u=n._z,d=n._w;return this._x=r*d+a*l+i*u-s*c,this._y=i*d+a*c+s*l-r*u,this._z=s*d+a*u+r*c-i*l,this._w=a*d-r*l-i*c-s*u,this._onChangeCallback(),this}slerp(e,n){if(n===0)return this;if(n===1)return this.copy(e);const r=this._x,i=this._y,s=this._z,a=this._w;let l=a*e._w+r*e._x+i*e._y+s*e._z;if(l<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,l=-l):this.copy(e),l>=1)return this._w=a,this._x=r,this._y=i,this._z=s,this;const c=1-l*l;if(c<=Number.EPSILON){const p=1-n;return this._w=p*a+n*this._w,this._x=p*r+n*this._x,this._y=p*i+n*this._y,this._z=p*s+n*this._z,this.normalize(),this}const u=Math.sqrt(c),d=Math.atan2(u,l),f=Math.sin((1-n)*d)/u,h=Math.sin(n*d)/u;return this._w=a*f+this._w*h,this._x=r*f+this._x*h,this._y=i*f+this._y*h,this._z=s*f+this._z*h,this._onChangeCallback(),this}slerpQuaternions(e,n,r){return this.copy(e).slerp(n,r)}random(){const e=2*Math.PI*Math.random(),n=2*Math.PI*Math.random(),r=Math.random(),i=Math.sqrt(1-r),s=Math.sqrt(r);return this.set(i*Math.sin(e),i*Math.cos(e),s*Math.sin(n),s*Math.cos(n))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,n=0){return this._x=e[n],this._y=e[n+1],this._z=e[n+2],this._w=e[n+3],this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._w,e}fromBufferAttribute(e,n){return this._x=e.getX(n),this._y=e.getY(n),this._z=e.getZ(n),this._w=e.getW(n),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Re{constructor(e=0,n=0,r=0){Re.prototype.isVector3=!0,this.x=e,this.y=n,this.z=r}set(e,n,r){return r===void 0&&(r=this.z),this.x=e,this.y=n,this.z=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,n){return this.x=e.x*n.x,this.y=e.y*n.y,this.z=e.z*n.z,this}applyEuler(e){return this.applyQuaternion(oX.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(oX.setFromAxisAngle(e,n))}applyMatrix3(e){const n=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*n+s[3]*r+s[6]*i,this.y=s[1]*n+s[4]*r+s[7]*i,this.z=s[2]*n+s[5]*r+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const n=this.x,r=this.y,i=this.z,s=e.elements,a=1/(s[3]*n+s[7]*r+s[11]*i+s[15]);return this.x=(s[0]*n+s[4]*r+s[8]*i+s[12])*a,this.y=(s[1]*n+s[5]*r+s[9]*i+s[13])*a,this.z=(s[2]*n+s[6]*r+s[10]*i+s[14])*a,this}applyQuaternion(e){const n=this.x,r=this.y,i=this.z,s=e.x,a=e.y,l=e.z,c=e.w,u=2*(a*i-l*r),d=2*(l*n-s*i),f=2*(s*r-a*n);return this.x=n+c*u+a*f-l*d,this.y=r+c*d+l*u-s*f,this.z=i+c*f+s*d-a*u,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const n=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*n+s[4]*r+s[8]*i,this.y=s[1]*n+s[5]*r+s[9]*i,this.z=s[2]*n+s[6]*r+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this.z=Math.max(e.z,Math.min(n.z,this.z)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this.z=Math.max(e,Math.min(n,this.z)),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(n,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this.z=e.z+(n.z-e.z)*r,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,n){const r=e.x,i=e.y,s=e.z,a=n.x,l=n.y,c=n.z;return this.x=i*c-s*l,this.y=s*a-r*c,this.z=r*l-i*a,this}projectOnVector(e){const n=e.lengthSq();if(n===0)return this.set(0,0,0);const r=e.dot(this)/n;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return jI.copy(this).projectOnVector(e),this.sub(jI)}reflect(e){return this.sub(jI.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const r=this.dot(e)/n;return Math.acos(La(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return n*n+r*r+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,n,r){const i=Math.sin(n)*e;return this.x=i*Math.sin(r),this.y=Math.cos(n)*e,this.z=i*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,n,r){return this.x=e*Math.sin(n),this.y=r,this.z=e*Math.cos(n),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this}setFromMatrixScale(e){const n=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=n,this.y=r,this.z=i,this}setFromMatrixColumn(e,n){return this.fromArray(e.elements,n*4)}setFromMatrix3Column(e,n){return this.fromArray(e.elements,n*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,n=Math.random()*2-1,r=Math.sqrt(1-n*n);return this.x=r*Math.cos(e),this.y=n,this.z=r*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const jI=new Re,oX=new nN;class rN{constructor(e=new Re(1/0,1/0,1/0),n=new Re(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=n}set(e,n){return this.min.copy(e),this.max.copy(n),this}setFromArray(e){this.makeEmpty();for(let n=0,r=e.length;n<r;n+=3)this.expandByPoint(Al.fromArray(e,n));return this}setFromBufferAttribute(e){this.makeEmpty();for(let n=0,r=e.count;n<r;n++)this.expandByPoint(Al.fromBufferAttribute(e,n));return this}setFromPoints(e){this.makeEmpty();for(let n=0,r=e.length;n<r;
vendor: 4,422 bytes, line 874
874n++)this.expandByPoint(e[n]);return this}setFromCenterAndSize(e,n){const r=Al.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}setFromObject(e,n=!1){return this.makeEmpty(),this.expandByObject(e,n)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,n=!1){e.updateWorldMatrix(!1,!1);const r=e.geometry;if(r!==void 0){const s=r.getAttribute("position");if(n===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,l=s.count;a<l;a++)e.isMesh===!0?e.getVertexPosition(a,Al):Al.fromBufferAttribute(s,a),Al.applyMatrix4(e.matrixWorld),this.expandByPoint(Al);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),_j.copy(e.boundingBox)):(r.boundingBox===null&&r.computeBoundingBox(),_j.copy(r.boundingBox)),_j.applyMatrix4(e.matrixWorld),this.union(_j)}const i=e.children;for(let s=0,a=i.length;s<a;s++)this.expandByObject(i[s],n);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,n){return n.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Al),Al.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let n,r;return e.normal.x>0?(n=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(n=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(n+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(n+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(n+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(n+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),n<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Mb),Sj.subVectors(this.max,Mb),cx.subVectors(e.a,Mb),ux.subVectors(e.b,Mb),dx.subVectors(e.c,Mb),ef.subVectors(ux,cx),tf.subVectors(dx,ux),xp.subVectors(cx,dx);let n=[0,-ef.z,ef.y,0,-tf.z,tf.y,0,-xp.z,xp.y,ef.z,0,-ef.x,tf.z,0,-tf.x,xp.z,0,-xp.x,-ef.y,ef.x,0,-tf.y,tf.x,0,-xp.y,xp.x,0];return!CI(n,cx,ux,dx,Sj)||(n=[1,0,0,0,1,0,0,0,1],!CI(n,cx,ux,dx,Sj))?!1:(Nj.crossVectors(ef,tf),n=[Nj.x,Nj.y,Nj.z],CI(n,cx,ux,dx,Sj))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Al).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Al).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(ju[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),ju[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),ju[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),ju[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),ju[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),ju[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),ju[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),ju[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(ju),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const ju=[new Re,new Re,new Re,new Re,new Re,new Re,new Re,new Re],Al=new Re,_j=new rN,cx=new Re,ux=new Re,dx=new Re,ef=new Re,tf=new Re,xp=new Re,Mb=new Re,Sj=new Re,Nj=new Re,yp=new Re;function CI(t,e,n,r,i){for(let s=0,a=t.length-3;s<=a;
vendor: 19,360 bytes, line 874
874s+=3){yp.fromArray(t,s);const l=i.x*Math.abs(yp.x)+i.y*Math.abs(yp.y)+i.z*Math.abs(yp.z),c=e.dot(yp),u=n.dot(yp),d=r.dot(yp);if(Math.max(-Math.max(c,u,d),Math.min(c,u,d))>l)return!1}return!0}const Ymt=new rN,Pb=new Re,kI=new Re;class e8{constructor(e=new Re,n=-1){this.isSphere=!0,this.center=e,this.radius=n}set(e,n){return this.center.copy(e),this.radius=n,this}setFromPoints(e,n){const r=this.center;n!==void 0?r.copy(n):Ymt.setFromPoints(e).getCenter(r);let i=0;for(let s=0,a=e.length;s<a;s++)i=Math.max(i,r.distanceToSquared(e[s]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const n=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=n*n}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,n){const r=this.center.distanceToSquared(e);return n.copy(e),r>this.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Pb.subVectors(e,this.center);const n=Pb.lengthSq();if(n>this.radius*this.radius){const r=Math.sqrt(n),i=(r-this.radius)*.5;this.center.addScaledVector(Pb,i/r),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(kI.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Pb.copy(e.center).add(kI)),this.expandByPoint(Pb.copy(e.center).sub(kI))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Cu=new Re,EI=new Re,jj=new Re,nf=new Re,AI=new Re,Cj=new Re,TI=new Re;class Xmt{constructor(e=new Re,n=new Re(0,0,-1)){this.origin=e,this.direction=n}set(e,n){return this.origin.copy(e),this.direction.copy(n),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,n){return n.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Cu)),this}closestPointToPoint(e,n){n.subVectors(e,this.origin);const r=n.dot(this.direction);return r<0?n.copy(this.origin):n.copy(this.origin).addScaledVector(this.direction,r)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const n=Cu.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(Cu.copy(this.origin).addScaledVector(this.direction,n),Cu.distanceToSquared(e))}distanceSqToSegment(e,n,r,i){EI.copy(e).add(n).multiplyScalar(.5),jj.copy(n).sub(e).normalize(),nf.copy(this.origin).sub(EI);const s=e.distanceTo(n)*.5,a=-this.direction.dot(jj),l=nf.dot(this.direction),c=-nf.dot(jj),u=nf.lengthSq(),d=Math.abs(1-a*a);let f,h,p,m;if(d>0)if(f=a*c-l,h=a*l-c,m=s*d,f>=0)if(h>=-m)if(h<=m){const x=1/d;f*=x,h*=x,p=f*(f+a*h+2*l)+h*(a*f+h+2*c)+u}else h=s,f=Math.max(0,-(a*h+l)),p=-f*f+h*(h+2*c)+u;else h=-s,f=Math.max(0,-(a*h+l)),p=-f*f+h*(h+2*c)+u;else h<=-m?(f=Math.max(0,-(-a*s+l)),h=f>0?-s:Math.min(Math.max(-s,-c),s),p=-f*f+h*(h+2*c)+u):h<=m?(f=0,h=Math.min(Math.max(-s,-c),s),p=h*(h+2*c)+u):(f=Math.max(0,-(a*s+l)),h=f>0?s:Math.min(Math.max(-s,-c),s),p=-f*f+h*(h+2*c)+u);else h=a>0?-s:s,f=Math.max(0,-(a*h+l)),p=-f*f+h*(h+2*c)+u;return r&&r.copy(this.origin).addScaledVector(this.direction,f),i&&i.copy(EI).addScaledVector(jj,h),p}intersectSphere(e,n){Cu.subVectors(e.center,this.origin);const r=Cu.dot(this.direction),i=Cu.dot(Cu)-r*r,s=e.radius*e.radius;if(i>s)return null;const a=Math.sqrt(s-i),l=r-a,c=r+a;return c<0?null:l<0?this.at(c,n):this.at(l,n)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const n=e.normal.dot(this.direction);if(n===0)return e.distanceToPoint(this.origin)===0?0:null;const r=-(this.origin.dot(e.normal)+e.constant)/n;return r>=0?r:null}intersectPlane(e,n){const r=this.distanceToPlane(e);return r===null?null:this.at(r,n)}intersectsPlane(e){const n=e.distanceToPoint(this.origin);return n===0||e.normal.dot(this.direction)*n<0}intersectBox(e,n){let r,i,s,a,l,c;const u=1/this.direction.x,d=1/this.direction.y,f=1/this.direction.z,h=this.origin;return u>=0?(r=(e.min.x-h.x)*u,i=(e.max.x-h.x)*u):(r=(e.max.x-h.x)*u,i=(e.min.x-h.x)*u),d>=0?(s=(e.min.y-h.y)*d,a=(e.max.y-h.y)*d):(s=(e.max.y-h.y)*d,a=(e.min.y-h.y)*d),r>a||s>i||((s>r||isNaN(r))&&(r=s),(a<i||isNaN(i))&&(i=a),f>=0?(l=(e.min.z-h.z)*f,c=(e.max.z-h.z)*f):(l=(e.max.z-h.z)*f,c=(e.min.z-h.z)*f),r>c||l>i)||((l>r||r!==r)&&(r=l),(c<i||i!==i)&&(i=c),i<0)?null:this.at(r>=0?r:i,n)}intersectsBox(e){return this.intersectBox(e,Cu)!==null}intersectTriangle(e,n,r,i,s){AI.subVectors(n,e),Cj.subVectors(r,e),TI.crossVectors(AI,Cj);let a=this.direction.dot(TI),l;if(a>0){if(i)return null;l=1}else if(a<0)l=-1,a=-a;else return null;nf.subVectors(this.origin,e);const c=l*this.direction.dot(Cj.crossVectors(nf,Cj));if(c<0)return null;const u=l*this.direction.dot(AI.cross(nf));if(u<0||c+u>a)return null;const d=-l*nf.dot(TI);return d<0?null:this.at(d/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class es{constructor(e,n,r,i,s,a,l,c,u,d,f,h,p,m,x,y){es.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,n,r,i,s,a,l,c,u,d,f,h,p,m,x,y)}set(e,n,r,i,s,a,l,c,u,d,f,h,p,m,x,y){const g=this.elements;return g[0]=e,g[4]=n,g[8]=r,g[12]=i,g[1]=s,g[5]=a,g[9]=l,g[13]=c,g[2]=u,g[6]=d,g[10]=f,g[14]=h,g[3]=p,g[7]=m,g[11]=x,g[15]=y,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new es().fromArray(this.elements)}copy(e){const n=this.elements,r=e.elements;return n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],n[9]=r[9],n[10]=r[10],n[11]=r[11],n[12]=r[12],n[13]=r[13],n[14]=r[14],n[15]=r[15],this}copyPosition(e){const n=this.elements,r=e.elements;return n[12]=r[12],n[13]=r[13],n[14]=r[14],this}setFromMatrix3(e){const n=e.elements;return this.set(n[0],n[3],n[6],0,n[1],n[4],n[7],0,n[2],n[5],n[8],0,0,0,0,1),this}extractBasis(e,n,r){return e.setFromMatrixColumn(this,0),n.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this}makeBasis(e,n,r){return this.set(e.x,n.x,r.x,0,e.y,n.y,r.y,0,e.z,n.z,r.z,0,0,0,0,1),this}extractRotation(e){const n=this.elements,r=e.elements,i=1/fx.setFromMatrixColumn(e,0).length(),s=1/fx.setFromMatrixColumn(e,1).length(),a=1/fx.setFromMatrixColumn(e,2).length();return n[0]=r[0]*i,n[1]=r[1]*i,n[2]=r[2]*i,n[3]=0,n[4]=r[4]*s,n[5]=r[5]*s,n[6]=r[6]*s,n[7]=0,n[8]=r[8]*a,n[9]=r[9]*a,n[10]=r[10]*a,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromEuler(e){const n=this.elements,r=e.x,i=e.y,s=e.z,a=Math.cos(r),l=Math.sin(r),c=Math.cos(i),u=Math.sin(i),d=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){const h=a*d,p=a*f,m=l*d,x=l*f;n[0]=c*d,n[4]=-c*f,n[8]=u,n[1]=p+m*u,n[5]=h-x*u,n[9]=-l*c,n[2]=x-h*u,n[6]=m+p*u,n[10]=a*c}else if(e.order==="YXZ"){const h=c*d,p=c*f,m=u*d,x=u*f;n[0]=h+x*l,n[4]=m*l-p,n[8]=a*u,n[1]=a*f,n[5]=a*d,n[9]=-l,n[2]=p*l-m,n[6]=x+h*l,n[10]=a*c}else if(e.order==="ZXY"){const h=c*d,p=c*f,m=u*d,x=u*f;n[0]=h-x*l,n[4]=-a*f,n[8]=m+p*l,n[1]=p+m*l,n[5]=a*d,n[9]=x-h*l,n[2]=-a*u,n[6]=l,n[10]=a*c}else if(e.order==="ZYX"){const h=a*d,p=a*f,m=l*d,x=l*f;n[0]=c*d,n[4]=m*u-p,n[8]=h*u+x,n[1]=c*f,n[5]=x*u+h,n[9]=p*u-m,n[2]=-u,n[6]=l*c,n[10]=a*c}else if(e.order==="YZX"){const h=a*c,p=a*u,m=l*c,x=l*u;n[0]=c*d,n[4]=x-h*f,n[8]=m*f+p,n[1]=f,n[5]=a*d,n[9]=-l*d,n[2]=-u*d,n[6]=p*f+m,n[10]=h-x*f}else if(e.order==="XZY"){const h=a*c,p=a*u,m=l*c,x=l*u;n[0]=c*d,n[4]=-f,n[8]=u*d,n[1]=h*f+x,n[5]=a*d,n[9]=p*f-m,n[2]=m*f-p,n[6]=l*d,n[10]=x*f+h}return n[3]=0,n[7]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Qmt,e,Jmt)}lookAt(e,n,r){const i=this.elements;return eo.subVectors(e,n),eo.lengthSq()===0&&(eo.z=1),eo.normalize(),rf.crossVectors(r,eo),rf.lengthSq()===0&&(Math.abs(r.z)===1?eo.x+=1e-4:eo.z+=1e-4,eo.normalize(),rf.crossVectors(r,eo)),rf.normalize(),kj.crossVectors(eo,rf),i[0]=rf.x,i[4]=kj.x,i[8]=eo.x,i[1]=rf.y,i[5]=kj.y,i[9]=eo.y,i[2]=rf.z,i[6]=kj.z,i[10]=eo.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const r=e.elements,i=n.elements,s=this.elements,a=r[0],l=r[4],c=r[8],u=r[12],d=r[1],f=r[5],h=r[9],p=r[13],m=r[2],x=r[6],y=r[10],g=r[14],w=r[3],v=r[7],N=r[11],S=r[15],_=i[0],j=i[4],A=i[8],C=i[12],k=i[1],M=i[5],I=i[9],R=i[13],E=i[2],P=i[6],O=i[10],L=i[14],T=i[3],D=i[7],F=i[11],q=i[15];return s[0]=a*_+l*k+c*E+u*T,s[4]=a*j+l*M+c*P+u*D,s[8]=a*A+l*I+c*O+u*F,s[12]=a*C+l*R+c*L+u*q,s[1]=d*_+f*k+h*E+p*T,s[5]=d*j+f*M+h*P+p*D,s[9]=d*A+f*I+h*O+p*F,s[13]=d*C+f*R+h*L+p*q,s[2]=m*_+x*k+y*E+g*T,s[6]=m*j+x*M+y*P+g*D,s[10]=m*A+x*I+y*O+g*F,s[14]=m*C+x*R+y*L+g*q,s[3]=w*_+v*k+N*E+S*T,s[7]=w*j+v*M+N*P+S*D,s[11]=w*A+v*I+N*O+S*F,s[15]=w*C+v*R+N*L+S*q,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[4]*=e,n[8]*=e,n[12]*=e,n[1]*=e,n[5]*=e,n[9]*=e,n[13]*=e,n[2]*=e,n[6]*=e,n[10]*=e,n[14]*=e,n[3]*=e,n[7]*=e,n[11]*=e,n[15]*=e,this}determinant(){const e=this.elements,n=e[0],r=e[4],i=e[8],s=e[12],a=e[1],l=e[5],c=e[9],u=e[13],d=e[2],f=e[6],h=e[10],p=e[14],m=e[3],x=e[7],y=e[11],g=e[15];return m*(+s*c*f-i*u*f-s*l*h+r*u*h+i*l*p-r*c*p)+x*(+n*c*p-n*u*h+s*a*h-i*a*p+i*u*d-s*c*d)+y*(+n*u*f-n*l*p-s*a*f+r*a*p+s*l*d-r*u*d)+g*(-i*l*d-n*c*f+n*l*h+i*a*f-r*a*h+r*c*d)}transpose(){const e=this.elements;let n;return n=e[1],e[1]=e[4],e[4]=n,n=e[2],e[2]=e[8],e[8]=n,n=e[6],e[6]=e[9],e[9]=n,n=e[3],e[3]=e[12],e[12]=n,n=e[7],e[7]=e[13],e[13]=n,n=e[11],e[11]=e[14],e[14]=n,this}setPosition(e,n,r){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=n,i[14]=r),this}invert(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],a=e[4],l=e[5],c=e[6],u=e[7],d=e[8],f=e[9],h=e[10],p=e[11],m=e[12],x=e[13],y=e[14],g=e[15],w=f*y*u-x*h*u+x*c*p-l*y*p-f*c*g+l*h*g,v=m*h*u-d*y*u-m*c*p+a*y*p+d*c*g-a*h*g,N=d*x*u-m*f*u+m*l*p-a*x*p-d*l*g+a*f*g,S=m*f*c-d*x*c-m*l*h+a*x*h+d*l*y-a*f*y,_=n*w+r*v+i*N+s*S;if(_===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const j=1/_;return e[0]=w*j,e[1]=(x*h*s-f*y*s-x*i*p+r*y*p+f*i*g-r*h*g)*j,e[2]=(l*y*s-x*c*s+x*i*u-r*y*u-l*i*g+r*c*g)*j,e[3]=(f*c*s-l*h*s-f*i*u+r*h*u+l*i*p-r*c*p)*j,e[4]=v*j,e[5]=(d*y*s-m*h*s+m*i*p-n*y*p-d*i*g+n*h*g)*j,e[6]=(m*c*s-a*y*s-m*i*u+n*y*u+a*i*g-n*c*g)*j,e[7]=(a*h*s-d*c*s+d*i*u-n*h*u-a*i*p+n*c*p)*j,e[8]=N*j,e[9]=(m*f*s-d*x*s-m*r*p+n*x*p+d*r*g-n*f*g)*j,e[10]=(a*x*s-m*l*s+m*r*u-n*x*u-a*r*g+n*l*g)*j,e[11]=(d*l*s-a*f*s-d*r*u+n*f*u+a*r*p-n*l*p)*j,e[12]=S*j,e[13]=(d*x*i-m*f*i+m*r*h-n*x*h-d*r*y+n*f*y)*j,e[14]=(m*l*i-a*x*i-m*r*c+n*x*c+a*r*y-n*l*y)*j,e[15]=(a*f*i-d*l*i+d*r*c-n*f*c-a*r*h+n*l*h)*j,this}scale(e){const n=this.elements,r=e.x,i=e.y,s=e.z;return n[0]*=r,n[4]*=i,n[8]*=s,n[1]*=r,n[5]*=i,n[9]*=s,n[2]*=r,n[6]*=i,n[10]*=s,n[3]*=r,n[7]*=i,n[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,n=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(n,r,i))}makeTranslation(e,n,r){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,n,0,0,1,r,0,0,0,1),this}makeRotationX(e){const n=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,n,-r,0,0,r,n,0,0,0,0,1),this}makeRotationY(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,0,r,0,0,1,0,0,-r,0,n,0,0,0,0,1),this}makeRotationZ(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,-r,0,0,r,n,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,n){const r=Math.cos(n),i=Math.sin(n),s=1-r,a=e.x,l=e.y,c=e.z,u=s*a,d=s*l;return this.set(u*a+r,u*l-i*c,u*c+i*l,0,u*l+i*c,d*l+r,d*c-i*a,0,u*c-i*l,d*c+i*a,s*c*c+r,0,0,0,0,1),this}makeScale(e,n,r){return this.set(e,0,0,0,0,n,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,n,r,i,s,a){return this.set(1,r,s,0,e,1,a,0,n,i,1,0,0,0,0,1),this}compose(e,n,r){const i=this.elements,s=n._x,a=n._y,l=n._z,c=n._w,u=s+s,d=a+a,f=l+l,h=s*u,p=s*d,m=s*f,x=a*d,y=a*f,g=l*f,w=c*u,v=c*d,N=c*f,S=r.x,_=r.y,j=r.z;return i[0]=(1-(x+g))*S,i[1]=(p+N)*S,i[2]=(m-v)*S,i[3]=0,i[4]=(p-N)*_,i[5]=(1-(h+g))*_,i[6]=(y+w)*_,i[7]=0,i[8]=(m+v)*j,i[9]=(y-w)*j,i[10]=(1-(h+x))*j,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,n,r){const i=this.elements;let s=fx.set(i[0],i[1],i[2]).length();const a=fx.set(i[4],i[5],i[6]).length(),l=fx.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),e.x=i[12],e.y=i[13],e.z=i[14],Tl.copy(this);const u=1/s,d=1/a,f=1/l;return Tl.elements[0]*=u,Tl.elements[1]*=u,Tl.elements[2]*=u,Tl.elements[4]*=d,Tl.elements[5]*=d,Tl.elements[6]*=d,Tl.elements[8]*=f,Tl.elements[9]*=f,Tl.elements[10]*=f,n.setFromRotationMatrix(Tl),r.x=s,r.y=a,r.z=l,this}makePerspective(e,n,r,i,s,a,l=id){const c=this.elements,u=2*s/(n-e),d=2*s/(r-i),f=(n+e)/(n-e),h=(r+i)/(r-i);let p,m;if(l===id)p=-(a+s)/(a-s),m=-2*a*s/(a-s);else if(l===vE)p=-a/(a-s),m=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+l);return c[0]=u,c[4]=0,c[8]=f,c[12]=0,c[1]=0,c[5]=d,c[9]=h,c[13]=0,c[2]=0,c[6]=0,c[10]=p,c[14]=m,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,n,r,i,s,a,l=id){const c=this.elements,u=1/(n-e),d=1/(r-i),f=1/(a-s),h=(n+e)*u,p=(r+i)*d;let m,x;if(l===id)m=(a+s)*f,x=-2*f;else if(l===vE)m=s*f,x=-1*f;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+l);return c[0]=2*u,c[4]=0,c[8]=0,c[12]=-h,c[1]=0,c[5]=2*d,c[9]=0,c[13]=-p,c[2]=0,c[6]=0,c[10]=x,c[14]=-m,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const n=this.elements,r=e.elements;for(let i=0;i<16;i++)if(n[i]!==r[i])return!1;return!0}fromArray(e,n=0){for(let r=0;r<16;r++)this.elements[r]=e[r+n];return this}toArray(e=[],n=0){const r=this.elements;return e[n]=r[0],e[n+1]=r[1],e[n+2]=r[2],e[n+3]=r[3],e[n+4]=r[4],e[n+5]=r[5],e[n+6]=r[6],e[n+7]=r[7],e[n+8]=r[8],e[n+9]=r[9],e[n+10]=r[10],e[n+11]=r[11],e[n+12]=r[12],e[n+13]=r[13],e[n+14]=r[14],e[n+15]=r[15],e}}const fx=new Re,Tl=new es,Qmt=new Re(0,0,0),Jmt=new Re(1,1,1),rf=new Re,kj=new Re,eo=new Re,lX=new es,cX=new nN;class Md{constructor(e=0,n=0,r=0,i=Md.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=n,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,n,r,i=this._order){return this._x=e,this._y=n,this._z=r,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,n=this._order,r=!0){const i=e.elements,s=i[0],a=i[4],l=i[8],c=i[1],u=i[5],d=i[9],f=i[2],h=i[6],p=i[10];switch(n){case"XYZ":this._y=Math.asin(La(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-d,p),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(h,u),this._z=0);break;case"YXZ":this._x=Math.asin(-La(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(l,p),this._z=Math.atan2(c,u)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(La(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-f,p),this._z=Math.atan2(-a,u)):(this._y=0,this._z=Math.atan2(c,s));break;case"ZYX":this._y=Math.asin(-La(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(h,p),this._z=Math.atan2(c,s)):(this._x=0,this._z=Math.atan2(-a,u));break;case"YZX":this._z=Math.asin(La(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-d,u),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(l,p));break;case"XZY":this._z=Math.asin(-La(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(h,u),this._y=Math.atan2(l,s)):(this._x=Math.atan2(-d,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,r===!0&&this._onChangeCallback(),this}setFromQuaternion(e,n,r){return lX.makeRotationFromQuaternion(e),this.setFromRotationMatrix(lX,n,r)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return cX.setFromEuler(this),this.setFromQuaternion(cX,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Md.DEFAULT_ORDER="XYZ";class Ope{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let Zmt=0;const uX=new Re,hx=new nN,ku=new es,Ej=new Re,Ob=new Re,egt=new Re,tgt=new nN,dX=new Re(1,0,0),fX=new Re(0,1,0),hX=new Re(0,0,1),pX={type:"added"},ngt={type:"removed"},px={type:"childadded",child:null},MI={type:"childremoved",child:null};class Co extends q0{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Zmt++}),this.uuid=tN(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Co.DEFAULT_UP.clone();const e=new Re,n=new Md,r=new nN,i=new Re(1,1,1);function s(){r.setFromEuler(n,!1)}function a(){n.setFromQuaternion(r,void 0,!1)}n._onChange(s),r._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:n},quaternion:{configurable:!0,enumerable:!0,value:r},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new es},normalMatrix:{value:new wn}}),this.matrix=new es,this.matrixWorld=new es,this.matrixAutoUpdate=Co.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Co.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Ope,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,n){this.quaternion.setFromAxisAngle(e,n)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}
vendor: 4,292 bytes, line 874
874setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,n){return hx.setFromAxisAngle(e,n),this.quaternion.multiply(hx),this}rotateOnWorldAxis(e,n){return hx.setFromAxisAngle(e,n),this.quaternion.premultiply(hx),this}rotateX(e){return this.rotateOnAxis(dX,e)}rotateY(e){return this.rotateOnAxis(fX,e)}rotateZ(e){return this.rotateOnAxis(hX,e)}translateOnAxis(e,n){return uX.copy(e).applyQuaternion(this.quaternion),this.position.add(uX.multiplyScalar(n)),this}translateX(e){return this.translateOnAxis(dX,e)}translateY(e){return this.translateOnAxis(fX,e)}translateZ(e){return this.translateOnAxis(hX,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(ku.copy(this.matrixWorld).invert())}lookAt(e,n,r){e.isVector3?Ej.copy(e):Ej.set(e,n,r);const i=this.parent;this.updateWorldMatrix(!0,!1),Ob.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?ku.lookAt(Ob,Ej,this.up):ku.lookAt(Ej,Ob,this.up),this.quaternion.setFromRotationMatrix(ku),i&&(ku.extractRotation(i.matrixWorld),hx.setFromRotationMatrix(ku),this.quaternion.premultiply(hx.invert()))}add(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.add(arguments[n]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(pX),px.child=e,this.dispatchEvent(px),px.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let r=0;r<arguments.length;r++)this.remove(arguments[r]);return this}const n=this.children.indexOf(e);return n!==-1&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(ngt),MI.child=e,this.dispatchEvent(MI),MI.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),ku.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),ku.multiply(e.parent.matrixWorld)),e.applyMatrix4(ku),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(pX),px.child=e,this.dispatchEvent(px),px.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,n){if(this[e]===n)return this;for(let r=0,i=this.children.length;r<i;r++){const a=this.children[r].getObjectByProperty(e,n);if(a!==void 0)return a}}getObjectsByProperty(e,n,r=[]){this[e]===n&&r.push(this);const i=this.children;for(let s=0,a=i.length;s<a;s++)i[s].getObjectsByProperty(e,n,r);return r}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ob,e,egt),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ob,tgt,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const n=this.matrixWorld.elements;return e.set(n[8],n[9],n[10]).normalize()}raycast(){}traverse(e){e(this);const n=this.children;for(let r=0,i=n.length;r<i;r++)n[r].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const n=this.children;for(let r=0,i=n.length;r<i;r++)n[r].traverseVisible(e)}traverseAncestors(e){const n=this.parent;n!==null&&(e(n),n.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const n=this.children;for(let r=0,i=n.length;r<i;r++)n[r].updateMatrixWorld(e)}updateWorldMatrix(e,n){const r=this.parent;if(e===!0&&r!==null&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix
vendor: 5,226 bytes, line 874
874):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),n===!0){const i=this.children;for(let s=0,a=i.length;s<a;s++)i[s].updateWorldMatrix(!1,!0)}}toJSON(e){const n=e===void 0||typeof e=="string",r={};n&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},r.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map(l=>({boxInitialized:l.boxInitialized,boxMin:l.box.min.toArray(),boxMax:l.box.max.toArray(),sphereInitialized:l.sphereInitialized,sphereRadius:l.sphere.radius,sphereCenter:l.sphere.center.toArray()})),i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),this.boundingBox!==null&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()}));function s(l,c){return l[c.uuid]===void 0&&(l[c.uuid]=c.toJSON(e)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const l=this.geometry.parameters;if(l!==void 0&&l.shapes!==void 0){const c=l.shapes;if(Array.isArray(c))for(let u=0,d=c.length;u<d;u++){const f=c[u];s(e.shapes,f)}else s(e.shapes,c)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const l=[];for(let c=0,u=this.material.length;c<u;c++)l.push(s(e.materials,this.material[c]));i.material=l}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let l=0;l<this.children.length;l++)i.children.push(this.children[l].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let l=0;l<this.animations.length;l++){const c=this.animations[l];i.animations.push(s(e.animations,c))}}if(n){const l=a(e.geometries),c=a(e.materials),u=a(e.textures),d=a(e.images),f=a(e.shapes),h=a(e.skeletons),p=a(e.animations),m=a(e.nodes);l.length>0&&(r.geometries=l),c.length>0&&(r.materials=c),u.length>0&&(r.textures=u),d.length>0&&(r.images=d),f.length>0&&(r.shapes=f),h.length>0&&(r.skeletons=h),p.length>0&&(r.animations=p),m.length>0&&(r.nodes=m)}return r.object=i,r;function a(l){const c=[];for(const u in l){const d=l[u];delete d.metadata,c.push(d)}return c}}clone(e){return new this.constructor().copy(this,e)}copy(e,n=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),n===!0)for(let r=0;r<e.children.length;r++){const i=e.children[r];this.add(i.clone())}return this}}Co.DEFAULT_UP=new Re(0,1,0);Co.DEFAULT_MATRIX_AUTO_UPDATE=!0;Co.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Ml=new Re,Eu=new Re,PI=new Re,Au=new Re,mx=new Re,gx=new Re,mX=new Re,OI=new Re,RI=new Re,II=new Re;class Uc{constructor(e=new Re,n=new Re,r=new Re){this.a=e,this.b=n,this.c=r}static getNormal(e,n,r,i){i.subVectors(r,n),Ml.subVectors(e,n),i.cross(Ml);const s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,n,r,i,s){Ml.subVectors(i,n),Eu.subVectors(r,n),PI.subVectors(e,n);
vendor: 8,284 bytes, line 874
874const a=Ml.dot(Ml),l=Ml.dot(Eu),c=Ml.dot(PI),u=Eu.dot(Eu),d=Eu.dot(PI),f=a*u-l*l;if(f===0)return s.set(0,0,0),null;const h=1/f,p=(u*c-l*d)*h,m=(a*d-l*c)*h;return s.set(1-p-m,m,p)}static containsPoint(e,n,r,i){return this.getBarycoord(e,n,r,i,Au)===null?!1:Au.x>=0&&Au.y>=0&&Au.x+Au.y<=1}static getInterpolation(e,n,r,i,s,a,l,c){return this.getBarycoord(e,n,r,i,Au)===null?(c.x=0,c.y=0,"z"in c&&(c.z=0),"w"in c&&(c.w=0),null):(c.setScalar(0),c.addScaledVector(s,Au.x),c.addScaledVector(a,Au.y),c.addScaledVector(l,Au.z),c)}static isFrontFacing(e,n,r,i){return Ml.subVectors(r,n),Eu.subVectors(e,n),Ml.cross(Eu).dot(i)<0}set(e,n,r){return this.a.copy(e),this.b.copy(n),this.c.copy(r),this}setFromPointsAndIndices(e,n,r,i){return this.a.copy(e[n]),this.b.copy(e[r]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,n,r,i){return this.a.fromBufferAttribute(e,n),this.b.fromBufferAttribute(e,r),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Ml.subVectors(this.c,this.b),Eu.subVectors(this.a,this.b),Ml.cross(Eu).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Uc.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return Uc.getBarycoord(e,this.a,this.b,this.c,n)}getInterpolation(e,n,r,i,s){return Uc.getInterpolation(e,this.a,this.b,this.c,n,r,i,s)}containsPoint(e){return Uc.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Uc.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,n){const r=this.a,i=this.b,s=this.c;let a,l;mx.subVectors(i,r),gx.subVectors(s,r),OI.subVectors(e,r);const c=mx.dot(OI),u=gx.dot(OI);if(c<=0&&u<=0)return n.copy(r);RI.subVectors(e,i);const d=mx.dot(RI),f=gx.dot(RI);if(d>=0&&f<=d)return n.copy(i);const h=c*f-d*u;if(h<=0&&c>=0&&d<=0)return a=c/(c-d),n.copy(r).addScaledVector(mx,a);II.subVectors(e,s);const p=mx.dot(II),m=gx.dot(II);if(m>=0&&p<=m)return n.copy(s);const x=p*u-c*m;if(x<=0&&u>=0&&m<=0)return l=u/(u-m),n.copy(r).addScaledVector(gx,l);const y=d*m-p*f;if(y<=0&&f-d>=0&&p-m>=0)return mX.subVectors(s,i),l=(f-d)/(f-d+(p-m)),n.copy(i).addScaledVector(mX,l);const g=1/(y+x+h);return a=x*g,l=h*g,n.copy(r).addScaledVector(mx,a).addScaledVector(gx,l)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const Rpe={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},sf={h:0,s:0,l:0},Aj={h:0,s:0,l:0};function DI(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*6*(2/3-n):t}class cr{constructor(e,n,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,n,r)}set(e,n,r){if(n===void 0&&r===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,n,r);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,n=Mc){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Xn.toWorkingColorSpace(this,n),this}setRGB(e,n,r,i=Xn.workingColorSpace){return this.r=e,this.g=n,this.b=r,Xn.toWorkingColorSpace(this,i),this}setHSL(e,n,r,i=Xn.workingColorSpace){if(e=Umt(e,1),n=La(n,0,1),r=La(r,0,1),n===0)this.r=this.g=this.b=r;else{const s=r<=.5?r*(1+n):r+n-r*n,a=2*r-s;this.r=DI(a,s,e+1/3),this.g=DI(a,s,e),this.b=DI(a,s,e-1/3)}return Xn.toWorkingColorSpace(this,i),this}setStyle(e,n=Mc){function r(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=i[1],l=i[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return r(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,n);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return r(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,n);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return r(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,n);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,n);if(a===6)return this.setHex(parseInt(s,16),n);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=Mc){const r=Rpe[e.toLowerCase()];return r!==void 0?this.setHex(r,n):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Ry(e.r),this.g=Ry(e.g),this.b=Ry(e.b),this}copyLinearToSRGB(e){return this.r=SI(e.r),this.g=SI(e.g),this.b=SI(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Mc){return Xn.fromWorkingColorSpace(Bs.copy(this),e),Math.round(La(Bs.r*255,0,255))*65536+Math.round(La(Bs.g*255,0,255))*256+Math.round(La(Bs.b*255,0,255))}getHexString(e=Mc){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=Xn.workingColorSpace){Xn.fromWorkingColorSpace(Bs.copy(this),n);
vendor: 12,639 bytes, line 874
874const r=Bs.r,i=Bs.g,s=Bs.b,a=Math.max(r,i,s),l=Math.min(r,i,s);let c,u;const d=(l+a)/2;if(l===a)c=0,u=0;else{const f=a-l;switch(u=d<=.5?f/(a+l):f/(2-a-l),a){case r:c=(i-s)/f+(i<s?6:0);break;case i:c=(s-r)/f+2;break;case s:c=(r-i)/f+4;break}c/=6}return e.h=c,e.s=u,e.l=d,e}getRGB(e,n=Xn.workingColorSpace){return Xn.fromWorkingColorSpace(Bs.copy(this),n),e.r=Bs.r,e.g=Bs.g,e.b=Bs.b,e}getStyle(e=Mc){Xn.fromWorkingColorSpace(Bs.copy(this),e);const n=Bs.r,r=Bs.g,i=Bs.b;return e!==Mc?`color(${e} ${n.toFixed(3)} ${r.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(n*255)},${Math.round(r*255)},${Math.round(i*255)})`}offsetHSL(e,n,r){return this.getHSL(sf),this.setHSL(sf.h+e,sf.s+n,sf.l+r)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,n){return this.r=e.r+n.r,this.g=e.g+n.g,this.b=e.b+n.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,n){return this.r+=(e.r-this.r)*n,this.g+=(e.g-this.g)*n,this.b+=(e.b-this.b)*n,this}lerpColors(e,n,r){return this.r=e.r+(n.r-e.r)*r,this.g=e.g+(n.g-e.g)*r,this.b=e.b+(n.b-e.b)*r,this}lerpHSL(e,n){this.getHSL(sf),e.getHSL(Aj);const r=wI(sf.h,Aj.h,n),i=wI(sf.s,Aj.s,n),s=wI(sf.l,Aj.l,n);return this.setHSL(r,i,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const n=this.r,r=this.g,i=this.b,s=e.elements;return this.r=s[0]*n+s[3]*r+s[6]*i,this.g=s[1]*n+s[4]*r+s[7]*i,this.b=s[2]*n+s[5]*r+s[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,n=0){return this.r=e[n],this.g=e[n+1],this.b=e[n+2],this}toArray(e=[],n=0){return e[n]=this.r,e[n+1]=this.g,e[n+2]=this.b,e}fromBufferAttribute(e,n){return this.r=e.getX(n),this.g=e.getY(n),this.b=e.getZ(n),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Bs=new cr;cr.NAMES=Rpe;let rgt=0;class ZM extends q0{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:rgt++}),this.uuid=tN(),this.name="",this.type="Material",this.blending=Py,this.side=$h,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=G$,this.blendDst=q$,this.blendEquation=Bp,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new cr(0,0,0),this.blendAlpha=0,this.depthFunc=mE,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=tX,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=ox,this.stencilZFail=ox,this.stencilZPass=ox,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const n in e){const r=e[n];if(r===void 0){console.warn(`THREE.Material: parameter '${n}' has value of undefined.`);continue}const i=this[n];if(i===void 0){console.warn(`THREE.Material: '${n}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(r):i&&i.isVector3&&r&&r.isVector3?i.copy(r):this[n]=r}}toJSON(e){const n=e===void 0||typeof e=="string";n&&(e={textures:{},images:{}});const r={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),this.roughness!==void 0&&(r.roughness=this.roughness),this.metalness!==void 0&&(r.metalness=this.metalness),this.sheen!==void 0&&(r.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(r.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(r.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(r.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(r.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(r.shininess=this.shininess),this.clearcoat!==void 0&&(r.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(r.dispersion=this.dispersion),this.iridescence!==void 0&&(r.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(r.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(r.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(r.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(r.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(r.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(r.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(r.combine=this.combine)),this.envMapRotation!==void 0&&(r.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(r.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(r.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(r.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(r.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(r.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(r.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(r.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(r.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(r.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(r.size=this.size),this.shadowSide!==null&&(r.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==Py&&(r.blending=this.blending),this.side!==$h&&(r.side=this.side),this.vertexColors===!0&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=!0),this.blendSrc!==G$&&(r.blendSrc=this.blendSrc),this.blendDst!==q$&&(r.blendDst=this.blendDst),this.blendEquation!==Bp&&(r.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(r.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(r.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(r.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(r.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(r.blendAlpha=this.blendAlpha),this.depthFunc!==mE&&(r.depthFunc=this.depthFunc),this.depthTest===!1&&(r.depthTest=this.depthTest),this.depthWrite===!1&&(r.depthWrite=this.depthWrite),this.colorWrite===!1&&(r.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(r.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==tX&&(r.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(r.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(r.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==ox&&(r.stencilFail=this.stencilFail),this.stencilZFail!==ox&&(r.stencilZFail=this.stencilZFail),this.stencilZPass!==ox&&(r.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(r.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(r.rotation=this.rotation),this.polygonOffset===!0&&(r.polygonOffset=!0),this.polygonOffsetFactor!==0&&(r.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(r.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(r.linewidth=this.linewidth),this.dashSize!==void 0&&(r.dashSize=this.dashSize),this.gapSize!==void 0&&(r.gapSize=this.gapSize),this.scale!==void 0&&(r.scale=this.scale),this.dithering===!0&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),this.alphaHash===!0&&(r.alphaHash=!0),this.alphaToCoverage===!0&&(r.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=!0),this.forceSinglePass===!0&&(r.forceSinglePass=!0),this.wireframe===!0&&(r.wireframe=!0),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(r.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(r.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(r.flatShading=!0),this.visible===!1&&(r.visible=!1),this.toneMapped===!1&&(r.toneMapped=!1),this.fog===!1&&(r.fog=!1),Object.keys(this.userData).length>0&&(r.userData=this.userData);function i(s){const a=[];for(const l in s){const c=s[l];delete c.metadata,a.push(c)}return a}if(n){const s=i(e.textures),a=i(e.images);s.length>0&&(r.textures=s),a.length>0&&(r.images=a)}return r}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const n=e.clippingPlanes;let r=null;if(n!==null){const i=n.length;r=new Array(i);for(let s=0;s!==i;++s)r[s]=n[s].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipSh
vendor: 36,621 bytes, lines 874-913
874adows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}onBeforeRender(){console.warn("Material: onBeforeRender() has been removed.")}}class Ipe extends ZM{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new cr(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Md,this.combine=xpe,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const wi=new Re,Tj=new Mn;class Zc{constructor(e,n,r=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=n,this.count=e!==void 0?e.length/n:0,this.normalized=r,this.usage=nX,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=rd,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return qw("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,n,r){e*=this.itemSize,r*=n.itemSize;for(let i=0,s=this.itemSize;i<s;i++)this.array[e+i]=n.array[r+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let n=0,r=this.count;n<r;n++)Tj.fromBufferAttribute(this,n),Tj.applyMatrix3(e),this.setXY(n,Tj.x,Tj.y);else if(this.itemSize===3)for(let n=0,r=this.count;n<r;n++)wi.fromBufferAttribute(this,n),wi.applyMatrix3(e),this.setXYZ(n,wi.x,wi.y,wi.z);return this}applyMatrix4(e){for(let n=0,r=this.count;n<r;n++)wi.fromBufferAttribute(this,n),wi.applyMatrix4(e),this.setXYZ(n,wi.x,wi.y,wi.z);return this}applyNormalMatrix(e){for(let n=0,r=this.count;n<r;n++)wi.fromBufferAttribute(this,n),wi.applyNormalMatrix(e),this.setXYZ(n,wi.x,wi.y,wi.z);return this}transformDirection(e){for(let n=0,r=this.count;n<r;n++)wi.fromBufferAttribute(this,n),wi.transformDirection(e),this.setXYZ(n,wi.x,wi.y,wi.z);return this}set(e,n=0){return this.array.set(e,n),this}getComponent(e,n){let r=this.array[e*this.itemSize+n];return this.normalized&&(r=Ab(r,this.array)),r}setComponent(e,n,r){return this.normalized&&(r=Aa(r,this.array)),this.array[e*this.itemSize+n]=r,this}getX(e){let n=this.array[e*this.itemSize];return this.normalized&&(n=Ab(n,this.array)),n}setX(e,n){return this.normalized&&(n=Aa(n,this.array)),this.array[e*this.itemSize]=n,this}getY(e){let n=this.array[e*this.itemSize+1];return this.normalized&&(n=Ab(n,this.array)),n}setY(e,n){return this.normalized&&(n=Aa(n,this.array)),this.array[e*this.itemSize+1]=n,this}getZ(e){let n=this.array[e*this.itemSize+2];return this.normalized&&(n=Ab(n,this.array)),n}setZ(e,n){return this.normalized&&(n=Aa(n,this.array)),this.array[e*this.itemSize+2]=n,this}getW(e){let n=this.array[e*this.itemSize+3];return this.normalized&&(n=Ab(n,this.array)),n}setW(e,n){return this.normalized&&(n=Aa(n,this.array)),this.array[e*this.itemSize+3]=n,this}setXY(e,n,r){return e*=this.itemSize,this.normalized&&(n=Aa(n,this.array),r=Aa(r,this.array)),this.array[e+0]=n,this.array[e+1]=r,this}setXYZ(e,n,r,i){return e*=this.itemSize,this.normalized&&(n=Aa(n,this.array),r=Aa(r,this.array),i=Aa(i,this.array)),this.array[e+0]=n,this.array[e+1]=r,this.array[e+2]=i,this}setXYZW(e,n,r,i,s){return e*=this.itemSize,this.normalized&&(n=Aa(n,this.array),r=Aa(r,this.array),i=Aa(i,this.array),s=Aa(s,this.array)),this.array[e+0]=n,this.array[e+1]=r,this.array[e+2]=i,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==nX&&(e.usage=this.usage),e}}class Dpe extends Zc{constructor(e,n,r){super(new Uint16Array(e),n,r)}}class Lpe extends Zc{constructor(e,n,r){super(new Uint32Array(e),n,r)}}class Cm extends Zc{constructor(e,n,r){super(new Float32Array(e),n,r)}}let igt=0;const Vo=new es,LI=new Co,xx=new Re,to=new rN,Rb=new rN,ls=new Re;class Rg extends q0{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:igt++}),this.uuid=tN(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Tpe(e)?Lpe:Dpe)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,n){return this.attributes[e]=n,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,n,r=0){this.groups.push({start:e,count:n,materialIndex:r})}clearGroups(){this.groups=[]}setDrawRange(e,n){this.drawRange.start=e,this.drawRange.count=n}applyMatrix4(e){const n=this.attributes.position;n!==void 0&&(n.applyMatrix4(e),n.needsUpdate=!0);const r=this.attributes.normal;if(r!==void 0){const s=new wn().getNormalMatrix(e);r.applyNormalMatrix(s),r.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Vo.makeRotationFromQuaternion(e),this.applyMatrix4(Vo),this}rotateX(e){return Vo.makeRotationX(e),this.applyMatrix4(Vo),this}rotateY(e){return Vo.makeRotationY(e),this.applyMatrix4(Vo),this}rotateZ(e){return Vo.makeRotationZ(e),this.applyMatrix4(Vo),this}translate(e,n,r){return Vo.makeTranslation(e,n,r),this.applyMatrix4(Vo),this}scale(e,n,r){return Vo.makeScale(e,n,r),this.applyMatrix4(Vo),this}lookAt(e){return LI.lookAt(e),LI.updateMatrix(),this.applyMatrix4(LI.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(xx).negate(),this.translate(xx.x,xx.y,xx.z),this}setFromPoints(e){const n=[];for(let r=0,i=e.length;r<i;r++){const s=e[r];n.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new Cm(n,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new rN);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new Re(-1/0,-1/0,-1/0),new Re(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),n)for(let r=0,i=n.length;r<i;r++){const s=n[r];to.setFromBufferAttribute(s),this.morphTargetsRelative?(ls.addVectors(this.boundingBox.min,to.min),this.boundingBox.expandByPoint(ls),ls.addVectors(this.boundingBox.max,to.max),this.boundingBox.expandByPoint(ls)):(this.boundingBox.expandByPoint(to.min),this.boundingBox.expandByPoint(to.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new e8);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new Re,1/0);return}if(e){const r=this.boundingSphere.center;if(to.setFromBufferAttribute(e),n)for(let s=0,a=n.length;s<a;s++){const l=n[s];Rb.setFromBufferAttribute(l),this.morphTargetsRelative?(ls.addVectors(to.min,Rb.min),to.expandByPoint(ls),ls.addVectors(to.max,Rb.max),to.expandByPoint(ls)):(to.expandByPoint(Rb.min),to.expandByPoint(Rb.max))}to.getCenter(r);let i=0;for(let s=0,a=e.count;s<a;s++)ls.fromBufferAttribute(e,s),i=Math.max(i,r.distanceToSquared(ls));if(n)for(let s=0,a=n.length;s<a;s++){const l=n[s],c=this.morphTargetsRelative;for(let u=0,d=l.count;u<d;u++)ls.fromBufferAttribute(l,u),c&&(xx.fromBufferAttribute(e,u),ls.add(xx)),i=Math.max(i,r.distanceToSquared(ls))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,n=this.attributes;if(e===null||n.position===void 0||n.normal===void 0||n.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const r=n.position,i=n.normal,s=n.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Zc(new Float32Array(4*r.count),4));const a=this.getAttribute("tangent"),l=[],c=[];for(let A=0;A<r.count;A++)l[A]=new Re,c[A]=new Re;const u=new Re,d=new Re,f=new Re,h=new Mn,p=new Mn,m=new Mn,x=new Re,y=new Re;function g(A,C,k){u.fromBufferAttribute(r,A),d.fromBufferAttribute(r,C),f.fromBufferAttribute(r,k),h.fromBufferAttribute(s,A),p.fromBufferAttribute(s,C),m.fromBufferAttribute(s,k),d.sub(u),f.sub(u),p.sub(h),m.sub(h);const M=1/(p.x*m.y-m.x*p.y);isFinite(M)&&(x.copy(d).multiplyScalar(m.y).addScaledVector(f,-p.y).multiplyScalar(M),y.copy(f).multiplyScalar(p.x).addScaledVector(d,-m.x).multiplyScalar(M),l[A].add(x),l[C].add(x),l[k].add(x),c[A].add(y),c[C].add(y),c[k].add(y))}let w=this.groups;w.length===0&&(w=[{start:0,count:e.count}]);for(let A=0,C=w.length;A<C;++A){const k=w[A],M=k.start,I=k.count;for(let R=M,E=M+I;R<E;R+=3)g(e.getX(R+0),e.getX(R+1),e.getX(R+2))}const v=new Re,N=new Re,S=new Re,_=new Re;function j(A){S.fromBufferAttribute(i,A),_.copy(S);const C=l[A];v.copy(C),v.sub(S.multiplyScalar(S.dot(C))).normalize(),N.crossVectors(_,C);const M=N.dot(c[A])<0?-1:1;a.setXYZW(A,v.x,v.y,v.z,M)}for(let A=0,C=w.length;A<C;++A){const k=w[A],M=k.start,I=k.count;for(let R=M,E=M+I;R<E;R+=3)j(e.getX(R+0)),j(e.getX(R+1)),j(e.getX(R+2))}}computeVertexNormals(){const e=this.index,n=this.getAttribute("position");if(n!==void 0){let r=this.getAttribute("normal");if(r===void 0)r=new Zc(new Float32Array(n.count*3),3),this.setAttribute("normal",r);else for(let h=0,p=r.count;h<p;h++)r.setXYZ(h,0,0,0);const i=new Re,s=new Re,a=new Re,l=new Re,c=new Re,u=new Re,d=new Re,f=new Re;if(e)for(let h=0,p=e.count;h<p;h+=3){const m=e.getX(h+0),x=e.getX(h+1),y=e.getX(h+2);i.fromBufferAttribute(n,m),s.fromBufferAttribute(n,x),a.fromBufferAttribute(n,y),d.subVectors(a,s),f.subVectors(i,s),d.cross(f),l.fromBufferAttribute(r,m),c.fromBufferAttribute(r,x),u.fromBufferAttribute(r,y),l.add(d),c.add(d),u.add(d),r.setXYZ(m,l.x,l.y,l.z),r.setXYZ(x,c.x,c.y,c.z),r.setXYZ(y,u.x,u.y,u.z)}else for(let h=0,p=n.count;h<p;h+=3)i.fromBufferAttribute(n,h+0),s.fromBufferAttribute(n,h+1),a.fromBufferAttribute(n,h+2),d.subVectors(a,s),f.subVectors(i,s),d.cross(f),r.setXYZ(h+0,d.x,d.y,d.z),r.setXYZ(h+1,d.x,d.y,d.z),r.setXYZ(h+2,d.x,d.y,d.z);this.normalizeNormals(),r.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let n=0,r=e.count;n<r;n++)ls.fromBufferAttribute(e,n),ls.normalize(),e.setXYZ(n,ls.x,ls.y,ls.z)}toNonIndexed(){function e(l,c){const u=l.array,d=l.itemSize,f=l.normalized,h=new u.constructor(c.length*d);let p=0,m=0;for(let x=0,y=c.length;x<y;x++){l.isInterleavedBufferAttribute?p=c[x]*l.data.stride+l.offset:p=c[x]*d;for(let g=0;g<d;g++)h[m++]=u[p++]}return new Zc(h,d,f)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const n=new Rg,r=this.index.array,i=this.attributes;for(const l in i){const c=i[l],u=e(c,r);n.setAttribute(l,u)}const s=this.morphAttributes;for(const l in s){const c=[],u=s[l];for(let d=0,f=u.length;d<f;d++){const h=u[d],p=e(h,r);c.push(p)}n.morphAttributes[l]=c}n.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let l=0,c=a.length;l<c;l++){const u=a[l];n.addGroup(u.start,u.count,u.materialIndex)}return n}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const c=this.parameters;for(const u in c)c[u]!==void 0&&(e[u]=c[u]);return e}e.data={attributes:{}};const n=this.index;n!==null&&(e.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});const r=this.attributes;for(const c in r){const u=r[c];e.data.attributes[c]=u.toJSON(e.data)}const i={};let s=!1;for(const c in this.morphAttributes){const u=this.morphAttributes[c],d=[];for(let f=0,h=u.length;f<h;f++){const p=u[f];d.push(p.toJSON(e.data))}d.length>0&&(i[c]=d,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const l=this.boundingSphere;return l!==null&&(e.data.boundingSphere={center:l.center.toArray(),radius:l.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const n={};this.name=e.name;const r=e.index;r!==null&&this.setIndex(r.clone(n));const i=e.attributes;for(const u in i){const d=i[u];this.setAttribute(u,d.clone(n))}const s=e.morphAttributes;for(const u in s){const d=[],f=s[u];for(let h=0,p=f.length;h<p;h++)d.push(f[h].clone(n));this.morphAttributes[u]=d}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let u=0,d=a.length;u<d;u++){const f=a[u];this.addGroup(f.start,f.count,f.materialIndex)}const l=e.boundingBox;l!==null&&(this.boundingBox=l.clone());const c=e.boundingSphere;return c!==null&&(this.boundingSphere=c.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const gX=new es,vp=new Xmt,Mj=new e8,xX=new Re,yx=new Re,vx=new Re,bx=new Re,$I=new Re,Pj=new Re,Oj=new Mn,Rj=new Mn,Ij=new Mn,yX=new Re,vX=new Re,bX=new Re,Dj=new Re,Lj=new Re;class Hc extends Co{constructor(e=new Rg,n=new Ipe){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=n,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const n=this.geometry.morphAttributes,r=Object.keys(n);if(r.length>0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const l=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=s}}}}getVertexPosition(e,n){const r=this.geometry,i=r.attributes.position,s=r.morphAttributes.position,a=r.morphTargetsRelative;n.fromBufferAttribute(i,e);const l=this.morphTargetInfluences;if(s&&l){Pj.set(0,0,0);for(let c=0,u=s.length;c<u;c++){const d=l[c],f=s[c];d!==0&&($I.fromBufferAttribute(f,e),a?Pj.addScaledVector($I,d):Pj.addScaledVector($I.sub(n),d))}n.add(Pj)}return n}raycast(e,n){const r=this.geometry,i=this.material,s=this.matrixWorld;i!==void 0&&(r.boundingSphere===null&&r.computeBoundingSphere(),Mj.copy(r.boundingSphere),Mj.applyMatrix4(s),vp.copy(e.ray).recast(e.near),!(Mj.containsPoint(vp.origin)===!1&&(vp.intersectSphere(Mj,xX)===null||vp.origin.distanceToSquared(xX)>(e.far-e.near)**2))&&(gX.copy(s).invert(),vp.copy(e.ray).applyMatrix4(gX),!(r.boundingBox!==null&&vp.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(e,n,vp)))}_computeIntersections(e,n,r){let i;const s=this.geometry,a=this.material,l=s.index,c=s.attributes.position,u=s.attributes.uv,d=s.attributes.uv1,f=s.attributes.normal,h=s.groups,p=s.drawRange;if(l!==null)if(Array.isArray(a))for(let m=0,x=h.length;m<x;m++){const y=h[m],g=a[y.materialIndex],w=Math.max(y.start,p.start),v=Math.min(l.count,Math.min(y.start+y.count,p.start+p.count));for(let N=w,S=v;N<S;N+=3){const _=l.getX(N),j=l.getX(N+1),A=l.getX(N+2);i=$j(this,g,e,r,u,d,f,_,j,A),i&&(i.faceIndex=Math.floor(N/3),i.face.materialIndex=y.materialIndex,n.push(i))}}else{const m=Math.max(0,p.start),x=Math.min(l.count,p.start+p.count);for(let y=m,g=x;y<g;y+=3){const w=l.getX(y),v=l.getX(y+1),N=l.getX(y+2);i=$j(this,a,e,r,u,d,f,w,v,N),i&&(i.faceIndex=Math.floor(y/3),n.push(i))}}else if(c!==void 0)if(Array.isArray(a))for(let m=0,x=h.length;m<x;m++){const y=h[m],g=a[y.materialIndex],w=Math.max(y.start,p.start),v=Math.min(c.count,Math.min(y.start+y.count,p.start+p.count));for(let N=w,S=v;N<S;N+=3){const _=N,j=N+1,A=N+2;i=$j(this,g,e,r,u,d,f,_,j,A),i&&(i.faceIndex=Math.floor(N/3),i.face.materialIndex=y.materialIndex,n.push(i))}}else{const m=Math.max(0,p.start),x=Math.min(c.count,p.start+p.count);for(let y=m,g=x;y<g;y+=3){const w=y,v=y+1,N=y+2;i=$j(this,a,e,r,u,d,f,w,v,N),i&&(i.faceIndex=Math.floor(y/3),n.push(i))}}}}function sgt(t,e,n,r,i,s,a,l){let c;if(e.side===Va?c=r.intersectTriangle(a,s,i,!0,l):c=r.intersectTriangle(i,s,a,e.side===$h,l),c===null)return null;Lj.copy(l),Lj.applyMatrix4(t.matrixWorld);const u=n.ray.origin.distanceTo(Lj);return u<n.near||u>n.far?null:{distance:u,point:Lj.clone(),object:t}}function $j(t,e,n,r,i,s,a,l,c,u){t.getVertexPosition(l,yx),t.getVertexPosition(c,vx),t.getVertexPosition(u,bx);const d=sgt(t,e,n,r,yx,vx,bx,Dj);if(d){i&&(Oj.fromBufferAttribute(i,l),Rj.fromBufferAttribute(i,c),Ij.fromBufferAttribute(i,u),d.uv=Uc.getInterpolation(Dj,yx,vx,bx,Oj,Rj,Ij,new Mn)),s&&(Oj.fromBufferAttribute(s,l),Rj.fromBufferAttribute(s,c),Ij.fromBufferAttribute(s,u),d.uv1=Uc.getInterpolation(Dj,yx,vx,bx,Oj,Rj,Ij,new Mn)),a&&(yX.fromBufferAttribute(a,l),vX.fromBufferAttribute(a,c),bX.fromBufferAttribute(a,u),d.normal=Uc.getInterpolation(Dj,yx,vx,bx,yX,vX,bX,new Re),d.normal.dot(r.direction)>0&&d.normal.multiplyScalar(-1));const f={a:l,b:c,c:u,normal:new Re,materialIndex:0};Uc.getNormal(yx,vx,bx,f.normal),d.face=f}return d}class iN extends Rg{constructor(e=1,n=1,r=1,i=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:n,depth:r,widthSegments:i,heightSegments:s,depthSegments:a};const l=this;i=Math.floor(i),s=Math.floor(s),a=Math.floor(a);const c=[],u=[],d=[],f=[];let h=0,p=0;m("z","y","x",-1,-1,r,n,e,a,s,0),m("z","y","x",1,-1,r,n,-e,a,s,1),m("x","z","y",1,1,e,r,n,i,a,2),m("x","z","y",1,-1,e,r,-n,i,a,3),m("x","y","z",1,-1,e,n,r,i,s,4),m("x","y","z",-1,-1,e,n,-r,i,s,5),this.setIndex(c),this.setAttribute("position",new Cm(u,3)),this.setAttribute("normal",new Cm(d,3)),this.setAttribute("uv",new Cm(f,2));function m(x,y,g,w,v,N,S,_,j,A,C){const k=N/j,M=S/A,I=N/2,R=S/2,E=_/2,P=j+1,O=A+1;let L=0,T=0;const D=new Re;for(let F=0;F<O;F++){const q=F*M-R;for(let B=0;B<P;B++){const z=B*k-I;D[x]=z*w,D[y]=q*v,D[g]=E,u.push(D.x,D.y,D.z),D[x]=0,D[y]=0,D[g]=_>0?1:-1,d.push(D.x,D.y,D.z),f.push(B/j),f.push(1-F/A),L+=1}}for(let F=0;F<A;F++)for(let q=0;q<j;q++){const B=h+q+P*F,z=h+q+P*(F+1),H=h+(q+1)+P*(F+1),W=h+(q+1)+P*F;c.push(B,z,W),c.push(z,H,W),T+=6}l.addGroup(p,T,C),p+=T,h+=L}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new iN(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Gv(t){const e={};for(const n in t){e[n]={};for(const r in t[n]){const i=t[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[n][r]=null):e[n][r]=i.clone():Array.isArray(i)?e[n][r]=i.slice():e[n][r]=i}}return e}function ra(t){const e={};for(let n=0;n<t.length;n++){const r=Gv(t[n]);for(const i in r)e[i]=r[i]}return e}function agt(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n].clone());return e}function $pe(t){const e=t.getRenderTarget();return e===null?t.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Xn.workingColorSpace}const ogt={clone:Gv,merge:ra};var lgt=`void main() {
875	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
876}`,cgt=`void main() {
877	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
878}`;class Pd extends ZM{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=lgt,this.fragmentShader=cgt,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Gv(e.uniforms),this.uniformsGroups=agt(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const n=super.toJSON(e);n.glslVersion=this.glslVersion,n.uniforms={};for(const i in this.uniforms){const a=this.uniforms[i].value;a&&a.isTexture?n.uniforms[i]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?n.uniforms[i]={type:"c",value:a.getHex()}:a&&a.isVector2?n.uniforms[i]={type:"v2",value:a.toArray()}:a&&a.isVector3?n.uniforms[i]={type:"v3",value:a.toArray()}:a&&a.isVector4?n.uniforms[i]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?n.uniforms[i]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?n.uniforms[i]={type:"m4",value:a.toArray()}:n.uniforms[i]={value:a}}Object.keys(this.defines).length>0&&(n.defines=this.defines),n.vertexShader=this.vertexShader,n.fragmentShader=this.fragmentShader,n.lights=this.lights,n.clipping=this.clipping;const r={};for(const i in this.extensions)this.extensions[i]===!0&&(r[i]=!0);return Object.keys(r).length>0&&(n.extensions=r),n}}class Fpe extends Co{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new es,this.projectionMatrix=new es,this.projectionMatrixInverse=new es,this.coordinateSystem=id}copy(e,n){return super.copy(e,n),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,n){super.updateWorldMatrix(e,n),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const af=new Re,wX=new Mn,_X=new Mn;class ql extends Fpe{constructor(e=50,n=1,r=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=r,this.far=i,this.focus=10,this.aspect=n,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const n=.5*this.getFilmHeight()/e;this.fov=N5*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(bI*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return N5*2*Math.atan(Math.tan(bI*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,n,r){af.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(af.x,af.y).multiplyScalar(-e/af.z),af.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),r.set(af.x,af.y).multiplyScalar(-e/af.z)}getViewSize(e,n){return this.getViewBounds(e,wX,_X),n.subVectors(_X,wX)}setViewOffset(e,n,r,i,s,a){this.aspect=e/n,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let n=e*Math.tan(bI*.5*this.fov)/this.zoom,r=2*n,i=this.aspect*r,s=-.5*i;const a=this.view;if(this.view!==null&&this.view.enabled){const c=a.fullWidth,u=a.fullHeight;s+=a.offsetX*i/c,n-=a.offsetY*r/u,i*=a.width/c,r*=a.height/u}const l=this.filmOffset;l!==0&&(s+=e*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,n,n-r,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.fov=this.fov,n.object.zoom=this.zoom,n.object.near=this.near,n.object.far=this.far,n.object.focus=this.focus,n.object.aspect=this.aspect,this.view!==null&&(n.object.view=Object.assign({},this.view)),n.object.filmGauge=this.filmGauge,n.object.filmOffset=this.filmOffset,n}}const wx=-90,_x=1;class ugt extends Co{constructor(e,n,r){super(),this.type="CubeCamera",this.renderTarget=r,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new ql(wx,_x,e,n);i.layers=this.layers,this.add(i);const s=new ql(wx,_x,e,n);s.layers=this.layers,this.add(s);const a=new ql(wx,_x,e,n);a.layers=this.layers,this.add(a);const l=new ql(wx,_x,e,n);l.layers=this.layers,this.add(l);const c=new ql(wx,_x,e,n);c.layers=this.layers,this.add(c);const u=new ql(wx,_x,e,n);u.layers=this.layers,this.add(u)}updateCoordinateSystem(){const e=this.coordinateSystem,n=this.children.concat(),[r,i,s,a,l,c]=n;for(const u of n)this.remove(u);if(e===id)r.up.set(0,1,0),r.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),l.up.set(0,1,0),l.lookAt(0,0,1),c.up.set(0,1,0),c.lookAt(0,0,-1);else if(e===vE)r.up.set(0,-1,0),r.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),l.up.set(0,-1,0),l.lookAt(0,0,1),c.up.set(0,-1,0),c.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const u of n)this.add(u),u.updateMatrixWorld()}update(e,n){this.parent===null&&this.updateMatrixWorld();const{renderTarget:r,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,l,c,u,d]=this.children,f=e.getRenderTarget(),h=e.getActiveCubeFace(),p=e.getActiveMipmapLevel(),m=e.xr.enabled;e.xr.enabled=!1;const x=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,e.setRenderTarget(r,0,i),e.render(n,s),e.setRenderTarget(r,1,i),e.render(n,a),e.setRenderTarget(r,2,i),e.render(n,l),e.setRenderTarget(r,3,i),e.render(n,c),e.setRenderTarget(r,4,i),e.render(n,u),r.texture.generateMipmaps=x,e.setRenderTarget(r,5,i),e.render(n,d),e.setRenderTarget(f,h,p),e.xr.enabled=m,r.texture.needsPMREMUpdate=!0}}class Upe extends Ha{constructor(e,n,r,i,s,a,l,c,u,d){e=e!==void 0?e:[],n=n!==void 0?n:Bv,super(e,n,r,i,s,a,l,c,u,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class dgt extends eg{constructor(e=1,n={}){super(e,e,n),this.isWebGLCubeRenderTarget=!0;const r={width:e,height:e,depth:1},i=[r,r,r,r,r,r];this.texture=new Upe(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=n.generateMipmaps!==void 0?n.generateMipmaps:!1,this.texture.minFilter=n.minFilter!==void 0?n.minFilter:Xl}fromEquirectangularTexture(e,n){this.texture.type=n.type,this.texture.colorSpace=n.colorSpace,this.texture.generateMipmaps=n.generateMipmaps,this.texture.minFilter=n.minFilter,this.texture.magFilter=n.magFilter;const r={uniforms:{tEquirect:{value:null}},vertexShader:`
879
880				varying vec3 vWorldDirection;
881
882				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
883
884					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
885
886				}
887
888				void main() {
889
890					vWorldDirection = transformDirection( position, modelMatrix );
891
892					#include <begin_vertex>
893					#include <project_vertex>
894
895				}
896			`,fragmentShader:`
897
898				uniform sampler2D tEquirect;
899
900				varying vec3 vWorldDirection;
901
902				#include <common>
903
904				void main() {
905
906					vec3 direction = normalize( vWorldDirection );
907
908					vec2 sampleUV = equirectUv( direction );
909
910					gl_FragColor = texture2D( tEquirect, sampleUV );
911
912				}
913			`},i=new iN(5,5,5),s=new Pd({name:"CubemapFromEquirect",uniforms:Gv(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:Va,blending:gh});s.uniforms.tEquirect.value=n;const a=new Hc(i,s),l=n.minFilter;return n.minFilter===nm&&(n.minFilter=Xl),new ugt(1,10,this).update(e,a),n.minFilter=l,a.geometry.dispose(),a.material.dispose(),this}clear(e,n,r,i){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(n,r,i);e.setRenderTarget(s)}}const FI=new Re,fgt=new Re,hgt=new wn;class Rp{constructor(e=new Re(1,0,0),n=0){this.isPlane=!0,this.normal=e,this.constant=n}set(e,n){return this.normal.copy(e),this.constant=n,this}setComponents(e,n,r,i){return this.normal.set(e,n,r),this.constant=i,this}setFromNormalAndCoplanarPoint(e,n){return this.normal.copy(e),this.constant=-n.dot(this.normal),this}setFromCoplanarPoints(e,n,r){const i=FI.subVectors(r,n).cross(fgt.subVectors(e,n)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,n){return n.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,n){const r=e.delta(FI),i=this.normal.dot(r);if(i===0)return this.distanceToPoint(e.start)===0?n.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:n.copy(e.start).addScaledVector(r,s)}intersectsLine(e){const n=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return n<0&&r>0||r<0&&n>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,n){const r=n||hgt.getNormalMatrix(e),i=this.coplanarPoint(FI).applyMatrix4(e),s=this.normal.applyMatrix3(r).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const bp=new e8,Fj=new Re;class zpe{constructor(e=new Rp,n=new Rp,r=new Rp,i=new Rp,s=new Rp,a=new Rp){this.planes=[e,n,r,i,s,a]}set(e,n,r,i,s,a){const l=this.planes;return l[0].copy(e),l[1].copy(n),l[2].copy(r),l[3].copy(i),l[4].copy(s),l[5].copy(a),this}copy(e){const n=this.planes;for(let r=0;r<6;r++)n[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e,n=id){const r=this.planes,i=e.elements,s=i[0],a=i[1],l=i[2],c=i[3],u=i[4],d=i[5],f=i[6],h=i[7],p=i[8],m=i[9],x=i[10],y=i[11],g=i[12],w=i[13],v=i[14],N=i[15];if(r[0].setComponents(c-s,h-u,y-p,N-g).normalize(),r[1].setComponents(c+s,h+u,y+p,N+g).normalize(),r[2].setComponents(c+a,h+d,y+m,N+w).normalize(),r[3].setComponents(c-a,h-d,y-m,N-w).normalize(),r[4].setComponents(c-l,h-f,y-x,N-v).normalize(),n===id)r[5].setComponents(c+l,h+f,y+x,N+v).normalize();else if(n===vE)r[5].setComponents(l,f,x,v).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+n);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),bp.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),bp.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(bp)}intersectsSprite(e){return bp.center.set(0,0,0),bp.radius=.7071067811865476,bp.applyMatrix4(e.matrixWorld),this.intersectsSphere(bp)}intersectsSphere(e){const n=this.planes,r=e.center,i=-e.radius;for(let s=0;s<6;s++)if(n[s].distanceToPoint(r)<i)return!1;return!0}intersectsBox(e){const n=this.planes;for(let r=0;r<6;r++){const i=n[r];if(Fj.x=i.normal.x>0?e.max.x:e.min.x,Fj.y=i.normal.y>0?e.max.y:e.min.y,Fj.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Fj)<0)return!1}return!0}containsPoint(e){const n=this.planes;for(let r=0;r<6;r++)if(n[r].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function Bpe(){let t=null,e=!1,n=null,r=null;function i(s,a){n(s,a),r=t.requestAnimationFrame(i)}return{start:function(){e!==!0&&n!==null&&(r=t.requestAnimationFrame(i),e=!0)},stop:function(){t.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(s){n=s},setContext:function(s){t=s}}}function pgt(t){const e=new WeakMap;function n(l,c){const u=l.array,d=l.usage,f=u.byteLength,h=t.createBuffer();t.bindBuffer(c,h),t.bufferData(c,u,d),l.onUploadCallback();let p;if(u instanceof Float32Array)p=t.FLOAT;else if(u instanceof Uint16Array)l.isFloat16BufferAttribute?p=t.HALF_FLOAT:p=t.UNSIGNED_SHORT;else if(u instanceof Int16Array)p=t.SHORT;else if(u instanceof Uint32Array)p=t.UNSIGNED_INT;else if(u instanceof Int32Array)p=t.INT;else if(u instanceof Int8Array)p=t.BYTE;else if(u instanceof Uint8Array)p=t.UNSIGNED_BYTE;else if(u instanceof Uint8ClampedArray)p=t.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+u);return{buffer:h,type:p,bytesPerElement:u.BYTES_PER_ELEMENT,version:l.version,size:f}}function r(l,c,u){const d=c.array,f=c._updateRange,h=c.updateRanges;if(t.bindBuffer(u,l),f.count===-1&&h.length===0&&t.bufferSubData(u,0,d),h.length!==0){for(let p=0,m=h.length;p<m;p++){const x=h[p];t.bufferSubData(u,x.start*d.BYTES_PER_ELEMENT,d,x.start,x.count)}c.clearUpdateRanges()}f.count!==-1&&(t.bufferSubData(u,f.offset*d.BYTES_PER_ELEMENT,d,f.offset,f.count),f.count=-1),c.onUploadCallback()}function i(l){return l.isInterleavedBufferAttribute&&(l=l.data),e.get(l)}function s(l){l.isInterleavedBufferAttribute&&(l=l.data);const c=e.get(l);c&&(t.deleteBuffer(c.buffer),e.delete(l))}
vendor: 5,521 bytes, lines 913-1026
913function a(l,c){if(l.isInterleavedBufferAttribute&&(l=l.data),l.isGLBufferAttribute){const d=e.get(l);(!d||d.version<l.version)&&e.set(l,{buffer:l.buffer,type:l.type,bytesPerElement:l.elementSize,version:l.version});return}const u=e.get(l);if(u===void 0)e.set(l,n(l,c));else if(u.version<l.version){if(u.size!==l.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");r(u.buffer,l,c),u.version=l.version}}return{get:i,remove:s,update:a}}class sN extends Rg{constructor(e=1,n=1,r=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:n,widthSegments:r,heightSegments:i};const s=e/2,a=n/2,l=Math.floor(r),c=Math.floor(i),u=l+1,d=c+1,f=e/l,h=n/c,p=[],m=[],x=[],y=[];for(let g=0;g<d;g++){const w=g*h-a;for(let v=0;v<u;v++){const N=v*f-s;m.push(N,-w,0),x.push(0,0,1),y.push(v/l),y.push(1-g/c)}}for(let g=0;g<c;g++)for(let w=0;w<l;w++){const v=w+u*g,N=w+u*(g+1),S=w+1+u*(g+1),_=w+1+u*g;p.push(v,N,_),p.push(N,S,_)}this.setIndex(p),this.setAttribute("position",new Cm(m,3)),this.setAttribute("normal",new Cm(x,3)),this.setAttribute("uv",new Cm(y,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new sN(e.width,e.height,e.widthSegments,e.heightSegments)}}var mgt=`#ifdef USE_ALPHAHASH
914	if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
915#endif`,ggt=`#ifdef USE_ALPHAHASH
916	const float ALPHA_HASH_SCALE = 0.05;
917	float hash2D( vec2 value ) {
918		return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
919	}
920	float hash3D( vec3 value ) {
921		return hash2D( vec2( hash2D( value.xy ), value.z ) );
922	}
923	float getAlphaHashThreshold( vec3 position ) {
924		float maxDeriv = max(
925			length( dFdx( position.xyz ) ),
926			length( dFdy( position.xyz ) )
927		);
928		float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
929		vec2 pixScales = vec2(
930			exp2( floor( log2( pixScale ) ) ),
931			exp2( ceil( log2( pixScale ) ) )
932		);
933		vec2 alpha = vec2(
934			hash3D( floor( pixScales.x * position.xyz ) ),
935			hash3D( floor( pixScales.y * position.xyz ) )
936		);
937		float lerpFactor = fract( log2( pixScale ) );
938		float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
939		float a = min( lerpFactor, 1.0 - lerpFactor );
940		vec3 cases = vec3(
941			x * x / ( 2.0 * a * ( 1.0 - a ) ),
942			( x - 0.5 * a ) / ( 1.0 - a ),
943			1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
944		);
945		float threshold = ( x < ( 1.0 - a ) )
946			? ( ( x < a ) ? cases.x : cases.y )
947			: cases.z;
948		return clamp( threshold , 1.0e-6, 1.0 );
949	}
950#endif`,xgt=`#ifdef USE_ALPHAMAP
951	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
952#endif`,ygt=`#ifdef USE_ALPHAMAP
953	uniform sampler2D alphaMap;
954#endif`,vgt=`#ifdef USE_ALPHATEST
955	#ifdef ALPHA_TO_COVERAGE
956	diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
957	if ( diffuseColor.a == 0.0 ) discard;
958	#else
959	if ( diffuseColor.a < alphaTest ) discard;
960	#endif
961#endif`,bgt=`#ifdef USE_ALPHATEST
962	uniform float alphaTest;
963#endif`,wgt=`#ifdef USE_AOMAP
964	float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
965	reflectedLight.indirectDiffuse *= ambientOcclusion;
966	#if defined( USE_CLEARCOAT ) 
967		clearcoatSpecularIndirect *= ambientOcclusion;
968	#endif
969	#if defined( USE_SHEEN ) 
970		sheenSpecularIndirect *= ambientOcclusion;
971	#endif
972	#if defined( USE_ENVMAP ) && defined( STANDARD )
973		float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
974		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
975	#endif
976#endif`,_gt=`#ifdef USE_AOMAP
977	uniform sampler2D aoMap;
978	uniform float aoMapIntensity;
979#endif`,Sgt=`#ifdef USE_BATCHING
980	#if ! defined( GL_ANGLE_multi_draw )
981	#define gl_DrawID _gl_DrawID
982	uniform int _gl_DrawID;
983	#endif
984	uniform highp sampler2D batchingTexture;
985	uniform highp usampler2D batchingIdTexture;
986	mat4 getBatchingMatrix( const in float i ) {
987		int size = textureSize( batchingTexture, 0 ).x;
988		int j = int( i ) * 4;
989		int x = j % size;
990		int y = j / size;
991		vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
992		vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
993		vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
994		vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
995		return mat4( v1, v2, v3, v4 );
996	}
997	float getIndirectIndex( const in int i ) {
998		int size = textureSize( batchingIdTexture, 0 ).x;
999		int x = i % size;
1000		int y = i / size;
1001		return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
1002	}
1003#endif
1004#ifdef USE_BATCHING_COLOR
1005	uniform sampler2D batchingColorTexture;
1006	vec3 getBatchingColor( const in float i ) {
1007		int size = textureSize( batchingColorTexture, 0 ).x;
1008		int j = int( i );
1009		int x = j % size;
1010		int y = j / size;
1011		return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
1012	}
1013#endif`,Ngt=`#ifdef USE_BATCHING
1014	mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
1015#endif`,jgt=`vec3 transformed = vec3( position );
1016#ifdef USE_ALPHAHASH
1017	vPosition = vec3( position );
1018#endif`,Cgt=`vec3 objectNormal = vec3( normal );
1019#ifdef USE_TANGENT
1020	vec3 objectTangent = vec3( tangent.xyz );
1021#endif`,kgt=`float G_BlinnPhong_Implicit( ) {
1022	return 0.25;
1023}
1024float D_BlinnPhong( const in float shininess, const in float dotNH ) {
1025	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
1026}
1027vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
1028	vec3 halfDir = normalize( lightDir + viewDir );
1029	float dotNH = saturate( dot( normal, halfDir ) );
1030	float dotVH = saturate( dot( viewDir, halfDir ) );
1031	vec3 F = F_Schlick( specularColor, 1.0, dotVH );
1032	float G = G_BlinnPhong_Implicit( );
1033	float D = D_BlinnPhong( shininess, dotNH );
1034	return F * ( G * D );
1035} // validated`,Egt=`#ifdef USE_IRIDESCENCE
1036	const mat3 XYZ_TO_REC709 = mat3(
1037		 3.2404542, -0.9692660,  0.0556434,
1038		-1.5371385,  1.8760108, -0.2040259,
1039		-0.4985314,  0.0415560,  1.0572252
1040	);
1041	vec3 Fresnel0ToIor( vec3 fresnel0 ) {
1042		vec3 sqrtF0 = sqrt( fresnel0 );
1043		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
1044	}
1045	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
1046		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
1047	}
1048	float IorToFresnel0( float transmittedIor, float incidentIor ) {
1049		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
1050	}
1051	vec3 evalSensitivity( float OPD, vec3 shift ) {
1052		float phase = 2.0 * PI * OPD * 1.0e-9;
1053		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
1054		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
1055		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
1056		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
1057		xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
1058		xyz /= 1.0685e-7;
1059		vec3 rgb = XYZ_TO_REC709 * xyz;
1060		return rgb;
1061	}
1062	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
1063		vec3 I;
1064		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
1065		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
1066		float cosTheta2Sq = 1.0 - sinTheta2Sq;
1067		if ( cosTheta2Sq < 0.0 ) {
1068			return vec3( 1.0 );
1069		}
1070		float cosTheta2 = sqrt( cosTheta2Sq );
1071		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
1072		float R12 = F_Schlick( R0, 1.0, cosTheta1 );
1073		float T121 = 1.0 - R12;
1074		float phi12 = 0.0;
1075		if ( iridescenceIOR < outsideIOR ) phi12 = PI;
1076		float phi21 = PI - phi12;
1077		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
1078		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
1079		vec3 phi23 = vec3( 0.0 );
1080		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
1081		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
1082		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
1083		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
1084		vec3 phi = vec3( phi21 ) + phi23;
1085		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
1086		vec3 r123 = sqrt( R123 );
1087		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
1088		vec3 C0 = R12 + Rs;
1089		I = C0;
1090		vec3 Cm = Rs - T121;
1091		for ( int m = 1; m <= 2; ++ m ) {
1092			Cm *= r123;
1093			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
1094			I += Cm * Sm;
1095		}
1096		return max( I, vec3( 0.0 ) );
1097	}
1098#endif`,Agt=`#ifdef USE_BUMPMAP
1099	uniform sampler2D bumpMap;
1100	uniform float bumpScale;
1101	vec2 dHdxy_fwd() {
1102		vec2 dSTdx = dFdx( vBumpMapUv );
1103		vec2 dSTdy = dFdy( vBumpMapUv );
1104		float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
1105		float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
1106		float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
1107		return vec2( dBx, dBy );
1108	}
1109	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
1110		vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
1111		vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
1112		vec3 vN = surf_norm;
1113		vec3 R1 = cross( vSigmaY, vN );
1114		vec3 R2 = cross( vN, vSigmaX );
1115		float fDet = dot( vSigmaX, R1 ) * faceDirection;
1116		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
1117		return normalize( abs( fDet ) * surf_norm - vGrad );
1118	}
1119#endif`,Tgt=`#if NUM_CLIPPING_PLANES > 0
1120	vec4 plane;
1121	#ifdef ALPHA_TO_COVERAGE
1122		float distanceToPlane, distanceGradient;
1123		float clipOpacity = 1.0;
1124		#pragma unroll_loop_start
1125		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
1126			plane = clippingPlanes[ i ];
1127			distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
1128			distanceGradient = fwidth( distanceToPlane ) / 2.0;
1129			clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
1130			if ( clipOpacity == 0.0 ) discard;
1131		}
1132		#pragma unroll_loop_end
1133		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
1134			float unionClipOpacity = 1.0;
1135			#pragma unroll_loop_start
1136			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
1137				plane = clippingPlanes[ i ];
1138				distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
1139				distanceGradient = fwidth( distanceToPlane ) / 2.0;
1140				unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
1141			}
1142			#pragma unroll_loop_end
1143			clipOpacity *= 1.0 - unionClipOpacity;
1144		#endif
1145		diffuseColor.a *= clipOpacity;
1146		if ( diffuseColor.a == 0.0 ) discard;
1147	#else
1148		#pragma unroll_loop_start
1149		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
1150			plane = clippingPlanes[ i ];
1151			if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
1152		}
1153		#pragma unroll_loop_end
1154		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
1155			bool clipped = true;
1156			#pragma unroll_loop_start
1157			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
1158				plane = clippingPlanes[ i ];
1159				clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
1160			}
1161			#pragma unroll_loop_end
1162			if ( clipped ) discard;
1163		#endif
1164	#endif
1165#endif`,Mgt=`#if NUM_CLIPPING_PLANES > 0
1166	varying vec3 vClipPosition;
1167	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
1168#endif`,Pgt=`#if NUM_CLIPPING_PLANES > 0
1169	varying vec3 vClipPosition;
1170#endif`,Ogt=`#if NUM_CLIPPING_PLANES > 0
1171	vClipPosition = - mvPosition.xyz;
1172#endif`,Rgt=`#if defined( USE_COLOR_ALPHA )
1173	diffuseColor *= vColor;
1174#elif defined( USE_COLOR )
1175	diffuseColor.rgb *= vColor;
1176#endif`,Igt=`#if defined( USE_COLOR_ALPHA )
1177	varying vec4 vColor;
1178#elif defined( USE_COLOR )
1179	varying vec3 vColor;
1180#endif`,Dgt=`#if defined( USE_COLOR_ALPHA )
1181	varying vec4 vColor;
1182#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
1183	varying vec3 vColor;
1184#endif`,Lgt=`#if defined( USE_COLOR_ALPHA )
1185	vColor = vec4( 1.0 );
1186#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
1187	vColor = vec3( 1.0 );
1188#endif
1189#ifdef USE_COLOR
1190	vColor *= color;
1191#endif
1192#ifdef USE_INSTANCING_COLOR
1193	vColor.xyz *= instanceColor.xyz;
1194#endif
1195#ifdef USE_BATCHING_COLOR
1196	vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );
1197	vColor.xyz *= batchingColor.xyz;
1198#endif`,$gt=`#define PI 3.141592653589793
1199#define PI2 6.283185307179586
1200#define PI_HALF 1.5707963267948966
1201#define RECIPROCAL_PI 0.3183098861837907
1202#define RECIPROCAL_PI2 0.15915494309189535
1203#define EPSILON 1e-6
1204#ifndef saturate
1205#define saturate( a ) clamp( a, 0.0, 1.0 )
1206#endif
1207#define whiteComplement( a ) ( 1.0 - saturate( a ) )
1208float pow2( const in float x ) { return x*x; }
1209vec3 pow2( const in vec3 x ) { return x*x; }
1210float pow3( const in float x ) { return x*x*x; }
1211float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
1212float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
1213float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
1214highp float rand( const in vec2 uv ) {
1215	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
1216	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
1217	return fract( sin( sn ) * c );
1218}
1219#ifdef HIGH_PRECISION
1220	float precisionSafeLength( vec3 v ) { return length( v ); }
1221#else
1222	float precisionSafeLength( vec3 v ) {
1223		float maxComponent = max3( abs( v ) );
1224		return length( v / maxComponent ) * maxComponent;
1225	}
1226#endif
1227struct IncidentLight {
1228	vec3 color;
1229	vec3 direction;
1230	bool visible;
1231};
1232struct ReflectedLight {
1233	vec3 directDiffuse;
1234	vec3 directSpecular;
1235	vec3 indirectDiffuse;
1236	vec3 indirectSpecular;
1237};
1238#ifdef USE_ALPHAHASH
1239	varying vec3 vPosition;
1240#endif
1241vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
1242	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
1243}
1244vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
1245	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
1246}
1247mat3 transposeMat3( const in mat3 m ) {
1248	mat3 tmp;
1249	tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
1250	tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
1251	tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
1252	return tmp;
1253}
1254bool isPerspectiveMatrix( mat4 m ) {
1255	return m[ 2 ][ 3 ] == - 1.0;
1256}
1257vec2 equirectUv( in vec3 dir ) {
1258	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
1259	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
1260	return vec2( u, v );
1261}
1262vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
1263	return RECIPROCAL_PI * diffuseColor;
1264}
1265vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
1266	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
1267	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
1268}
1269float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
1270	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
1271	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
1272} // validated`,Fgt=`#ifdef ENVMAP_TYPE_CUBE_UV
1273	#define cubeUV_minMipLevel 4.0
1274	#define cubeUV_minTileSize 16.0
1275	float getFace( vec3 direction ) {
1276		vec3 absDirection = abs( direction );
1277		float face = - 1.0;
1278		if ( absDirection.x > absDirection.z ) {
1279			if ( absDirection.x > absDirection.y )
1280				face = direction.x > 0.0 ? 0.0 : 3.0;
1281			else
1282				face = direction.y > 0.0 ? 1.0 : 4.0;
1283		} else {
1284			if ( absDirection.z > absDirection.y )
1285				face = direction.z > 0.0 ? 2.0 : 5.0;
1286			else
1287				face = direction.y > 0.0 ? 1.0 : 4.0;
1288		}
1289		return face;
1290	}
1291	vec2 getUV( vec3 direction, float face ) {
1292		vec2 uv;
1293		if ( face == 0.0 ) {
1294			uv = vec2( direction.z, direction.y ) / abs( direction.x );
1295		} else if ( face == 1.0 ) {
1296			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
1297		} else if ( face == 2.0 ) {
1298			uv = vec2( - direction.x, direction.y ) / abs( direction.z );
1299		} else if ( face == 3.0 ) {
1300			uv = vec2( - direction.z, direction.y ) / abs( direction.x );
1301		} else if ( face == 4.0 ) {
1302			uv = vec2( - direction.x, direction.z ) / abs( direction.y );
1303		} else {
1304			uv = vec2( direction.x, direction.y ) / abs( direction.z );
1305		}
1306		return 0.5 * ( uv + 1.0 );
1307	}
1308	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
1309		float face = getFace( direction );
1310		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
1311		mipInt = max( mipInt, cubeUV_minMipLevel );
1312		float faceSize = exp2( mipInt );
1313		highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
1314		if ( face > 2.0 ) {
1315			uv.y += faceSize;
1316			face -= 3.0;
1317		}
1318		uv.x += face * faceSize;
1319		uv.x += filterInt * 3.0 * cubeUV_minTileSize;
1320		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
1321		uv.x *= CUBEUV_TEXEL_WIDTH;
1322		uv.y *= CUBEUV_TEXEL_HEIGHT;
1323		#ifdef texture2DGradEXT
1324			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
1325		#else
1326			return texture2D( envMap, uv ).rgb;
1327		#endif
1328	}
1329	#define cubeUV_r0 1.0
1330	#define cubeUV_m0 - 2.0
1331	#define cubeUV_r1 0.8
1332	#define cubeUV_m1 - 1.0
1333	#define cubeUV_r4 0.4
1334	#define cubeUV_m4 2.0
1335	#define cubeUV_r5 0.305
1336	#define cubeUV_m5 3.0
1337	#define cubeUV_r6 0.21
1338	#define cubeUV_m6 4.0
1339	float roughnessToMip( float roughness ) {
1340		float mip = 0.0;
1341		if ( roughness >= cubeUV_r1 ) {
1342			mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
1343		} else if ( roughness >= cubeUV_r4 ) {
1344			mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
1345		} else if ( roughness >= cubeUV_r5 ) {
1346			mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
1347		} else if ( roughness >= cubeUV_r6 ) {
1348			mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
1349		} else {
1350			mip = - 2.0 * log2( 1.16 * roughness );		}
1351		return mip;
1352	}
1353	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
1354		float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
1355		float mipF = fract( mip );
1356		float mipInt = floor( mip );
1357		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
1358		if ( mipF == 0.0 ) {
1359			return vec4( color0, 1.0 );
1360		} else {
1361			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
1362			return vec4( mix( color0, color1, mipF ), 1.0 );
1363		}
1364	}
1365#endif`,Ugt=`vec3 transformedNormal = objectNormal;
1366#ifdef USE_TANGENT
1367	vec3 transformedTangent = objectTangent;
1368#endif
1369#ifdef USE_BATCHING
1370	mat3 bm = mat3( batchingMatrix );
1371	transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
1372	transformedNormal = bm * transformedNormal;
1373	#ifdef USE_TANGENT
1374		transformedTangent = bm * transformedTangent;
1375	#endif
1376#endif
1377#ifdef USE_INSTANCING
1378	mat3 im = mat3( instanceMatrix );
1379	transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
1380	transformedNormal = im * transformedNormal;
1381	#ifdef USE_TANGENT
1382		transformedTangent = im * transformedTangent;
1383	#endif
1384#endif
1385transformedNormal = normalMatrix * transformedNormal;
1386#ifdef FLIP_SIDED
1387	transformedNormal = - transformedNormal;
1388#endif
1389#ifdef USE_TANGENT
1390	transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
1391	#ifdef FLIP_SIDED
1392		transformedTangent = - transformedTangent;
1393	#endif
1394#endif`,zgt=`#ifdef USE_DISPLACEMENTMAP
1395	uniform sampler2D displacementMap;
1396	uniform float displacementScale;
1397	uniform float displacementBias;
1398#endif`,Bgt=`#ifdef USE_DISPLACEMENTMAP
1399	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
1399placementBias );
1400#endif`,Vgt=`#ifdef USE_EMISSIVEMAP
1401	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
1402	totalEmissiveRadiance *= emissiveColor.rgb;
1403#endif`,Hgt=`#ifdef USE_EMISSIVEMAP
1404	uniform sampler2D emissiveMap;
1405#endif`,Wgt="gl_FragColor = linearToOutputTexel( gl_FragColor );",Ggt=`
1406const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(
1407	vec3( 0.8224621, 0.177538, 0.0 ),
1408	vec3( 0.0331941, 0.9668058, 0.0 ),
1409	vec3( 0.0170827, 0.0723974, 0.9105199 )
1410);
1411const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(
1412	vec3( 1.2249401, - 0.2249404, 0.0 ),
1413	vec3( - 0.0420569, 1.0420571, 0.0 ),
1414	vec3( - 0.0196376, - 0.0786361, 1.0982735 )
1415);
1416vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {
1417	return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );
1418}
1419vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {
1420	return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );
1421}
1422vec4 LinearTransferOETF( in vec4 value ) {
1423	return value;
1424}
1425vec4 sRGBTransferOETF( in vec4 value ) {
1426	return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
1427}`,qgt=`#ifdef USE_ENVMAP
1428	#ifdef ENV_WORLDPOS
1429		vec3 cameraToFrag;
1430		if ( isOrthographic ) {
1431			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
1432		} else {
1433			cameraToFrag = normalize( vWorldPosition - cameraPosition );
1434		}
1435		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
1436		#ifdef ENVMAP_MODE_REFLECTION
1437			vec3 reflectVec = reflect( cameraToFrag, worldNormal );
1438		#else
1439			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
1440		#endif
1441	#else
1442		vec3 reflectVec = vReflect;
1443	#endif
1444	#ifdef ENVMAP_TYPE_CUBE
1445		vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
1446	#else
1447		vec4 envColor = vec4( 0.0 );
1448	#endif
1449	#ifdef ENVMAP_BLENDING_MULTIPLY
1450		outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
1451	#elif defined( ENVMAP_BLENDING_MIX )
1452		outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
1453	#elif defined( ENVMAP_BLENDING_ADD )
1454		outgoingLight += envColor.xyz * specularStrength * reflectivity;
1455	#endif
1456#endif`,Kgt=`#ifdef USE_ENVMAP
1457	uniform float envMapIntensity;
1458	uniform float flipEnvMap;
1459	uniform mat3 envMapRotation;
1460	#ifdef ENVMAP_TYPE_CUBE
1461		uniform samplerCube envMap;
1462	#else
1463		uniform sampler2D envMap;
1464	#endif
1465	
1466#endif`,Ygt=`#ifdef USE_ENVMAP
1467	uniform float reflectivity;
1468	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
1469		#define ENV_WORLDPOS
1470	#endif
1471	#ifdef ENV_WORLDPOS
1472		varying vec3 vWorldPosition;
1473		uniform float refractionRatio;
1474	#else
1475		varying vec3 vReflect;
1476	#endif
1477#endif`,Xgt=`#ifdef USE_ENVMAP
1478	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
1479		#define ENV_WORLDPOS
1480	#endif
1481	#ifdef ENV_WORLDPOS
1482		
1483		varying vec3 vWorldPosition;
1484	#else
1485		varying vec3 vReflect;
1486		uniform float refractionRatio;
1487	#endif
1488#endif`,Qgt=`#ifdef USE_ENVMAP
1489	#ifdef ENV_WORLDPOS
1490		vWorldPosition = worldPosition.xyz;
1491	#else
1492		vec3 cameraToVertex;
1493		if ( isOrthographic ) {
1494			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
1495		} else {
1496			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
1497		}
1498		vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
1499		#ifdef ENVMAP_MODE_REFLECTION
1500			vReflect = reflect( cameraToVertex, worldNormal );
1501		#else
1502			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
1503		#endif
1504	#endif
1505#endif`,Jgt=`#ifdef USE_FOG
1506	vFogDepth = - mvPosition.z;
1507#endif`,Zgt=`#ifdef USE_FOG
1508	varying float vFogDepth;
1509#endif`,ext=`#ifdef USE_FOG
1510	#ifdef FOG_EXP2
1511		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
1512	#else
1513		float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
1514	#endif
1515	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
1516#endif`,txt=`#ifdef USE_FOG
1517	uniform vec3 fogColor;
1518	varying float vFogDepth;
1519	#ifdef FOG_EXP2
1520		uniform float fogDensity;
1521	#else
1522		uniform float fogNear;
1523		uniform float fogFar;
1524	#endif
1525#endif`,nxt=`#ifdef USE_GRADIENTMAP
1526	uniform sampler2D gradientMap;
1527#endif
1528vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
1529	float dotNL = dot( normal, lightDirection );
1530	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
1531	#ifdef USE_GRADIENTMAP
1532		return vec3( texture2D( gradientMap, coord ).r );
1533	#else
1534		vec2 fw = fwidth( coord ) * 0.5;
1535		return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
1536	#endif
1537}`,rxt=`#ifdef USE_LIGHTMAP
1538	uniform sampler2D lightMap;
1539	uniform float lightMapIntensity;
1540#endif`,ixt=`LambertMaterial material;
1541material.diffuseColor = diffuseColor.rgb;
1542material.specularStrength = specularStrength;`,sxt=`varying vec3 vViewPosition;
1543struct LambertMaterial {
1544	vec3 diffuseColor;
1545	float specularStrength;
1546};
1547void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
1548	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
1549	vec3 irradiance = dotNL * directLight.color;
1550	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1551}
1552void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
1553	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1554}
1555#define RE_Direct				RE_Direct_Lambert
1556#define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert`,axt=`uniform bool receiveShadow;
1557uniform vec3 ambientLightColor;
1558#if defined( USE_LIGHT_PROBES )
1559	uniform vec3 lightProbe[ 9 ];
1560#endif
1561vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
1562	float x = normal.x, y = normal.y, z = normal.z;
1563	vec3 result = shCoefficients[ 0 ] * 0.886227;
1564	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
1565	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
1566	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
1567	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
1568	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
1569	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
1570	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
1571	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
1572	return result;
1573}
1574vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
1575	vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
1576	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
1577	return irradiance;
1578}
1579vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
1580	vec3 irradiance = ambientLightColor;
1581	return irradiance;
1582}
1583float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
1584	float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
1585	if ( cutoffDistance > 0.0 ) {
1586		distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
1587	}
1588	return distanceFalloff;
1589}
1590float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
1591	return smoothstep( coneCosine, penumbraCosine, angleCosine );
1592}
1593#if NUM_DIR_LIGHTS > 0
1594	struct DirectionalLight {
1595		vec3 direction;
1596		vec3 color;
1597	};
1598	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
1599	void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
1600		light.color = directionalLight.color;
1601		light.direction = directionalLight.direction;
1602		light.visible = true;
1603	}
1604#endif
1605#if NUM_POINT_LIGHTS > 0
1606	struct PointLight {
1607		vec3 position;
1608		vec3 color;
1609		float distance;
1610		float decay;
1611	};
1612	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
1613	void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
1614		vec3 lVector = pointLight.position - geometryPosition;
1615		light.direction = normalize( lVector );
1616		float lightDistance = length( lVector );
1617		light.color = pointLight.color;
1618		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
1619		light.visible = ( light.color != vec3( 0.0 ) );
1620	}
1621#endif
1622#if NUM_SPOT_LIGHTS > 0
1623	struct SpotLight {
1624		vec3 position;
1625		vec3 direction;
1626		vec3 color;
1627		float distance;
1628		float decay;
1629		float coneCos;
1630		float penumbraCos;
1631	};
1632	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
1633	void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
1634		vec3 lVector = spotLight.position - geometryPosition;
1635		light.direction = normalize( lVector );
1636		float angleCos = dot( light.direction, spotLight.direction );
1637		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
1638		if ( spotAttenuation > 0.0 ) {
1639			float lightDistance = length( lVector );
1640			light.color = spotLight.color * spotAttenuation;
1641			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
1642			light.visible = ( light.color != vec3( 0.0 ) );
1643		} else {
1644			light.color = vec3( 0.0 );
1645			light.visible = false;
1646		}
1647	}
1648#endif
1649#if NUM_RECT_AREA_LIGHTS > 0
1650	struct RectAreaLight {
1651		vec3 color;
1652		vec3 position;
1653		vec3 halfWidth;
1654		vec3 halfHeight;
1655	};
1656	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
1657	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
1658#endif
1659#if NUM_HEMI_LIGHTS > 0
1660	struct HemisphereLight {
1661		vec3 direction;
1662		vec3 skyColor;
1663		vec3 groundColor;
1664	};
1665	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
1666	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
1667		float dotNL = dot( normal, hemiLight.direction );
1668		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
1669		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
1670		return irradiance;
1671	}
1672#endif`,oxt=`#ifdef USE_ENVMAP
1673	vec3 getIBLIrradiance( const in vec3 normal ) {
1674		#ifdef ENVMAP_TYPE_CUBE_UV
1675			vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
1676			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
1677			return PI * envMapColor.rgb * envMapIntensity;
1678		#else
1679			return vec3( 0.0 );
1680		#endif
1681	}
1682	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
1683		#ifdef ENVMAP_TYPE_CUBE_UV
1684			vec3 reflectVec = reflect( - viewDir, normal );
1685			reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
1686			reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
1687			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
1688			return envMapColor.rgb * envMapIntensity;
1689		#else
1690			return vec3( 0.0 );
1691		#endif
1692	}
1693	#ifdef USE_ANISOTROPY
1694		vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
1695			#ifdef ENVMAP_TYPE_CUBE_UV
1696				vec3 bentNormal = cross( bitangent, viewDir );
1697				bentNormal = normalize( cross( bentNormal, bitangent ) );
1698				bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
1699				return getIBLRadiance( viewDir, bentNormal, roughness );
1700			#else
1701				return vec3( 0.0 );
1702			#endif
1703		}
1704	#endif
1705#endif`,lxt=`ToonMaterial material;
1706material.diffuseColor = diffuseColor.rgb;`,cxt=`varying vec3 vViewPosition;
1707struct ToonMaterial {
1708	vec3 diffuseColor;
1709};
1710void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
1711	vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
1712	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1713}
1714void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
1715	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1716}
1717#define RE_Direct				RE_Direct_Toon
1718#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon`,uxt=`BlinnPhongMaterial material;
1719material.diffuseColor = diffuseColor.rgb;
1720material.specularColor = specular;
1721material.specularShininess = shininess;
1722material.specularStrength = specularStrength;`,dxt=`varying vec3 vViewPosition;
1723struct BlinnPhongMaterial {
1724	vec3 diffuseColor;
1725	vec3 specularColor;
1726	float specularShininess;
1727	float specularStrength;
1728};
1729void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
1730	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
1731	vec3 irradiance = dotNL * directLight.color;
1732	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1733	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
1734}
1735void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
1736	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1737}
1738#define RE_Direct				RE_Direct_BlinnPhong
1739#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong`,fxt=`PhysicalMaterial material;
1740material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
1741vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
1742float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
1743material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
1744material.roughness = min( material.roughness, 1.0 );
1745#ifdef IOR
1746	material.ior = ior;
1747	#ifdef USE_SPECULAR
1748		float specularIntensityFactor = specularIntensity;
1749		vec3 specularColorFactor = specularColor;
1750		#ifdef USE_SPECULAR_COLORMAP
1751			specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
1752		#endif
1753		#ifdef USE_SPECULAR_INTENSITYMAP
1754			specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
1755		#endif
1756		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
1757	#else
1758		float specularIntensityFactor = 1.0;
1759		vec3 specularColorFactor = vec3( 1.0 );
1760		material.specularF90 = 1.0;
1761	#endif
1762	material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
1763#else
1764	material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
1765	material.specularF90 = 1.0;
1766#endif
1767#ifdef USE_CLEARCOAT
1768	material.clearcoat = clearcoat;
1769	material.clearcoatRoughness = clearcoatRoughness;
1770	material.clearcoatF0 = vec3( 0.04 );
1771	material.clearcoatF90 = 1.0;
1772	#ifdef USE_CLEARCOATMAP
1773		material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
1774	#endif
1775	#ifdef USE_CLEARCOAT_ROUGHNESSMAP
1776		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
1777	#endif
1778	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
1779	material.clearcoatRoughness += geometryRoughness;
1780	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
1781#endif
1782#ifdef USE_DISPERSION
1783	material.dispersion = dispersion;
1784#endif
1785#ifdef USE_IRIDESCENCE
1786	material.iridescence = iridescence;
1787	material.iridescenceIOR = iridescenceIOR;
1788	#ifdef USE_IRIDESCENCEMAP
1789		material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
1790	#endif
1791	#ifdef USE_IRIDESCENCE_THICKNESSMAP
1792		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
1793	#else
1794		material.iridescenceThickness = iridescenceThicknessMaximum;
1795	#endif
1796#endif
1797#ifdef USE_SHEEN
1798	material.sheenColor = sheenColor;
1799	#ifdef USE_SHEEN_COLORMAP
1800		material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
1801	#endif
1802	material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
1803	#ifdef USE_SHEEN_ROUGHNESSMAP
1804		material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
1805	#endif
1806#endif
1807#ifdef USE_ANISOTROPY
1808	#ifdef USE_ANISOTROPYMAP
1809		mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
1810		vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
1811		vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
1812	#else
1813		vec2 anisotropyV = anisotropyVector;
1814	#endif
1815	material.anisotropy = length( anisotropyV );
1816	if( material.anisotropy == 0.0 ) {
1817		anisotropyV = vec2( 1.0, 0.0 );
1818	} else {
1819		anisotropyV /= material.anisotropy;
1820		material.anisotropy = saturate( material.anisotropy );
1821	}
1822	material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
1823	material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
1824	material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
1825#endif`,hxt
vendor: 14,687 bytes, lines 1825-2126
1825=`struct PhysicalMaterial {
1826	vec3 diffuseColor;
1827	float roughness;
1828	vec3 specularColor;
1829	float specularF90;
1830	float dispersion;
1831	#ifdef USE_CLEARCOAT
1832		float clearcoat;
1833		float clearcoatRoughness;
1834		vec3 clearcoatF0;
1835		float clearcoatF90;
1836	#endif
1837	#ifdef USE_IRIDESCENCE
1838		float iridescence;
1839		float iridescenceIOR;
1840		float iridescenceThickness;
1841		vec3 iridescenceFresnel;
1842		vec3 iridescenceF0;
1843	#endif
1844	#ifdef USE_SHEEN
1845		vec3 sheenColor;
1846		float sheenRoughness;
1847	#endif
1848	#ifdef IOR
1849		float ior;
1850	#endif
1851	#ifdef USE_TRANSMISSION
1852		float transmission;
1853		float transmissionAlpha;
1854		float thickness;
1855		float attenuationDistance;
1856		vec3 attenuationColor;
1857	#endif
1858	#ifdef USE_ANISOTROPY
1859		float anisotropy;
1860		float alphaT;
1861		vec3 anisotropyT;
1862		vec3 anisotropyB;
1863	#endif
1864};
1865vec3 clearcoatSpecularDirect = vec3( 0.0 );
1866vec3 clearcoatSpecularIndirect = vec3( 0.0 );
1867vec3 sheenSpecularDirect = vec3( 0.0 );
1868vec3 sheenSpecularIndirect = vec3(0.0 );
1869vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
1870    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
1871    float x2 = x * x;
1872    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
1873    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
1874}
1875float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
1876	float a2 = pow2( alpha );
1877	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
1878	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
1879	return 0.5 / max( gv + gl, EPSILON );
1880}
1881float D_GGX( const in float alpha, const in float dotNH ) {
1882	float a2 = pow2( alpha );
1883	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
1884	return RECIPROCAL_PI * a2 / pow2( denom );
1885}
1886#ifdef USE_ANISOTROPY
1887	float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
1888		float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
1889		float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
1890		float v = 0.5 / ( gv + gl );
1891		return saturate(v);
1892	}
1893	float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
1894		float a2 = alphaT * alphaB;
1895		highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
1896		highp float v2 = dot( v, v );
1897		float w2 = a2 / v2;
1898		return RECIPROCAL_PI * a2 * pow2 ( w2 );
1899	}
1900#endif
1901#ifdef USE_CLEARCOAT
1902	vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
1903		vec3 f0 = material.clearcoatF0;
1904		float f90 = material.clearcoatF90;
1905		float roughness = material.clearcoatRoughness;
1906		float alpha = pow2( roughness );
1907		vec3 halfDir = normalize( lightDir + viewDir );
1908		float dotNL = saturate( dot( normal, lightDir ) );
1909		float dotNV = saturate( dot( normal, viewDir ) );
1910		float dotNH = saturate( dot( normal, halfDir ) );
1911		float dotVH = saturate( dot( viewDir, halfDir ) );
1912		vec3 F = F_Schlick( f0, f90, dotVH );
1913		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1914		float D = D_GGX( alpha, dotNH );
1915		return F * ( V * D );
1916	}
1917#endif
1918vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
1919	vec3 f0 = material.specularColor;
1920	float f90 = material.specularF90;
1921	float roughness = material.roughness;
1922	float alpha = pow2( roughness );
1923	vec3 halfDir = normalize( lightDir + viewDir );
1924	float dotNL = saturate( dot( normal, lightDir ) );
1925	float dotNV = saturate( dot( normal, viewDir ) );
1926	float dotNH = saturate( dot( normal, halfDir ) );
1927	float dotVH = saturate( dot( viewDir, halfDir ) );
1928	vec3 F = F_Schlick( f0, f90, dotVH );
1929	#ifdef USE_IRIDESCENCE
1930		F = mix( F, material.iridescenceFresnel, material.iridescence );
1931	#endif
1932	#ifdef USE_ANISOTROPY
1933		float dotTL = dot( material.anisotropyT, lightDir );
1934		float dotTV = dot( material.anisotropyT, viewDir );
1935		float dotTH = dot( material.anisotropyT, halfDir );
1936		float dotBL = dot( material.anisotropyB, lightDir );
1937		float dotBV = dot( material.anisotropyB, viewDir );
1938		float dotBH = dot( material.anisotropyB, halfDir );
1939		float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
1940		float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
1941	#else
1942		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1943		float D = D_GGX( alpha, dotNH );
1944	#endif
1945	return F * ( V * D );
1946}
1947vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
1948	const float LUT_SIZE = 64.0;
1949	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
1950	const float LUT_BIAS = 0.5 / LUT_SIZE;
1951	float dotNV = saturate( dot( N, V ) );
1952	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
1953	uv = uv * LUT_SCALE + LUT_BIAS;
1954	return uv;
1955}
1956float LTC_ClippedSphereFormFactor( const in vec3 f ) {
1957	float l = length( f );
1958	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
1959}
1960vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
1961	float x = dot( v1, v2 );
1962	float y = abs( x );
1963	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
1964	float b = 3.4175940 + ( 4.1616724 + y ) * y;
1965	float v = a / b;
1966	float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
1967	return cross( v1, v2 ) * theta_sintheta;
1968}
1969vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
1970	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
1971	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
1972	vec3 lightNormal = cross( v1, v2 );
1973	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
1974	vec3 T1, T2;
1975	T1 = normalize( V - N * dot( V, N ) );
1976	T2 = - cross( N, T1 );
1977	mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
1978	vec3 coords[ 4 ];
1979	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
1980	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
1981	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
1982	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
1983	coords[ 0 ] = normalize( coords[ 0 ] );
1984	coords[ 1 ] = normalize( coords[ 1 ] );
1985	coords[ 2 ] = normalize( coords[ 2 ] );
1986	coords[ 3 ] = normalize( coords[ 3 ] );
1987	vec3 vectorFormFactor = vec3( 0.0 );
1988	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
1989	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
1990	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
1991	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
1992	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
1993	return vec3( result );
1994}
1995#if defined( USE_SHEEN )
1996float D_Charlie( float roughness, float dotNH ) {
1997	float alpha = pow2( roughness );
1998	float invAlpha = 1.0 / alpha;
1999	float cos2h = dotNH * dotNH;
2000	float sin2h = max( 1.0 - cos2h, 0.0078125 );
2001	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
2002}
2003float V_Neubelt( float dotNV, float dotNL ) {
2004	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
2005}
2006vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
2007	vec3 halfDir = normalize( lightDir + viewDir );
2008	float dotNL = saturate( dot( normal, lightDir ) );
2009	float dotNV = saturate( dot( normal, viewDir ) );
2010	float dotNH = saturate( dot( normal, halfDir ) );
2011	float D = D_Charlie( sheenRoughness, dotNH );
2012	float V = V_Neubelt( dotNV, dotNL );
2013	return sheenColor * ( D * V );
2014}
2015#endif
2016float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
2017	float dotNV = saturate( dot( normal, viewDir ) );
2018	float r2 = roughness * roughness;
2019	float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
2020	float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
2021	float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
2022	return saturate( DG * RECIPROCAL_PI );
2023}
2024vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
2025	float dotNV = saturate( dot( normal, viewDir ) );
2026	const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
2027	const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
2028	vec4 r = roughness * c0 + c1;
2029	float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
2030	vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
2031	return fab;
2032}
2033vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
2034	vec2 fab = DFGApprox( normal, viewDir, roughness );
2035	return specularColor * fab.x + specularF90 * fab.y;
2036}
2037#ifdef USE_IRIDESCENCE
2038void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
2039#else
2040void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
2041#endif
2042	vec2 fab = DFGApprox( normal, viewDir, roughness );
2043	#ifdef USE_IRIDESCENCE
2044		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
2045	#else
2046		vec3 Fr = specularColor;
2047	#endif
2048	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
2049	float Ess = fab.x + fab.y;
2050	float Ems = 1.0 - Ess;
2051	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
2052	singleScatter += FssEss;
2053	multiScatter += Fms * Ems;
2054}
2055#if NUM_RECT_AREA_LIGHTS > 0
2056	void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
2057		vec3 normal = geometryNormal;
2058		vec3 viewDir = geometryViewDir;
2059		vec3 position = geometryPosition;
2060		vec3 lightPos = rectAreaLight.position;
2061		vec3 halfWidth = rectAreaLight.halfWidth;
2062		vec3 halfHeight = rectAreaLight.halfHeight;
2063		vec3 lightColor = rectAreaLight.color;
2064		float roughness = material.roughness;
2065		vec3 rectCoords[ 4 ];
2066		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
2067		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
2068		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
2069		vec2 uv = LTC_Uv( normal, viewDir, roughness );
2070		vec4 t1 = texture2D( ltc_1, uv );
2071		vec4 t2 = texture2D( ltc_2, uv );
2072		mat3 mInv = mat3(
2073			vec3( t1.x, 0, t1.y ),
2074			vec3(    0, 1,    0 ),
2075			vec3( t1.z, 0, t1.w )
2076		);
2077		vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
2078		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
2079		reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
2080	}
2081#endif
2082void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
2083	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
2084	vec3 irradiance = dotNL * directLight.color;
2085	#ifdef USE_CLEARCOAT
2086		float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
2087		vec3 ccIrradiance = dotNLcc * directLight.color;
2088		clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
2089	#endif
2090	#ifdef USE_SHEEN
2091		sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
2092	#endif
2093	reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
2094	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
2095}
2096void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
2097	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
2098}
2099void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
2100	#ifdef USE_CLEARCOAT
2101		clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
2102	#endif
2103	#ifdef USE_SHEEN
2104		sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
2105	#endif
2106	vec3 singleScattering = vec3( 0.0 );
2107	vec3 multiScattering = vec3( 0.0 );
2108	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
2109	#ifdef USE_IRIDESCENCE
2110		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
2111	#else
2112		computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
2113	#endif
2114	vec3 totalScattering = singleScattering + multiScattering;
2115	vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
2116	reflectedLight.indirectSpecular += radiance * singleScattering;
2117	reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
2118	reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
2119}
2120#define RE_Direct				RE_Direct_Physical
2121#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
2122#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
2123#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
2124float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
2125	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
2126}`,
2126pxt=`
2127vec3 geometryPosition = - vViewPosition;
2128vec3 geometryNormal = normal;
2129vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
2130vec3 geometryClearcoatNormal = vec3( 0.0 );
2131#ifdef USE_CLEARCOAT
2132	geometryClearcoatNormal = clearcoatNormal;
2133#endif
2134#ifdef USE_IRIDESCENCE
2135	float dotNVi = saturate( dot( normal, geometryViewDir ) );
2136	if ( material.iridescenceThickness == 0.0 ) {
2137		material.iridescence = 0.0;
2138	} else {
2139		material.iridescence = saturate( material.iridescence );
2140	}
2141	if ( material.iridescence > 0.0 ) {
2142		material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
2143		material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
2144	}
2145#endif
2146IncidentLight directLight;
2147#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
2148	PointLight pointLight;
2149	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
2150	PointLightShadow pointLightShadow;
2151	#endif
2152	#pragma unroll_loop_start
2153	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
2154		pointLight = pointLights[ i ];
2155		getPointLightInfo( pointLight, geometryPosition, directLight );
2156		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
2157		pointLightShadow = pointLightShadows[ i ];
2158		directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
2159		#endif
2160		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
2161	}
2162	#pragma unroll_loop_end
2163#endif
2164#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
2165	SpotLight spotLight;
2166	vec4 spotColor;
2167	vec3 spotLightCoord;
2168	bool inSpotLightMap;
2169	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
2170	SpotLightShadow spotLightShadow;
2171	#endif
2172	#pragma unroll_loop_start
2173	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
2174		spotLight = spotLights[ i ];
2175		getSpotLightInfo( spotLight, geometryPosition, directLight );
2176		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
2177		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
2178		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
2179		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
2180		#else
2181		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
2182		#endif
2183		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
2184			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
2185			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
2186			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
2187			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
2188		#endif
2189		#undef SPOT_LIGHT_MAP_INDEX
2190		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
2191		spotLightShadow = spotLightShadows[ i ];
2192		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
2193		#endif
2194		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
2195	}
2196	#pragma unroll_loop_end
2197#endif
2198#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
2199	DirectionalLight directionalLight;
2200	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
2201	DirectionalLightShadow directionalLightShadow;
2202	#endif
2203	#pragma unroll_loop_start
2204	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
2205		directionalLight = directionalLights[ i ];
2206		getDirectionalLightInfo( directionalLight, directLight );
2207		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
2208		directionalLightShadow = directionalLightShadows[ i ];
2209		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
2210		#endif
2211		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
2212	}
2213	#pragma unroll_loop_end
2214#endif
2215#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
2216	RectAreaLight rectAreaLight;
2217	#pragma unroll_loop_start
2218	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
2219		rectAreaLight = rectAreaLights[ i ];
2220		RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
2221	}
2222	#pragma unroll_loop_end
2223#endif
2224#if defined( RE_IndirectDiffuse )
2225	vec3 iblIrradiance = vec3( 0.0 );
2226	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
2227	#if defined( USE_LIGHT_PROBES )
2228		irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
2229	#endif
2230	#if ( NUM_HEMI_LIGHTS > 0 )
2231		#pragma unroll_loop_start
2232		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
2233			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
2234		}
2235		#pragma unroll_loop_end
2236	#endif
2237#endif
2238#if defined( RE_IndirectSpecular )
2239	vec3 radiance = vec3( 0.0 );
2240	vec3 clearcoatRadiance = vec3( 0.0 );
2241#endif`,mxt=`#if defined( RE_IndirectDiffuse )
2242	#ifdef USE_LIGHTMAP
2243		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
2244		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
2245		irradiance += lightMapIrradiance;
2246	#endif
2247	#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
2248		iblIrradiance += getIBLIrradiance( geometryNormal );
2249	#endif
2250#endif
2251#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
2252	#ifdef USE_ANISOTROPY
2253		radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
2254	#else
2255		radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
2256	#endif
2257	#ifdef USE_CLEARCOAT
2258		clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
2259	#endif
2260#endif`,gxt=`#if defined( RE_IndirectDiffuse )
2261	RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
2262#endif
2263#if defined( RE_IndirectSpecular )
2264	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
2265#endif`,xxt=`#if defined( USE_LOGDEPTHBUF )
2266	gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
2267#endif`,yxt=`#if defined( USE_LOGDEPTHBUF )
2268	uniform float logDepthBufFC;
2269	varying float vFragDepth;
2270	varying float vIsPerspective;
2271#endif`,vxt=`#ifdef USE_LOGDEPTHBUF
2272	varying float vFragDepth;
2273	varying float vIsPerspective;
2274#endif`,bxt=`#ifdef USE_LOGDEPTHBUF
2275	vFragDepth = 1.0 + gl_Position.w;
2276	vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
2277#endif`,wxt=`#ifdef USE_MAP
2278	vec4 sampledDiffuseColor = texture2D( map, vMapUv );
2279	#ifdef DECODE_VIDEO_TEXTURE
2280		sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );
2281	
2282	#endif
2283	diffuseColor *= sampledDiffuseColor;
2284#endif`,_xt=`#ifdef USE_MAP
2285	uniform sampler2D map;
2286#endif`,Sxt=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
2287	#if defined( USE_POINTS_UV )
2288		vec2 uv = vUv;
2289	#else
2290		vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
2291	#endif
2292#endif
2293#ifdef USE_MAP
2294	diffuseColor *= texture2D( map, uv );
2295#endif
2296#ifdef USE_ALPHAMAP
2297	diffuseColor.a *= texture2D( alphaMap, uv ).g;
2298#endif`,Nxt=`#if defined( USE_POINTS_UV )
2299	varying vec2 vUv;
2300#else
2301	#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
2302		uniform mat3 uvTransform;
2303	#endif
2304#endif
2305#ifdef USE_MAP
2306	uniform sampler2D map;
2307#endif
2308#ifdef USE_ALPHAMAP
2309	uniform sampler2D alphaMap;
2310#endif`,jxt=`float metalnessFactor = metalness;
2311#ifdef USE_METALNESSMAP
2312	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
2313	metalnessFactor *= texelMetalness.b;
2314#endif`,Cxt=`#ifdef USE_METALNESSMAP
2315	uniform sampler2D metalnessMap;
2316#endif`,kxt=`#ifdef USE_INSTANCING_MORPH
2317	float morphTargetInfluences[ MORPHTARGETS_COUNT ];
2318	float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
2319	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
2320		morphTargetInfluences[i] =  texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
2321	}
2322#endif`,Ext=`#if defined( USE_MORPHCOLORS )
2323	vColor *= morphTargetBaseInfluence;
2324	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
2325		#if defined( USE_COLOR_ALPHA )
2326			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
2327		#elif defined( USE_COLOR )
2328			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
2329		#endif
2330	}
2331#endif`,Axt=`#ifdef USE_MORPHNORMALS
2332	objectNormal *= morphTargetBaseInfluence;
2333	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
2334		if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
2335	}
2336#endif`,Txt=`#ifdef USE_MORPHTARGETS
2337	#ifndef USE_INSTANCING_MORPH
2338		uniform float morphTargetBaseInfluence;
2339		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
2340	#endif
2341	uniform sampler2DArray morphTargetsTexture;
2342	uniform ivec2 morphTargetsTextureSize;
2343	vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
2344		int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
2345		int y = texelIndex / morphTargetsTextureSize.x;
2346		int x = texelIndex - y * morphTargetsTextureSize.x;
2347		ivec3 morphUV = ivec3( x, y, morphTargetIndex );
2348		return texelFetch( morphTargetsTexture, morphUV, 0 );
2349	}
2350#endif`,Mxt=`#ifdef USE_MORPHTARGETS
2351	transformed *= morphTargetBaseInfluence;
2352	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
2353		if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
2354	}
2355#endif`,Pxt=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
2356#ifdef FLAT_SHADED
2357	vec3 fdx = dFdx( vViewPosition );
2358	vec3 fdy = dFdy( vViewPosition );
2359	vec3 normal = normalize( cross( fdx, fdy ) );
2360#else
2361	vec3 normal = normalize( vNormal );
2362	#ifdef DOUBLE_SIDED
2363		normal *= faceDirection;
2364	#endif
2365#endif
2366#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
2367	#ifdef USE_TANGENT
2368		mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
2369	#else
2370		mat3 tbn = getTangentFrame( - vViewPosition, normal,
2371		#if defined( USE_NORMALMAP )
2372			vNormalMapUv
2373		#elif defined( USE_CLEARCOAT_NORMALMAP )
2374			vClearcoatNormalMapUv
2375		#else
2376			vUv
2377		#endif
2378		);
2379	#endif
2380	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
2381		tbn[0] *= faceDirection;
2382		tbn[1] *= faceDirection;
2383	#endif
2384#endif
2385#ifdef USE_CLEARCOAT_NORMALMAP
2386	#ifdef USE_TANGENT
2387		mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
2388	#else
2389		mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
2390	#endif
2391	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
2392		tbn2[0] *= faceDirection;
2393		tbn2[1] *= faceDirection;
2394	#endif
2395#endif
2396vec3 nonPerturbedNormal = normal;`,Oxt=`#ifdef USE_NORMALMAP_OBJECTSPACE
2397	normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
2398	#ifdef FLIP_SIDED
2399		normal = - normal;
2400	#endif
2401	#ifdef DOUBLE_SIDED
2402		normal = normal * faceDirection;
2403	#endif
2404	normal = normalize( normalMatrix * normal );
2405#elif defined( USE_NORMALMAP_TANGENTSPACE )
2406	vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
2407	mapN.xy *= normalScale;
2408	normal = normalize( tbn * mapN );
2409#elif defined( USE_BUMPMAP )
2410	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
2411#endif`,Rxt=`#ifndef FLAT_SHADED
2412	varying vec3 vNormal;
2413	#ifdef USE_TANGENT
2414		varying vec3 vTangent;
2415		varying vec3 vBitangent;
2416	#endif
2417#endif`,Ixt=`#ifndef FLAT_SHADED
2418	varying vec3 vNormal;
2419	#ifdef USE_TANGENT
2420		varying vec3 vTangent;
2421		varying vec3 vBitangent;
2422	#endif
2423#endif`,Dxt=`#ifndef FLAT_SHADED
2424	vNormal = normalize( transformedNormal );
2425	#ifdef USE_TANGENT
2426		vTangent = normalize( transformedTangent );
2427		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
2428	#endif
2429#endif`,Lxt=`#ifdef USE_NORMALMAP
2430	uniform sampler2D normalMap;
2431	uniform vec2 normalScale;
2432#endif
2433#ifdef USE_NORMALMAP_OBJECTSPACE
2434	uniform mat3 normalMatrix;
2435#endif
2436#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
2437	mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
2438		vec3 q0 = dFdx( eye_pos.xyz );
2439		vec3 q1 = dFdy( eye_pos.xyz );
2440		vec2 st0 = dFdx( uv.st );
2441		vec2 st1 = dFdy( uv.st );
2442		vec3 N = surf_norm;
2443		vec3 q1perp = cross( q1, N );
2444		vec3 q0perp = cross( N, q0 );
2445		vec3 T = q1perp * st0.x + q0perp * st1.x;
2446		vec3 B = q1perp * st0.y + q0perp * st1.y;
2447		float det = max( dot( T, T ), dot( B, B ) );
2448		float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
2449		return mat3( T * scale, B * scale, N );
2450	}
2451#endif`,$xt=`#ifdef USE_CLEARCOAT
2452	vec3 clearcoatNormal = nonPerturbedNormal;
2453#endif`,Fxt=`#ifdef USE_CLEARCOAT_NORMALMAP
2454	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
2455	clearcoatMapN.xy *= clearcoatNormalScale;
2456	clearcoatNormal = normalize( tbn2 * clearcoatMapN );
2457#endif`,Uxt=`#ifdef USE_CLEARCOATMAP
2458	uniform sampler2D clearcoatMap;
2459#endif
2460#ifdef USE_CLEARCOAT_NORMALMAP
2461	uniform sampler2D clearcoatNormalMap;
2462	uniform vec2 clearcoatNormalScale;
2463#endif
2464#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2465	uniform sampler2D clearcoatRoughnessMap;
2466#endif`,zxt=`#ifdef USE_IRIDESCENCEMAP
2467	uniform sampler2D iridescenceMap;
2468#endif
2469#ifdef USE_IRIDESCENCE_THICKNESSMAP
2470	uniform sampler2D iridescenceThicknessMap;
2471#endif`,Bxt=`#ifdef OPAQUE
2472diffuseColor.a = 1.0;
2473#endif
2474#ifdef USE_TRANSMISSION
2475diffuseColor.a *= material.transmissionAlpha;
2476#endif
2477gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Vxt=`vec3 packNormalToRGB( const in vec3 normal ) {
2478	return normalize( normal ) * 0.5 + 0.5;
2479}
2480vec3 unpackRGBToNormal( const in vec3 rgb ) {
2481	return 2.0 * rgb.xyz - 1.0;
2482}
2483const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
2484const float Inv255 = 1. / 255.;
2485const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
2486const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
2487const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
2488const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
2489vec4 packDepthToRGBA( const in float v ) {
2490	if( v <= 0.0 )
2491		return vec4( 0., 0., 0., 0. );
2492	if( v >= 1.0 )
2493		return vec4( 1., 1., 1., 1. );
2494	float vuf;
2495	float af = modf( v * PackFactors.a, vuf );
2496	float bf = modf( vuf * ShiftRight8, vuf );
2497	float gf = modf( vuf * ShiftRight8, vuf );
2498	return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
2499}
2500vec3 packDepthToRGB( const in float v ) {
2501	if( v <= 0.0 )
2502		return vec3( 0., 0., 0. );
2503	if( v >= 1.0 )
2504		return vec3( 1., 1., 1. );
2505	float vuf;
2506	float bf = modf( v * PackFactors.b, vuf );
2507	float gf = modf( vuf * ShiftRight8, vuf );
2508	return vec3( vuf * Inv255, gf * PackUpscale, bf );
2509}
2510vec2 packDepthToRG( const in float v ) {
2511	if( v <= 0.0 )
2512		return vec2( 0., 0. );
2513	if( v >= 1.0 )
2514		return vec2( 1., 1. );
2515	float vuf;
2516	float gf = modf( v * 256., vuf );
2517	return vec2( vuf * Inv255, gf );
2518}
2519float unpackRGBAToDepth( const in vec4 v ) {
2520	return dot( v, UnpackFactors4 );
2521}
2522float unpackRGBToDepth( const in vec3 v ) {
2523	return dot( v, UnpackFactors3 );
2524}
2525float unpackRGToDepth( const in vec2 v ) {
2526	return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
2527}
2528vec4 pack2HalfToRGBA( const in vec2 v ) {
2529	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
2530	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
2531}
2532vec2 unpackRGBATo2Half( const in vec4 v ) {
2533	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
2534}
2535float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
2536	return ( viewZ + near ) / ( near - far );
2537}
2538float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
2539	return depth * ( near - far ) - near;
2540}
2541float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
2542	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
2543}
2544float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
2545	return ( near * far ) / ( ( far - near ) * depth - far );
2546}`,Hxt=`#ifdef PREMULTIPLIED_ALPHA
2547	gl_FragColor.rgb *= gl_FragColor.a;
2548#endif`,Wxt=`vec4 mvPosition = vec4( transformed, 1.0 );
2549#ifdef USE_BATCHING
2550	mvPosition = batchingMatrix * mvPosition;
2551#endif
2552#ifdef USE_INSTANCING
2553	mvPosition = instanceMatrix * mvPosition;
2554#endif
2555mvPosition = modelViewMatrix * mvPosition;
2556gl_Position = projectionMatrix * mvPosition;`,Gxt=`#ifdef DITHERING
2557	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
2558#endif`,qxt=`#ifdef DITHERING
2559	vec3 dithering( vec3 color ) {
2560		float grid_position = rand( gl_FragCoord.xy );
2561		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
2562		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
2563		return color + dither_shift_RGB;
2564	}
2565#endif`,Kxt=`float roughnessFactor = roughness;
2566#ifdef USE_ROUGHNESSMAP
2567	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
2568	roughnessFactor *= texelRoughness.g;
2569#endif`,Yxt=`#ifdef USE_ROUGHNESSMAP
2570	uniform sampler2D roughnessMap;
2571#endif`,Xxt=
vendor: 8,887 bytes, lines 2571-2757
2571`#if NUM_SPOT_LIGHT_COORDS > 0
2572	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
2573#endif
2574#if NUM_SPOT_LIGHT_MAPS > 0
2575	uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
2576#endif
2577#ifdef USE_SHADOWMAP
2578	#if NUM_DIR_LIGHT_SHADOWS > 0
2579		uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
2580		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
2581		struct DirectionalLightShadow {
2582			float shadowIntensity;
2583			float shadowBias;
2584			float shadowNormalBias;
2585			float shadowRadius;
2586			vec2 shadowMapSize;
2587		};
2588		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
2589	#endif
2590	#if NUM_SPOT_LIGHT_SHADOWS > 0
2591		uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
2592		struct SpotLightShadow {
2593			float shadowIntensity;
2594			float shadowBias;
2595			float shadowNormalBias;
2596			float shadowRadius;
2597			vec2 shadowMapSize;
2598		};
2599		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
2600	#endif
2601	#if NUM_POINT_LIGHT_SHADOWS > 0
2602		uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
2603		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
2604		struct PointLightShadow {
2605			float shadowIntensity;
2606			float shadowBias;
2607			float shadowNormalBias;
2608			float shadowRadius;
2609			vec2 shadowMapSize;
2610			float shadowCameraNear;
2611			float shadowCameraFar;
2612		};
2613		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
2614	#endif
2615	float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
2616		return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
2617	}
2618	vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
2619		return unpackRGBATo2Half( texture2D( shadow, uv ) );
2620	}
2621	float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
2622		float occlusion = 1.0;
2623		vec2 distribution = texture2DDistribution( shadow, uv );
2624		float hard_shadow = step( compare , distribution.x );
2625		if (hard_shadow != 1.0 ) {
2626			float distance = compare - distribution.x ;
2627			float variance = max( 0.00000, distribution.y * distribution.y );
2628			float softness_probability = variance / (variance + distance * distance );			softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );			occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
2629		}
2630		return occlusion;
2631	}
2632	float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
2633		float shadow = 1.0;
2634		shadowCoord.xyz /= shadowCoord.w;
2635		shadowCoord.z += shadowBias;
2636		bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
2637		bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
2638		if ( frustumTest ) {
2639		#if defined( SHADOWMAP_TYPE_PCF )
2640			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
2641			float dx0 = - texelSize.x * shadowRadius;
2642			float dy0 = - texelSize.y * shadowRadius;
2643			float dx1 = + texelSize.x * shadowRadius;
2644			float dy1 = + texelSize.y * shadowRadius;
2645			float dx2 = dx0 / 2.0;
2646			float dy2 = dy0 / 2.0;
2647			float dx3 = dx1 / 2.0;
2648			float dy3 = dy1 / 2.0;
2649			shadow = (
2650				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
2651				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
2652				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
2653				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
2654				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
2655				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
2656				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
2657				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
2658				texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
2659				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
2660				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
2661				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
2662				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
2663				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
2664				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
2665				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
2666				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
2667			) * ( 1.0 / 17.0 );
2668		#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
2669			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
2670			float dx = texelSize.x;
2671			float dy = texelSize.y;
2672			vec2 uv = shadowCoord.xy;
2673			vec2 f = fract( uv * shadowMapSize + 0.5 );
2674			uv -= f * texelSize;
2675			shadow = (
2676				texture2DCompare( shadowMap, uv, shadowCoord.z ) +
2677				texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
2678				texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
2679				texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
2680				mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
2681					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
2682					 f.x ) +
2683				mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
2684					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
2685					 f.x ) +
2686				mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
2687					 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
2688					 f.y ) +
2689				mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
2690					 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
2691					 f.y ) +
2692				mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
2693						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
2694						  f.x ),
2695					 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
2696						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
2697						  f.x ),
2698					 f.y )
2699			) * ( 1.0 / 9.0 );
2700		#elif defined( SHADOWMAP_TYPE_VSM )
2701			shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
2702		#else
2703			shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
2704		#endif
2705		}
2706		return mix( 1.0, shadow, shadowIntensity );
2707	}
2708	vec2 cubeToUV( vec3 v, float texelSizeY ) {
2709		vec3 absV = abs( v );
2710		float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
2711		absV *= scaleToCube;
2712		v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
2713		vec2 planar = v.xy;
2714		float almostATexel = 1.5 * texelSizeY;
2715		float almostOne = 1.0 - almostATexel;
2716		if ( absV.z >= almostOne ) {
2717			if ( v.z > 0.0 )
2718				planar.x = 4.0 - v.x;
2719		} else if ( absV.x >= almostOne ) {
2720			float signX = sign( v.x );
2721			planar.x = v.z * signX + 2.0 * signX;
2722		} else if ( absV.y >= almostOne ) {
2723			float signY = sign( v.y );
2724			planar.x = v.x + 2.0 * signY + 2.0;
2725			planar.y = v.z * signY - 2.0;
2726		}
2727		return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
2728	}
2729	float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
2730		float shadow = 1.0;
2731		vec3 lightToPosition = shadowCoord.xyz;
2732		
2733		float lightToPositionLength = length( lightToPosition );
2734		if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {
2735			float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );			dp += shadowBias;
2736			vec3 bd3D = normalize( lightToPosition );
2737			vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
2738			#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
2739				vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
2740				shadow = (
2741					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
2742					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
2743					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
2744					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
2745					texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
2746					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
2747					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
2748					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
2749					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
2750				) * ( 1.0 / 9.0 );
2751			#else
2752				shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
2753			#endif
2754		}
2755		return mix( 1.0, shadow, shadowIntensity );
2756	}
2757#endif`,
2757Qxt=`#if NUM_SPOT_LIGHT_COORDS > 0
2758	uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
2759	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
2760#endif
2761#ifdef USE_SHADOWMAP
2762	#if NUM_DIR_LIGHT_SHADOWS > 0
2763		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
2764		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
2765		struct DirectionalLightShadow {
2766			float shadowIntensity;
2767			float shadowBias;
2768			float shadowNormalBias;
2769			float shadowRadius;
2770			vec2 shadowMapSize;
2771		};
2772		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
2773	#endif
2774	#if NUM_SPOT_LIGHT_SHADOWS > 0
2775		struct SpotLightShadow {
2776			float shadowIntensity;
2777			float shadowBias;
2778			float shadowNormalBias;
2779			float shadowRadius;
2780			vec2 shadowMapSize;
2781		};
2782		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
2783	#endif
2784	#if NUM_POINT_LIGHT_SHADOWS > 0
2785		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
2786		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
2787		struct PointLightShadow {
2788			float shadowIntensity;
2789			float shadowBias;
2790			float shadowNormalBias;
2791			float shadowRadius;
2792			vec2 shadowMapSize;
2793			float shadowCameraNear;
2794			float shadowCameraFar;
2795		};
2796		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
2797	#endif
2798#endif`,Jxt=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
2799	vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
2800	vec4 shadowWorldPosition;
2801#endif
2802#if defined( USE_SHADOWMAP )
2803	#if NUM_DIR_LIGHT_SHADOWS > 0
2804		#pragma unroll_loop_start
2805		for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
2806			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
2807			vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
2808		}
2809		#pragma unroll_loop_end
2810	#endif
2811	#if NUM_POINT_LIGHT_SHADOWS > 0
2812		#pragma unroll_loop_start
2813		for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
2814			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
2815			vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
2816		}
2817		#pragma unroll_loop_end
2818	#endif
2819#endif
2820#if NUM_SPOT_LIGHT_COORDS > 0
2821	#pragma unroll_loop_start
2822	for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
2823		shadowWorldPosition = worldPosition;
2824		#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
2825			shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
2826		#endif
2827		vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
2828	}
2829	#pragma unroll_loop_end
2830#endif`,Zxt=`float getShadowMask() {
2831	float shadow = 1.0;
2832	#ifdef USE_SHADOWMAP
2833	#if NUM_DIR_LIGHT_SHADOWS > 0
2834	DirectionalLightShadow directionalLight;
2835	#pragma unroll_loop_start
2836	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
2837		directionalLight = directionalLightShadows[ i ];
2838		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
2839	}
2840	#pragma unroll_loop_end
2841	#endif
2842	#if NUM_SPOT_LIGHT_SHADOWS > 0
2843	SpotLightShadow spotLight;
2844	#pragma unroll_loop_start
2845	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
2846		spotLight = spotLightShadows[ i ];
2847		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
2848	}
2849	#pragma unroll_loop_end
2850	#endif
2851	#if NUM_POINT_LIGHT_SHADOWS > 0
2852	PointLightShadow pointLight;
2853	#pragma unroll_loop_start
2854	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
2855		pointLight = pointLightShadows[ i ];
2856		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
2857	}
2858	#pragma unroll_loop_end
2859	#endif
2860	#endif
2861	return shadow;
2862}`,eyt=`#ifdef USE_SKINNING
2863	mat4 boneMatX = getBoneMatrix( skinIndex.x );
2864	mat4 boneMatY = getBoneMatrix( skinIndex.y );
2865	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
2866	mat4 boneMatW = getBoneMatrix( skinIndex.w );
2867#endif`,tyt=`#ifdef USE_SKINNING
2868	uniform mat4 bindMatrix;
2869	uniform mat4 bindMatrixInverse;
2870	uniform highp sampler2D boneTexture;
2871	mat4 getBoneMatrix( const in float i ) {
2872		int size = textureSize( boneTexture, 0 ).x;
2873		int j = int( i ) * 4;
2874		int x = j % size;
2875		int y = j / size;
2876		vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
2877		vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
2878		vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
2879		vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
2880		return mat4( v1, v2, v3, v4 );
2881	}
2882#endif`,nyt=`#ifdef USE_SKINNING
2883	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
2884	vec4 skinned = vec4( 0.0 );
2885	skinned += boneMatX * skinVertex * skinWeight.x;
2886	skinned += boneMatY * skinVertex * skinWeight.y;
2887	skinned += boneMatZ * skinVertex * skinWeight.z;
2888	skinned += boneMatW * skinVertex * skinWeight.w;
2889	transformed = ( bindMatrixInverse * skinned ).xyz;
2890#endif`,ryt=`#ifdef USE_SKINNING
2891	mat4 skinMatrix = mat4( 0.0 );
2892	skinMatrix += skinWeight.x * boneMatX;
2893	skinMatrix += skinWeight.y * boneMatY;
2894	skinMatrix += skinWeight.z * boneMatZ;
2895	skinMatrix += skinWeight.w * boneMatW;
2896	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
2897	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
2898	#ifdef USE_TANGENT
2899		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
2900	#endif
2901#endif`,iyt=`float specularStrength;
2902#ifdef USE_SPECULARMAP
2903	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
2904	specularStrength = texelSpecular.r;
2905#else
2906	specularStrength = 1.0;
2907#endif`,syt=`#ifdef USE_SPECULARMAP
2908	uniform sampler2D specularMap;
2909#endif`,ayt=`#if defined( TONE_MAPPING )
2910	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
2911#endif`,oyt=`#ifndef saturate
2912#define saturate( a ) clamp( a, 0.0, 1.0 )
2913#endif
2914uniform float toneMappingExposure;
2915vec3 LinearToneMapping( vec3 color ) {
2916	return saturate( toneMappingExposure * color );
2917}
2918vec3 ReinhardToneMapping( vec3 color ) {
2919	color *= toneMappingExposure;
2920	return saturate( color / ( vec3( 1.0 ) + color ) );
2921}
2922vec3 OptimizedCineonToneMapping( vec3 color ) {
2923	color *= toneMappingExposure;
2924	color = max( vec3( 0.0 ), color - 0.004 );
2925	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
2926}
2927vec3 RRTAndODTFit( vec3 v ) {
2928	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
2929	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
2930	return a / b;
2931}
2932vec3 ACESFilmicToneMapping( vec3 color ) {
2933	const mat3 ACESInputMat = mat3(
2934		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
2935		vec3( 0.04823, 0.01566, 0.83777 )
2936	);
2937	const mat3 ACESOutputMat = mat3(
2938		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
2939		vec3( -0.07367, -0.00605,  1.07602 )
2940	);
2941	color *= toneMappingExposure / 0.6;
2942	color = ACESInputMat * color;
2943	color = RRTAndODTFit( color );
2944	color = ACESOutputMat * color;
2945	return saturate( color );
2946}
2947const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
2948	vec3( 1.6605, - 0.1246, - 0.0182 ),
2949	vec3( - 0.5876, 1.1329, - 0.1006 ),
2950	vec3( - 0.0728, - 0.0083, 1.1187 )
2951);
2952const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
2953	vec3( 0.6274, 0.0691, 0.0164 ),
2954	vec3( 0.3293, 0.9195, 0.0880 ),
2955	vec3( 0.0433, 0.0113, 0.8956 )
2956);
2957vec3 agxDefaultContrastApprox( vec3 x ) {
2958	vec3 x2 = x * x;
2959	vec3 x4 = x2 * x2;
2960	return + 15.5 * x4 * x2
2961		- 40.14 * x4 * x
2962		+ 31.96 * x4
2963		- 6.868 * x2 * x
2964		+ 0.4298 * x2
2965		+ 0.1191 * x
2966		- 0.00232;
2967}
2968vec3 AgXToneMapping( vec3 color ) {
2969	const mat3 AgXInsetMatrix = mat3(
2970		vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
2971		vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
2972		vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
2973	);
2974	const mat3 AgXOutsetMatrix = mat3(
2975		vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
2976		vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
2977		vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
2978	);
2979	const float AgxMinEv = - 12.47393;	const float AgxMaxEv = 4.026069;
2980	color *= toneMappingExposure;
2981	color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
2982	color = AgXInsetMatrix * color;
2983	color = max( color, 1e-10 );	color = log2( color );
2984	color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
2985	color = clamp( color, 0.0, 1.0 );
2986	color = agxDefaultContrastApprox( color );
2987	color = AgXOutsetMatrix * color;
2988	color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
2989	color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
2990	color = clamp( color, 0.0, 1.0 );
2991	return color;
2992}
2993vec3 NeutralToneMapping( vec3 color ) {
2994	const float StartCompression = 0.8 - 0.04;
2995	const float Desaturation = 0.15;
2996	color *= toneMappingExposure;
2997	float x = min( color.r, min( color.g, color.b ) );
2998	float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
2999	color -= offset;
3000	float peak = max( color.r, max( color.g, color.b ) );
3001	if ( peak < StartCompression ) return color;
3002	float d = 1. - StartCompression;
3003	float newPeak = 1. - d * d / ( peak + d - StartCompression );
3004	color *= newPeak / peak;
3005	float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
3006	return mix( color, vec3( newPeak ), g );
3007}
3008vec3 CustomToneMapping( vec3 color ) { return color; }`,lyt=`#ifdef USE_TRANSMISSION
3009	material.transmission = transmission;
3010	material.transmissionAlpha = 1.0;
3011	material.thickness = thickness;
3012	material.attenuationDistance = attenuationDistance;
3013	material.attenuationColor = attenuationColor;
3014	#ifdef USE_TRANSMISSIONMAP
3015		material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
3016	#endif
3017	#ifdef USE_THICKNESSMAP
3018		material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
3019	#endif
3020	vec3 pos = vWorldPosition;
3021	vec3 v = normalize( cameraPosition - pos );
3022	vec3 n = inverseTransformDirection( normal, viewMatrix );
3023	vec4 transmitted = getIBLVolumeRefraction(
3024		n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
3025		pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
3026		material.attenuationColor, material.attenuationDistance );
3027	material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
3028	totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
3029#endif`,cyt=`#ifdef USE_TRANSMISSION
3030	uniform float transmission;
3031	uniform float thickness;
3032	uniform float attenuationDistance;
3033	uniform vec3 attenuationColor;
3034	#ifdef USE_TRANSMISSIONMAP
3035		uniform sampler2D transmissionMap;
3036	#endif
3037	#ifdef USE_THICKNESSMAP
3038		uniform sampler2D thicknessMap;
3039	#endif
3040	uniform vec2 transmissionSamplerSize;
3041	uniform sampler2D transmissionSamplerMap;
3042	uniform mat4 modelMatrix;
3043	uniform mat4 projectionMatrix;
3044	varying vec3 vWorldPosition;
3045	float w0( float a ) {
3046		return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
3047	}
3048	float w1( float a ) {
3049		return ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );
3050	}
3051	float w2( float a ){
3052		return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
3053	}
3054	float w3( float a ) {
3055		return ( 1.0 / 6.0 ) * ( a * a * a );
3056	}
3057	float g0( float a ) {
3058		return w0( a ) + w1( a );
3059	}
3060	float g1( float a ) {
3061		return w2( a ) + w3( a );
3062	}
3063	float h0( float a ) {
3064		return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
3065	}
3066	float h1( float a ) {
3067		return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
3068	}
3069	vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
3070		uv = uv * texelSize.zw + 0.5;
3071		vec2 iuv = floor( uv );
3072		vec2 fuv = fract( uv );
3073		float g0x = g0( fuv.x );
3074		float g1x = g1( fuv.x );
3075		float h0x = h0( fuv.x );
3076		float h1x = h1( fuv.x );
3077		float h0y = h0( fuv.y );
3078		float h1y = h1( fuv.y );
3079		vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
3080		vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
3081		vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
3082		vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
3083		return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
3084			g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
3085	}
3086	vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
3087		vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
3088		vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
3089		vec2 fLodSizeInv = 1.0 / fLodSize;
3090		vec2 cLodSizeInv = 1.0 / cLodSize;
3091		vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
3092		vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
3093		return mix( fSample, cSample, fract( lod ) );
3094	}
3095	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
3096		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
3097		vec3 modelScale;
3098		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
3099		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
3100		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
3101		return normalize( refractionVector ) * thickness * modelScale;
3102	}
3103	float applyIorToRoughness( const in float roughness, const in float ior ) {
3104		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
3105	}
3106	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
3107		float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
3108		return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
3109	}
3110	vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
3111		if ( isinf( attenuationDistance ) ) {
3112			return vec3( 1.0 );
3113		} else {
3114			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
3115			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance;
3116		}
3117	}
3118	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
3119		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
3120		const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
3121		const in vec3 attenuationColor, const in float attenuationDistance ) {
3122		vec4 transmittedLight;
3123		vec3 transmittance;
3124		#ifdef USE_DISPERSION
3125			float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
3126			vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
3127			for ( int i = 0; i < 3; i ++ ) {
3128				vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
3129				vec3 refractedRayExit = position + transmissionRay;
3130		
3131				vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
3132				vec2 refractionCoords = ndcPos.xy / ndcPos.w;
3133				refractionCoords += 1.0;
3134				refractionCoords /= 2.0;
3135		
3136				vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
3137				transmittedLight[ i ] = transmissionSample[ i ];
3138				transmittedLight.a += transmissionSample.a;
3139				transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
3140			}
3141			transmittedLight.a /= 3.0;
3142		
3143		#else
3144		
3145			vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
3146			vec3 refractedRayExit = position + transmissionRay;
3147			vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
3148			vec2 refractionCoords = ndcPos.xy / ndcPos.w;
3149			refractionCoords += 1.0;
3150			refractionCoords /= 2.0;
3151			transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
3152			transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
3153		
3154		#endif
3155		vec3 attenuatedColor = transmittance * transmittedLight.rgb;
3156		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
3157		float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
3158		return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
3159	}
3160#endif`,uyt=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
3161	varying vec2 vUv;
3162#endif
3163#ifdef USE_MAP
3164	varying vec2 vMapUv;
3165#endif
3166#ifdef USE_ALPHAMAP
3167	varying vec2 vAlphaMapUv;
3168#endif
3169#ifdef USE_LIGHTMAP
3170	varying vec2 vLightMapUv;
3171#endif
3172#ifdef USE_AOMAP
3173	varying vec2 vAoMapUv;
3174#endif
3175#ifdef USE_BUMPMAP
3176	varying vec2 vBumpMapUv;
3177#endif
3178#ifdef USE_NORMALMAP
3179	varying vec2 vNormalMapUv;
3180#endif
3181#ifdef USE_EMISSIVEMAP
3182	varying vec2 vEmissiveMapUv;
3183#endif
3184#ifdef USE_METALNESSMAP
3185	varying vec2 vMetalnessMapUv;
3186#endif
3187#ifdef USE_ROUGHNESSMAP
3188	varying vec2 vRoughnessMapUv;
3189#endif
3190#ifdef USE_ANISOTROPYMAP
3191	varying vec2 vAnisotropyMapUv;
3192#endif
3193#ifdef USE_CLEARCOATMAP
3194	varying vec2 vClearcoatMapUv;
3195#endif
3196#ifdef USE_CLEARCOAT_NORMALMAP
3197	varying vec2 vClearcoatNormalMapUv;
3198#endif
3199#ifdef USE_CLEARCOAT_ROUGHNESSMAP
3200	varying vec2 vClearcoatRoughnessMapUv;
3201#endif
3202#ifdef USE_IRIDESCENCEMAP
3203	varying vec2 vIridescenceMapUv;
3204#endif
3205#ifdef USE_IRIDESCENCE_THICKNESSMAP
3206	varying vec2 vIridescenceThicknessMapUv;
3207#endif
3208#ifdef USE_SHEEN_COLORMAP
3209	varying vec2 vSheenColorMapUv;
3210#endif
3211#ifdef USE_SHEEN_ROUGHNESSMAP
3212	varying vec2 vSheenRoughnessMapUv;
3213#endif
3214#ifdef USE_SPECULARMAP
3215	varying vec2 vSpecularMapUv;
3216#endif
3217#ifdef USE_SPECULAR_COLORMAP
3218	varying vec2 vSpecularColorMapUv;
3219#endif
3220#ifdef USE_SPECULAR_INTENSITYMAP
3221	varying vec2 vSpecularIntensityMapUv;
3222#endif
3223#ifdef USE_TRANSMISSIONMAP
3224	uniform mat3 transmissionMapTransform;
3225	varying vec2 vTransmissionMapUv;
3226#endif
3227#ifdef USE_THICKNESSMAP
3228	uniform mat3 thicknessMapTransform;
3229	varying vec2 vThicknessMapUv;
3230#endif`,dyt=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
3231	varying vec2 vUv;
3232#endif
3233#ifdef USE_MAP
3234	uniform mat3 mapTransform;
3235	varying vec2 vMapUv;
3236#endif
3237#ifdef USE_ALPHAMAP
3238	uniform mat3 alphaMapTransform;
3239	varying vec2 vAlphaMapUv;
3240#endif
3241#ifdef USE_LIGHTMAP
3242	uniform mat3 lightMapTransform;
3243	varying vec2 vLightMapUv;
3244#endif
3245#ifdef USE_AOMAP
3246	uniform mat3 aoMapTransform;
3247	varying vec2 vAoMapUv;
3248#endif
3249#ifdef USE_BUMPMAP
3250	uniform mat3 bumpMapTransform;
3251	varying vec2 vBumpMapUv;
3252#endif
3253#ifdef USE_NORMALMAP
3254	uniform mat3 normalMapTransform;
3255	varying vec2 vNormalMapUv;
3256#endif
3257#ifdef USE_DISPLACEMENTMAP
3258	uniform mat3 displacementMapTransform;
3259	varying vec2 vDisplacementMapUv;
3260#endif
3261#ifdef USE_EMISSIVEMAP
3262	uniform mat3 emissiveMapTransform;
3263	varying vec2 vEmissiveMapUv;
3264#endif
3265#ifdef USE_METALNESSMAP
3266	uniform mat3 metalnessMapTransform;
3267	varying vec2 vMetalnessMapUv;
3268#endif
3269#ifdef USE_ROUGHNESSMAP
3270	uniform mat3 roughnessMapTransform;
3271	varying vec2 vRoughnessMapUv;
3272#endif
3273#ifdef USE_ANISOTROPYMAP
3274	uniform mat3 anisotropyMapTransform;
3275	varying vec2 vAnisotropyMapUv;
3276#endif
3277#ifdef USE_CLEARCOATMAP
3278	uniform mat3 clearcoatMapTransform;
3279	varying vec2 vClearcoatMapUv;
3280#endif
3281#ifdef USE_CLEARCOAT_NORMALMAP
3282	uniform mat3 clearcoatNormalMapTransform;
3283	varying vec2 vClearcoatNormalMapUv;
3284#endif
3285#ifdef USE_CLEARCOAT_ROUGHNESSMAP
3286	uniform mat3 clearcoatRoughnessMapTransform;
3287	varying vec2 vClearcoatRoughnessMapUv;
3288#endif
3289#ifdef USE_SHEEN_COLORMAP
3290	uniform mat3 sheenColorMapTransform;
3291	varying vec2 vSheenColorMapUv;
3292#endif
3293#ifdef USE_SHEEN_ROUGHNESSMAP
3294	uniform mat3 sheenRoughnessMapTransform;
3295	varying vec2 vSheenRoughnessMapUv;
3296#endif
3297#ifdef USE_IRIDESCENCEMAP
3298	uniform mat3 iridescenceMapTransform;
3299	varying vec2 vIridescenceMapUv;
3300#endif
3301#ifdef USE_IRIDESCENCE_THICKNESSMAP
3302	uniform mat3 iridescenceThicknessMapTransform;
3303	varying vec2 vIridescenceThicknessMapUv;
3304#endif
3305#ifdef USE_SPECULARMAP
3306	uniform mat3 specularMapTransform;
3307	varying vec2 vSpecularMapUv;
3308#endif
3309#ifdef USE_SPECULAR_COLORMAP
3310	uniform mat3 specularColorMapTransform;
3311	varying vec2 vSpecularColorMapUv;
3312#endif
3313#ifdef USE_SPECULAR_INTENSITYMAP
3314	uniform mat3 specularIntensityMapTransform;
3315	varying vec2 vSpecularIntensityMapUv;
3316#endif
3317#ifdef USE_TRANSMISSIONMAP
3318	uniform mat3 transmissionMapTransform;
3319	varying vec2 vTransmissionMapUv;
3320#endif
3321#ifdef USE_THICKNESSMAP
3322	uniform mat3 thicknessMapTransform;
3323	varying vec2 vThicknessMapUv;
3324#endif`,fyt=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
3325	vUv = vec3( uv, 1 ).xy;
3326#endif
3327#ifdef USE_MAP
3328	vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
3329#endif
3330#ifdef USE_ALPHAMAP
3331	vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
3332#endif
3333#ifdef USE_LIGHTMAP
3334	vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
3335#endif
3336#ifdef USE_AOMAP
3337	vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
3338#endif
3339#ifdef USE_BUMPMAP
3340	vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
3341#endif
3342#ifdef USE_NORMALMAP
3343	vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
3344#endif
3345#ifdef USE_DISPLACEMENTMAP
3346	vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
3347#endif
3348#ifdef USE_EMISSIVEMAP
3349	vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
3350#endif
3351#ifdef USE_METALNESSMAP
3352	vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
3353#endif
3354#ifdef USE_ROUGHNESSMAP
3355	vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
3356#endif
3357#ifdef USE_ANISOTROPYMAP
3358	vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
3359#endif
3360#ifdef USE_CLEARCOATMAP
3361	vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
3362#endif
3363#ifdef USE_CLEARCOAT_NORMALMAP
3364	vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
3365#endif
3366#ifdef USE_CLEARCOAT_ROUGHNESSMAP
3367	vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
3368#endif
3369#ifdef USE_IRIDESCENCEMAP
3370	vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
3371#endif
3372#ifdef USE_IRIDESCENCE_THICKNESSMAP
3373	vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
3374#endif
3375#ifdef USE_SHEEN_COLORMAP
3376	vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
3377#endif
3378#ifdef USE_SHEEN_ROUGHNESSMAP
3379	vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
3380#endif
3381#ifdef USE_SPECULARMAP
3382	vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
3383#endif
3384#ifdef USE_SPECULAR_COLORMAP
3385	vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
3386#endif
3387#ifdef USE_SPECULAR_INTENSITYMAP
3388	vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
3389#endif
3390#ifdef USE_TRANSMISSIONMAP
3391	vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
3392#endif
3393#ifdef USE_THICKNESSMAP
3394	vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
3395#endif`,hyt=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
3396	vec4 worldPosition = vec4( transformed, 1.0 );
3397	#ifdef USE_BATCHING
3398		worldPosition = batchingMatrix * worldPosition;
3399	#endif
3400	#ifdef USE_INSTANCING
3401		worldPosition = instanceMatrix * worldPosition;
3402	#endif
3403	worldPosition = modelMatrix * worldPosition;
3404#endif`;const pyt=`varying vec2 vUv;
3405uniform mat3 uvTransform;
3406void main() {
3407	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
3408	gl_Position = vec4( position.xy, 1.0, 1.0 );
3409}`,myt=`uniform sampler2D t2D;
3410uniform float backgroundIntensity;
3411varying vec2 vUv;
3412void main() {
3413	vec4 texColor = texture2D( t2D, vUv );
3414	#ifdef DECODE_VIDEO_TEXTURE
3415		texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
3416	#endif
3417	texColor.rgb *= backgroundIntensity;
3418	gl_FragColor = texColor;
3419	#include <tonemapping_fragment>
3420	#include <colorspace_fragment>
3421}`,gyt=`varying vec3 vWorldDirection;
3422#include <common>
3423void main() {
3424	vWorldDirection = transformDirection( position, modelMatrix );
3425	#include <begin_vertex>
3426	#include <project_vertex>
3427	gl_Position.z = gl_Position.w;
3428}`,xyt=`#ifdef ENVMAP_TYPE_CUBE
3429	uniform samplerCube envMap;
3430#elif defined( ENVMAP_TYPE_CUBE_UV )
3431	uniform sampler2D envMap;
3432#endif
3433uniform float flipEnvMap;
3434uniform float backgroundBlurriness;
3435uniform float backgroundIntensity;
3436uniform mat3 backgroundRotation;
3437varying vec3 vWorldDirection;
3438#include <cube_uv_reflection_fragment>
3439void main() {
3440	#ifdef ENVMAP_TYPE_CUBE
3441		vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
3442	#elif defined( ENVMAP_TYPE_CUBE_UV )
3443		vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
3444	#else
3445		vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
3446	#endif
3447	texColor.rgb *= backgroundIntensity;
3448	gl_FragColor = texColor;
3449	#include <tonemapping_fragment>
3450	#include <colorspace_fragment>
3451}`,yyt=`varying vec3 vWorldDirection;
3452#include <common>
3453void main() {
3454	vWorldDirection = transformDirection( position, modelMatrix );
3455	#include <begin_vertex>
3456	#include <project_vertex>
3457	gl_Position.z = gl_Position.w;
3458}`,vyt=`uniform samplerCube tCube;
3459uniform float tFlip;
3460uniform float opacity;
3461varying vec3 vWorldDirection;
3462void main() {
3463	vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
3464	gl_FragColor = texColor;
3465	gl_FragColor.a *= opacity;
3466	#include <tonemapping_fragment>
3467	#include <colorspace_fragment>
3468}`,byt=`#include <common>
3469#include <batching_pars_vertex>
3470#include <uv_pars_vertex>
3471#include <displacementmap_pars_vertex>
3472#include <morphtarget_pars_vertex>
3473#include <skinning_pars_vertex>
3474#include <logdepthbuf_pars_vertex>
3475#include <clipping_planes_pars_vertex>
3476varying vec2 vHighPrecisionZW;
3477void main() {
3478	#include <uv_vertex>
3479	#include <batching_vertex>
3480	#include <skinbase_vertex>
3481	#include <morphinstance_vertex>
3482	#ifdef USE_DISPLACEMENTMAP
3483		#include <beginnormal_vertex>
3484		#include <morphnormal_vertex>
3485		#include <skinnormal_vertex>
3486	#endif
3487	#include <begin_vertex>
3488	#include <morphtarget_vertex>
3489	#include <skinning_vertex>
3490	#include <displacementmap_vertex>
3491	#include <project_vertex>
3492	#include <logdepthbuf_vertex>
3493	#include <clipping_planes_vertex>
3494	vHighPrecisionZW = gl_Position.zw;
3495}`,wyt=`#if DEPTH_PACKING == 3200
3496	uniform float opacity;
3497#endif
3498#include <common>
3499#include <packing>
3500#include <uv_pars_fragment>
3501#include <map_pars_fragment>
3502#include <alphamap_pars_fragment>
3503#include <alphatest_pars_fragment>
3504#include <alphahash_pars_fragment>
3505#include <logdepthbuf_pars_fragment>
3506#include <clipping_planes_pars_fragment>
3507varying vec2 vHighPrecisionZW;
3508void main() {
3509	vec4 diffuseColor = vec4( 1.0 );
3510	#include <clipping_planes_fragment>
3511	#if DEPTH_PACKING == 3200
3512		diffuseColor.a = opacity;
3513	#endif
3514	#include <map_fragment>
3515	#include <alphamap_fragment>
3516	#include <alphatest_fragment>
3517	#include <alphahash_fragment>
3518	#include <logdepthbuf_fragment>
3519	float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
3520	#if DEPTH_PACKING == 3200
3521		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
3522	#elif DEPTH_PACKING == 3201
3523		gl_FragColor = packDepthToRGBA( fragCoordZ );
3524	#elif DEPTH_PACKING == 3202
3525		gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
3526	#elif DEPTH_PACKING == 3203
3527		gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
3528	#endif
3529}`,_yt=`#define DISTANCE
3530varying vec3 vWorldPosition;
3531#include <common>
3532#include <batching_pars_vertex>
3533#include <uv_pars_vertex>
3534#include <displacementmap_pars_vertex>
3535#include <morphtarget_pars_vertex>
3536#include <skinning_pars_vertex>
3537#include <clipping_planes_pars_vertex>
3538void main() {
3539	#include <uv_vertex>
3540	#include <batching_vertex>
3541	#include <skinbase_vertex>
3542	#include <morphinstance_vertex>
3543	#ifdef USE_DISPLACEMENTMAP
3544		#include <beginnormal_vertex>
3545		#include <morphnormal_vertex>
3546		#include <skinnormal_vertex>
3547	#endif
3548	#include <begin_vertex>
3549	#include <morphtarget_vertex>
3550	#include <skinning_vertex>
3551	#include <displacementmap_vertex>
3552	#include <project_vertex>
3553	#include <worldpos_vertex>
3554	#include <clipping_planes_vertex>
3555	vWorldPosition = worldPosition.xyz;
3556}`,Syt=`#define DISTANCE
3557uniform vec3 referencePosition;
3558uniform float nearDistance;
3559uniform float farDistance;
3560varying vec3 vWorldPosition;
3561#include <common>
3562#include <packing>
3563#include <uv_pars_fragment>
3564#include <map_pars_fragment>
3565#include <alphamap_pars_fragment>
3566#include <alphatest_pars_fragment>
3567#include <alphahash_pars_fragment>
3568#include <clipping_planes_pars_fragment>
3569void main () {
3570	vec4 diffuseColor = vec4( 1.0 );
3571	#include <clipping_planes_fragment>
3572	#include <map_fragment>
3573	#include <alphamap_fragment>
3574	#include <alphatest_fragment>
3575	#include <alphahash_fragment>
3576	float dist = length( vWorldPosition - referencePosition );
3577	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
3578	dist = saturate( dist );
3579	gl_FragColor = packDepthToRGBA( dist );
3580}`,Nyt=`varying vec3 vWorldDirection;
3581#include <common>
3582void main() {
3583	vWorldDirection = transformDirection( position, modelMatrix );
3584	#include <begin_vertex>
3585	#include <project_vertex>
3586}`,jyt=`uniform sampler2D tEquirect;
3587varying vec3 vWorldDirection;
3588#include <common>
3589void main() {
3590	vec3 direction = normalize( vWorldDirection );
3591	vec2 sampleUV = equirectUv( direction );
3592	gl_FragColor = texture2D( tEquirect, sampleUV );
3593	#include <tonemapping_fragment>
3594	#include <colorspace_fragment>
3595}`,Cyt=`uniform float scale;
3596attribute float lineDistance;
3597varying float vLineDistance;
3598#include <common>
3599#include <uv_pars_vertex>
3600#include <color_pars_vertex>
3601#include <fog_pars_vertex>
3602#include <morphtarget_pars_vertex>
3603#include <logdepthbuf_pars_vertex>
3604#include <clipping_planes_pars_vertex>
3605void main() {
3606	vLineDistance = scale * lineDistance;
3607	#include <uv_vertex>
3608	#include <color_vertex>
3609	#include <morphinstance_vertex>
3610	#include <morphcolor_vertex>
3611	#include <begin_vertex>
3612	#include <morphtarget_vertex>
3613	#include <project_vertex>
3614	#include <logdepthbuf_vertex>
3615	#include <clipping_planes_vertex>
3616	#include <fog_vertex>
3617}`,kyt=`uniform vec3 diffuse;
3618uniform float opacity;
3619uniform float dashSize;
3620uniform float totalSize;
3621varying float vLineDistance;
3622#include <common>
3623#include <color_pars_fragment>
3624#include <uv_pars_fragment>
3625#include <map_pars_fragment>
3626#include <fog_pars_fragment>
3627#include <logdepthbuf_pars_fragment>
3628#include <clipping_planes_pars_fragment>
3629void main() {
3630	vec4 diffuseColor = vec4( diffuse, opacity );
3631	#include <clipping_planes_fragment>
3632	if ( mod( vLineDistance, totalSize ) > dashSize ) {
3633		discard;
3634	}
3635	vec3 outgoingLight = vec3( 0.0 );
3636	#include <logdepthbuf_fragment>
3637	#include <map_fragment>
3638	#include <color_fragment>
3639	outgoingLight = diffuseColor.rgb;
3640	#include <opaque_fragment>
3641	#include <tonemapping_fragment>
3642	#include <colorspace_fragment>
3643	#include <fog_fragment>
3644	#include <premultiplied_alpha_fragment>
3645}`,Eyt=`#include <common>
3646#include <batching_pars_vertex>
3647#include <uv_pars_vertex>
3648#include <envmap_pars_vertex>
3649#include <color_pars_vertex>
3650#include <fog_pars_vertex>
3651#include <morphtarget_pars_vertex>
3652#include <skinning_pars_vertex>
3653#include <logdepthbuf_pars_vertex>
3654#include <clipping_planes_pars_vertex>
3655void main() {
3656	#include <uv_vertex>
3657	#include <color_vertex>
3658	#include <morphinstance_vertex>
3659	#include <morphcolor_vertex>
3660	#include <batching_vertex>
3661	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
3662		#include <beginnormal_vertex>
3663		#include <morphnormal_vertex>
3664		#include <skinbase_vertex>
3665		#include <skinnormal_vertex>
3666		#include <defaultnormal_vertex>
3667	#endif
3668	#include <begin_vertex>
3669	#include <morphtarget_vertex>
3670	#include <skinning_vertex>
3671	#include <project_vertex>
3672	#include <logdepthbuf_vertex>
3673	#include <clipping_planes_vertex>
3674	#include <worldpos_vertex>
3675	#include <envmap_vertex>
3676	#include <fog_vertex>
3677}`,Ayt=`uniform vec3 diffuse;
3678uniform float opacity;
3679#ifndef FLAT_SHADED
3680	varying vec3 vNormal;
3681#endif
3682#include <common>
3683#include <dithering_pars_fragment>
3684#include <color_pars_fragment>
3685#include <uv_pars_fragment>
3686#include <map_pars_fragment>
3687#include <alphamap_pars_fragment>
3688#include <alphatest_pars_fragment>
3689#include <alphahash_pars_fragment>
3690#include <aomap_pars_fragment>
3691#include <lightmap_pars_fragment>
3692#include <envmap_common_pars_fragment>
3693#include <envmap_pars_fragment>
3694#include <fog_pars_fragment>
3695#include <specularmap_pars_fragment>
3696#include <logdepthbuf_pars_fragment>
3697#include <clipping_planes_pars_fragment>
3698void main() {
3699	vec4 diffuseColor = vec4( diffuse, opacity );
3700	#include <clipping_planes_fragment>
3701	#include <logdepthbuf_fragment>
3702	#include <map_fragment>
3703	#include <color_fragment>
3704	#include <alphamap_fragment>
3705	#include <alphatest_fragment>
3706	#include <alphahash_fragment>
3707	#include <specularmap_fragment>
3708	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3709	#ifdef USE_LIGHTMAP
3710		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
3711		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
3712	#else
3713		reflectedLight.indirectDiffuse += vec3( 1.0 );
3714	#endif
3715	#include <aomap_fragment>
3716	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
3717	vec3 outgoingLight = reflectedLight.indirectDiffuse;
3718	#include <envmap_fragment>
3719	#include <opaque_fragment>
3720	#include <tonemapping_fragment>
3721	#include <colorspace_fragment>
3722	#include <fog_fragment>
3723	#include <premultiplied_alpha_fragment>
3724	#include <dithering_fragment>
3725}`,Tyt=`#define LAMBERT
3726varying vec3 vViewPosition;
3727#include <common>
3728#include <batching_pars_vertex>
3729#include <uv_pars_vertex>
3730#include <displacementmap_pars_vertex>
3731#include <envmap_pars_vertex>
3732#include <color_pars_vertex>
3733#include <fog_pars_vertex>
3734#include <normal_pars_vertex>
3735#include <morphtarget_pars_vertex>
3736#include <skinning_pars_vertex>
3737#include <shadowmap_pars_vertex>
3738#include <logdepthbuf_pars_vertex>
3739#include <clipping_planes_pars_vertex>
3740void main() {
3741	#include <uv_vertex>
3742	#include <color_vertex>
3743	#include <morphinstance_vertex>
3744	#include <morphcolor_vertex>
3745	#include <batching_vertex>
3746	#include <beginnormal_vertex>
3747	#include <morphnormal_vertex>
3748	#include <skinbase_vertex>
3749	#include <skinnormal_vertex>
3750	#include <defaultnormal_vertex>
3751	#include <normal_vertex>
3752	#include <begin_vertex>
3753	#include <morphtarget_vertex>
3754	#include <skinning_vertex>
3755	#include <displacementmap_vertex>
3756	#include <project_vertex>
3757	#include <logdepthbuf_vertex>
3758	#include <clipping_planes_vertex>
3759	vViewPosition = - mvPosition.xyz;
3760	#include <worldpos_vertex>
3761	#include <envmap_vertex>
3762	#include <shadowmap_vertex>
3763	#include <fog_vertex>
3764}`,Myt=`#define LAMBERT
3765uniform vec3 diffuse;
3766uniform vec3 emissive;
3767uniform float opacity;
3768#include <common>
3769#include <packing>
3770#include <dithering_pars_fragment>
3771#include <color_pars_fragment>
3772#include <uv_pars_fragment>
3773#include <map_pars_fragment>
3774#include <alphamap_pars_fragment>
3775#include <alphatest_pars_fragment>
3776#include <alphahash_pars_fragment>
3777#include <aomap_pars_fragment>
3778#include <lightmap_pars_fragment>
3779#include <emissivemap_pars_fragment>
3780#include <envmap_common_pars_fragment>
3781#include <envmap_pars_fragment>
3782#include <fog_pars_fragment>
3783#include <bsdfs>
3784#include <lights_pars_begin>
3785#include <normal_pars_fragment>
3786#include <lights_lambert_pars_fragment>
3787#include <shadowmap_pars_fragment>
3788#include <bumpmap_pars_fragment>
3789#include <normalmap_pars_fragment>
3790#include <specularmap_pars_fragment>
3791#include <logdepthbuf_pars_fragment>
3792#include <clipping_planes_pars_fragment>
3793void main() {
3794	vec4 diffuseColor = vec4( diffuse, opacity );
3795	#include <clipping_planes_fragment>
3796	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3797	vec3 totalEmissiveRadiance = emissive;
3798	#include <logdepthbuf_fragment>
3799	#include <map_fragment>
3800	#include <color_fragment>
3801	#include <alphamap_fragment>
3802	#include <alphatest_fragment>
3803	#include <alphahash_fragment>
3804	#include <specularmap_fragment>
3805	#include <normal_fragment_begin>
3806	#include <normal_fragment_maps>
3807	#include <emissivemap_fragment>
3808	#include <lights_lambert_fragment>
3809	#include <lights_fragment_begin>
3810	#include <lights_fragment_maps>
3811	#include <lights_fragment_end>
3812	#include <aomap_fragment>
3813	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
3814	#include <envmap_fragment>
3815	#include <opaque_fragment>
3816	#include <tonemapping_fragment>
3817	#include <colorspace_fragment>
3818	#include <fog_fragment>
3819	#include <premultiplied_alpha_fragment>
3820	#include <dithering_fragment>
3821}`,Pyt=`#define MATCAP
3822varying vec3 vViewPosition;
3823#include <common>
3824#include <batching_pars_vertex>
3825#include <uv_pars_vertex>
3826#include <color_pars_vertex>
3827#include <displacementmap_pars_vertex>
3828#include <fog_pars_vertex>
3829#include <normal_pars_vertex>
3830#include <morphtarget_pars_vertex>
3831#include <skinning_pars_vertex>
3832#include <logdepthbuf_pars_vertex>
3833#include <clipping_planes_pars_vertex>
3834void main() {
3835	#include <uv_vertex>
3836	#include <color_vertex>
3837	#include <morphinstance_vertex>
3838	#include <morphcolor_vertex>
3839	#include <batching_vertex>
3840	#include <beginnormal_vertex>
3841	#include <morphnormal_vertex>
3842	#include <skinbase_vertex>
3843	#include <skinnormal_vertex>
3844	#include <defaultnormal_vertex>
3845	#include <normal_vertex>
3846	#include <begin_vertex>
3847	#include <morphtarget_vertex>
3848	#include <skinning_vertex>
3849	#include <displacementmap_vertex>
3850	#include <project_vertex>
3851	#include <logdepthbuf_vertex>
3852	#include <clipping_planes_vertex>
3853	#include <fog_vertex>
3854	vViewPosition = - mvPosition.xyz;
3855}`,Oyt=`#define MATCAP
3856uniform vec3 diffuse;
3857uniform float opacity;
3858uniform sampler2D matcap;
3859varying vec3 vViewPosition;
3860#include <common>
3861#include <dithering_pars_fragment>
3862#include <color_pars_fragment>
3863#include <uv_pars_fragment>
3864#include <map_pars_fragment>
3865#include <alphamap_pars_fragment>
3866#include <alphatest_pars_fragment>
3867#include <alphahash_pars_fragment>
3868#include <fog_pars_fragment>
3869#include <normal_pars_fragment>
3870#include <bumpmap_pars_fragment>
3871#include <normalmap_pars_fragment>
3872#include <logdepthbuf_pars_fragment>
3873#include <clipping_planes_pars_fragme
3873nt>
3874void main() {
3875	vec4 diffuseColor = vec4( diffuse, opacity );
3876	#include <clipping_planes_fragment>
3877	#include <logdepthbuf_fragment>
3878	#include <map_fragment>
3879	#include <color_fragment>
3880	#include <alphamap_fragment>
3881	#include <alphatest_fragment>
3882	#include <alphahash_fragment>
3883	#include <normal_fragment_begin>
3884	#include <normal_fragment_maps>
3885	vec3 viewDir = normalize( vViewPosition );
3886	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
3887	vec3 y = cross( viewDir, x );
3888	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
3889	#ifdef USE_MATCAP
3890		vec4 matcapColor = texture2D( matcap, uv );
3891	#else
3892		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
3893	#endif
3894	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
3895	#include <opaque_fragment>
3896	#include <tonemapping_fragment>
3897	#include <colorspace_fragment>
3898	#include <fog_fragment>
3899	#include <premultiplied_alpha_fragment>
3900	#include <dithering_fragment>
3901}`,Ryt=`#define NORMAL
3902#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3903	varying vec3 vViewPosition;
3904#endif
3905#include <common>
3906#include <batching_pars_vertex>
3907#include <uv_pars_vertex>
3908#include <displacementmap_pars_vertex>
3909#include <normal_pars_vertex>
3910#include <morphtarget_pars_vertex>
3911#include <skinning_pars_vertex>
3912#include <logdepthbuf_pars_vertex>
3913#include <clipping_planes_pars_vertex>
3914void main() {
3915	#include <uv_vertex>
3916	#include <batching_vertex>
3917	#include <beginnormal_vertex>
3918	#include <morphinstance_vertex>
3919	#include <morphnormal_vertex>
3920	#include <skinbase_vertex>
3921	#include <skinnormal_vertex>
3922	#include <defaultnormal_vertex>
3923	#include <normal_vertex>
3924	#include <begin_vertex>
3925	#include <morphtarget_vertex>
3926	#include <skinning_vertex>
3927	#include <displacementmap_vertex>
3928	#include <project_vertex>
3929	#include <logdepthbuf_vertex>
3930	#include <clipping_planes_vertex>
3931#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3932	vViewPosition = - mvPosition.xyz;
3933#endif
3934}`,Iyt=`#define NORMAL
3935uniform float opacity;
3936#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3937	varying vec3 vViewPosition;
3938#endif
3939#include <packing>
3940#include <uv_pars_fragment>
3941#include <normal_pars_fragment>
3942#include <bumpmap_pars_fragment>
3943#include <normalmap_pars_fragment>
3944#include <logdepthbuf_pars_fragment>
3945#include <clipping_planes_pars_fragment>
3946void main() {
3947	vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
3948	#include <clipping_planes_fragment>
3949	#include <logdepthbuf_fragment>
3950	#include <normal_fragment_begin>
3951	#include <normal_fragment_maps>
3952	gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );
3953	#ifdef OPAQUE
3954		gl_FragColor.a = 1.0;
3955	#endif
3956}`,Dyt=`#define PHONG
3957varying vec3 vViewPosition;
3958#include <common>
3959#include <batching_pars_vertex>
3960#include <uv_pars_vertex>
3961#include <displacementmap_pars_vertex>
3962#include <envmap_pars_vertex>
3963#include <color_pars_vertex>
3964#include <fog_pars_vertex>
3965#include <normal_pars_vertex>
3966#include <morphtarget_pars_vertex>
3967#include <skinning_pars_vertex>
3968#include <shadowmap_pars_vertex>
3969#include <logdepthbuf_pars_vertex>
3970#include <clipping_planes_pars_vertex>
3971void main() {
3972	#include <uv_vertex>
3973	#include <color_vertex>
3974	#include <morphcolor_vertex>
3975	#include <batching_vertex>
3976	#include <beginnormal_vertex>
3977	#include <morphinstance_vertex>
3978	#include <morphnormal_vertex>
3979	#include <skinbase_vertex>
3980	#include <skinnormal_vertex>
3981	#include <defaultnormal_vertex>
3982	#include <normal_vertex>
3983	#include <begin_vertex>
3984	#include <morphtarget_vertex>
3985	#include <skinning_vertex>
3986	#include <displacementmap_vertex>
3987	#include <project_vertex>
3988	#include <logdepthbuf_vertex>
3989	#include <clipping_planes_vertex>
3990	vViewPosition = - mvPosition.xyz;
3991	#include <worldpos_vertex>
3992	#include <envmap_vertex>
3993	#include <shadowmap_vertex>
3994	#include <fog_vertex>
3995}`,Lyt=`#define PHONG
3996uniform vec3 diffuse;
3997uniform vec3 emissive;
3998uniform vec3 specular;
3999uniform float shininess;
4000uniform float opacity;
4001#include <common>
4002#include <packing>
4003#include <dithering_pars_fragment>
4004#include <color_pars_fragment>
4005#include <uv_pars_fragment>
4006#include <map_pars_fragment>
4007#include <alphamap_pars_fragment>
4008#include <alphatest_pars_fragment>
4009#include <alphahash_pars_fragment>
4010#include <aomap_pars_fragment>
4011#include <lightmap_pars_fragment>
4012#include <emissivemap_pars_fragment>
4013#include <envmap_common_pars_fragment>
4014#include <envmap_pars_fragment>
4015#include <fog_pars_fragment>
4016#include <bsdfs>
4017#include <lights_pars_begin>
4018#include <normal_pars_fragment>
4019#include <lights_phong_pars_fragment>
4020#include <shadowmap_pars_fragment>
4021#include <bumpmap_pars_fragment>
4022#include <normalmap_pars_fragment>
4023#include <specularmap_pars_fragment>
4024#include <logdepthbuf_pars_fragment>
4025#include <clipping_planes_pars_fragment>
4026void main() {
4027	vec4 diffuseColor = vec4( diffuse, opacity );
4028	#include <clipping_planes_fragment>
4029	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
4030	vec3 totalEmissiveRadiance = emissive;
4031	#include <logdepthbuf_fragment>
4032	#include <map_fragment>
4033	#include <color_fragment>
4034	#include <alphamap_fragment>
4035	#include <alphatest_fragment>
4036	#include <alphahash_fragment>
4037	#include <specularmap_fragment>
4038	#include <normal_fragment_begin>
4039	#include <normal_fragment_maps>
4040	#include <emissivemap_fragment>
4041	#include <lights_phong_fragment>
4042	#include <lights_fragment_begin>
4043	#include <lights_fragment_maps>
4044	#include <lights_fragment_end>
4045	#include <aomap_fragment>
4046	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
4047	#include <envmap_fragment>
4048	#include <opaque_fragment>
4049	#include <tonemapping_fragment>
4050	#include <colorspace_fragment>
4051	#include <fog_fragment>
4052	#include <premultiplied_alpha_fragment>
4053	#include <dithering_fragment>
4054}`,$yt=`#define STANDARD
4055varying vec3 vViewPosition;
4056#ifdef USE_TRANSMISSION
4057	varying vec3 vWorldPosition;
4058#endif
4059#include <common>
4060#include <batching_pars_vertex>
4061#include <uv_pars_vertex>
4062#include <displacementmap_pars_vertex>
4063#include <color_pars_vertex>
4064#include <fog_pars_vertex>
4065#include <normal_pars_vertex>
4066#include <morphtarget_pars_vertex>
4067#include <skinning_pars_vertex>
4068#include <shadowmap_pars_vertex>
4069#include <logdepthbuf_pars_vertex>
4070#include <clipping_planes_pars_vertex>
4071void main() {
4072	#include <uv_vertex>
4073	#include <color_vertex>
4074	#include <morphinstance_vertex>
4075	#include <morphcolor_vertex>
4076	#include <batching_vertex>
4077	#include <beginnormal_vertex>
4078	#include <morphnormal_vertex>
4079	#include <skinbase_vertex>
4080	#include <skinnormal_vertex>
4081	#include <defaultnormal_vertex>
4082	#include <normal_vertex>
4083	#include <begin_vertex>
4084	#include <morphtarget_vertex>
4085	#include <skinning_vertex>
4086	#include <displacementmap_vertex>
4087	#include <project_vertex>
4088	#include <logdepthbuf_vertex>
4089	#include <clipping_planes_vertex>
4090	vViewPosition = - mvPosition.xyz;
4091	#include <worldpos_vertex>
4092	#include <shadowmap_vertex>
4093	#include <fog_vertex>
4094#ifdef USE_TRANSMISSION
4095	vWorldPosition = worldPosition.xyz;
4096#endif
4097}`,Fyt=`#define STANDARD
4098#ifdef PHYSICAL
4099	#define IOR
4100	#define USE_SPECULAR
4101#endif
4102uniform vec3 diffuse;
4103uniform vec3 emissive;
4104uniform float roughness;
4105uniform float metalness;
4106uniform float opacity;
4107#ifdef IOR
4108	uniform float ior;
4109#endif
4110#ifdef USE_SPECULAR
4111	uniform float specularIntensity;
4112	uniform vec3 specularColor;
4113	#ifdef USE_SPECULAR_COLORMAP
4114		uniform sampler2D specularColorMap;
4115	#endif
4116	#ifdef USE_SPECULAR_INTENSITYMAP
4117		uniform sampler2D specularIntensityMap;
4118	#endif
4119#endif
4120#ifdef USE_CLEARCOAT
4121	uniform float clearcoat;
4122	uniform float clearcoatRoughness;
4123#endif
4124#ifdef USE_DISPERSION
4125	uniform float dispersion;
4126#endif
4127#ifdef USE_IRIDESCENCE
4128	uniform float iridescence;
4129	uniform float iridescenceIOR;
4130	uniform float iridescenceThicknessMinimum;
4131	uniform float iridescenceThicknessMaximum;
4132#endif
4133#ifdef USE_SHEEN
4134	uniform vec3 sheenColor;
4135	uniform float sheenRoughness;
4136	#ifdef USE_SHEEN_COLORMAP
4137		uniform sampler2D sheenColorMap;
4138	#endif
4139	#ifdef USE_SHEEN_ROUGHNESSMAP
4140		uniform sampler2D sheenRoughnessMap;
4141	#endif
4142#endif
4143#ifdef USE_ANISOTROPY
4144	uniform vec2 anisotropyVector;
4145	#ifdef USE_ANISOTROPYMAP
4146		uniform sampler2D anisotropyMap;
4147	#endif
4148#endif
4149varying vec3 vViewPosition;
4150#include <common>
4151#include <packing>
4152#include <dithering_pars_fragment>
4153#include <color_pars_fragment>
4154#include <uv_pars_fragment>
4155#include <map_pars_fragment>
4156#include <alphamap_pars_fragment>
4157#include <alphatest_pars_fragment>
4158#include <alphahash_pars_fragment>
4159#include <aomap_pars_fragment>
4160#include <lightmap_pars_fragment>
4161#include <emissivemap_pars_fragment>
4162#include <iridescence_fragment>
4163#include <cube_uv_reflection_fragment>
4164#include <envmap_common_pars_fragment>
4165#include <envmap_physical_pars_fragment>
4166#include <fog_pars_fragment>
4167#include <lights_pars_begin>
4168#include <normal_pars_fragment>
4169#include <lights_physical_pars_fragment>
4170#include <transmission_pars_fragment>
4171#include <shadowmap_pars_fragment>
4172#include <bumpmap_pars_fragment>
4173#include <normalmap_pars_fragment>
4174#include <clearcoat_pars_fragment>
4175#include <iridescence_pars_fragment>
4176#include <roughnessmap_pars_fragment>
4177#include <metalnessmap_pars_fragment>
4178#include <logdepthbuf_pars_fragment>
4179#include <clipping_planes_pars_fragment>
4180void main() {
4181	vec4 diffuseColor = vec4( diffuse, opacity );
4182	#include <clipping_planes_fragment>
4183	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
4184	vec3 totalEmissiveRadiance = emissive;
4185	#include <logdepthbuf_fragment>
4186	#include <map_fragment>
4187	#include <color_fragment>
4188	#include <alphamap_fragment>
4189	#include <alphatest_fragment>
4190	#include <alphahash_fragment>
4191	#include <roughnessmap_fragment>
4192	#include <metalnessmap_fragment>
4193	#include <normal_fragment_begin>
4194	#include <normal_fragment_maps>
4195	#include <clearcoat_normal_fragment_begin>
4196	#include <clearcoat_normal_fragment_maps>
4197	#include <emissivemap_fragment>
4198	#include <lights_physical_fragment>
4199	#include <lights_fragment_begin>
4200	#include <lights_fragment_maps>
4201	#include <lights_fragment_end>
4202	#include <aomap_fragment>
4203	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
4204	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
4205	#include <transmission_fragment>
4206	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
4207	#ifdef USE_SHEEN
4208		float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
4209		outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
4210	#endif
4211	#ifdef USE_CLEARCOAT
4212		float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
4213		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
4214		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
4215	#endif
4216	#include <opaque_fragment>
4217	#include <tonemapping_fragment>
4218	#include <colorspace_fragment>
4219	#include <fog_fragment>
4220	#include <premultiplied_alpha_fragment>
4221	#include <dithering_fragment>
4222}`,Uyt=`#define TOON
4223varying vec3 vViewPosition;
4224#include <common>
4225#include <batching_pars_vertex>
4226#include <uv_pars_vertex>
4227#include <displacementmap_pars_vertex>
4228#include <color_pars_vertex>
4229#include <fog_pars_vertex>
4230#include <normal_pars_vertex>
4231#include <morphtarget_pars_vertex>
4232#include <skinning_pars_vertex>
4233#include <shadowmap_pars_vertex>
4234#include <logdepthbuf_pars_vertex>
4235#include <clipping_planes_pars_vertex>
4236void main() {
4237	#include <uv_vertex>
4238	#include <color_vertex>
4239	#include <morphinstance_vertex>
4240	#include <morphcolor_vertex>
4241	#include <batching_vertex>
4242	#include <beginnormal_vertex>
4243	#include <morphnormal_vertex>
4244	#include <skinbase_vertex>
4245	#include <skinnormal_vertex>
4246	#include <defaultnormal_vertex>
4247	#include <normal_vertex>
4248	#include <begin_vertex>
4249	#include <morphtarget_vertex>
4250	#include <skinning_vertex>
4251	#include <displacementmap_vertex>
4252	#include <project_vertex>
4253	#include <logdepthbuf_vertex>
4254	#include <clipping_planes_vertex>
4255	vViewPosition = - mvPosition.xyz;
4256	#include <worldpos_vertex>
4257	#include <shadowmap_vertex>
4258	#include <fog_vertex>
4259}`,zyt=`#define TOON
4260uniform vec3 diffuse;
4261uniform vec3 emissive;
4262uniform float opacity;
4263#include <common>
4264#include <packing>
4265#include <dithering_pars_fragment>
4266#include <color_pars_fragment>
4267#include <uv_pars_fragment>
4268#include <map_pars_fragment>
4269#include <alphamap_pars_fragment>
4270#include <alphatest_pars_fragment>
4271#include <alphahash_pars_fragment>
4272#include <aomap_pars_fragment>
4273#include <lightmap_pars_fragment>
4274#include <emissivemap_pars_fragment>
4275#include <gradientmap_pars_fragment>
4276#include <fog_pars_fragment>
4277#include <bsdfs>
4278#include <lights_pars_begin>
4279#include <normal_pars_fragment>
4280#include <lights_toon_pars_fragment>
4281#include <shadowmap_pars_fragment>
4282#include <bumpmap_pars_fragment>
4283#include <normalmap_pars_fragment>
4284#include <logdepthbuf_pars_fragment>
4285#include <clipping_planes_pars_fragment>
4286void main() {
4287	vec4 diffuseColor = vec4( diffuse, opacity );
4288	#include <clipping_planes_fragment>
4289	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
4290	vec3 totalEmissiveRadiance = emissive;
4291	#include <logdepthbuf_fragment>
4292	#include <map_fragment>
4293	#include <color_fragment>
4294	#include <alphamap_fragment>
4295	#include <alphatest_fragment>
4296	#include <alphahash_fragment>
4297	#include <normal_fragment_begin>
4298	#include <normal_fragment_maps>
4299	#include <emissivemap_fragment>
4300	#include <lights_toon_fragment>
4301	#include <lights_fragment_begin>
4302	#include <lights_fragment_maps>
4303	#include <lights_fragment_end>
4304	#include <aomap_fragment>
4305	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
4306	#include <opaque_fragment>
4307	#include <tonemapping_fragment>
4308	#include <colorspace_fragment>
4309	#include <fog_fragment>
4310	#include <premultiplied_alpha_fragment>
4311	#include <dithering_fragment>
4312}`,Byt=`uniform float size;
4313uniform float scale;
4314#include <common>
4315#include <color_pars_vertex>
4316#include <fog_pars_vertex>
4317#include <morphtarget_pars_vertex>
4318#include <logdepthbuf_pars_vertex>
4319#include <clipping_planes_pars_vertex>
4320#ifdef USE_POINTS_UV
4321	varying vec2 vUv;
4322	uniform mat3 uvTransform;
4323#endif
4324void main() {
4325	#ifdef USE_POINTS_UV
4326		vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
4327	#endif
4328	#include <color_vertex>
4329	#include <morphinstance_vertex>
4330	#include <morphcolor_vertex>
4331	#include <begin_vertex>
4332	#include <morphtarget_vertex>
4333	#include <project_vertex>
4334	gl_PointSize = size;
4335	#ifdef USE_SIZEATTENUATION
4336		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
4337		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
4338	#endif
4339	#include <logdepthbuf_vertex>
4340	#include <clipping_planes_vertex>
4341	#include <worldpos_vertex>
4342	#include <fog_vertex>
4343}`,Vyt=`uniform vec3 diffuse;
4344uniform float opacity;
4345#include <common>
4346#include <color_pars_fragment>
4347#include <map_particle_pars_fragment>
4348#include <alphatest_pars_fragment>
4349#include <alphahash_pars_fragment>
4350#include <fog_pars_fragment>
4351#include <logdepthbuf_pars_fragment>
4352#include <clipping_planes_pars_fragment>
4353void main() {
4354	vec4 diffuseColor = vec4( diffuse, opacity );
4355	#include <clipping_planes_fragment>
4356	vec3 outgoingLight = vec3( 0.0 );
4357	#include <logdepthbuf_fragment>
4358	#include <map_particle_fragment>
4359	#include <color_fragment>
4360	#include <alphatest_fragment>
4361	#include <alphahash_fragment>
4362	outgoingLight = diffuseColor.rgb;
4363	#include <opaque_fragment>
4364	#include <tonemapping_fragment>
4365	#include <colorspace_fragment>
4366	#include <fog_fragment>
4367	#include <premultiplied_alpha_fragment>
4368}`,Hyt=`#include <common>
4369#include <batching_pars_vertex>
4370#include <fog_pars_vertex>
4371#include <morphtarget_pars_vertex>
4372#include <skinning_pars_vertex>
4373#include <logdepthbuf_pars_vertex>
4374#include <shadowmap_pars_vertex>
4375void main() {
4376	#include <batching_vertex>
4377	#include <beginnormal_vertex>
4378	#include <morphinstance_vertex>
4379	#include <morphnormal_vertex>
4380	#include <skinbase_vertex>
4381	#include <skinnormal_vertex>
4382	#include <defaultnormal_vertex>
4383	#include <begin_vertex>
4384	#include <morphtarget_vertex>
4385	#include <skinning_vertex>
4386	#include <project_vertex>
4387	#include <logdepthbuf_vertex>
4388	#include <worldpos_vertex>
4389	#include <shadowmap_vertex>
4390	#include <fog_vertex>
4391}`,Wyt=`uniform vec3 color;
4392uniform float opacity;
4393#include <common>
4394#include <packing>
4395#include <fog_pars_fragment>
4396#include <bsdfs>
4397#include <lights_pars_begin>
4398#include <logdepthbuf_pars_fragment>
4399#include <shadowmap_pars_fragment>
4400#include <shadowmask_pars_fragment>
4401void main() {
4402	#include <logdepthbuf_fragment>
4403	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
4404	#include <tonemapping_fragment>
4405	#include <colorspace_fragment>
4406	#include <fog_fragment>
4407}`,Gyt=`uniform float rotation;
4408uniform vec2 center;
4409#include <common>
4410#include <uv_pars_vertex>
4411#include <fog_pars_vertex>
4412#include <logdepthbuf_pars_vertex>
4413#include <clipping_planes_pars_vertex>
4414void main() {
4415	#include <uv_vertex>
4416	vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
4417	vec2 scale;
4418	scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
4419	scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
4420	#ifndef USE_SIZEATTENUATION
4421		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
4422		if ( isPerspective ) scale *= - mvPosition.z;
4423	#endif
4424	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
4425	vec2 rotatedPosition;
4426	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
4427	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
4428	mvPosition.xy += rotatedPosition;
4429	gl_Position = projectionMatrix * mvPosition;
4430	#include <logdepthbuf_vertex>
4431	#include <clipping_planes_vertex>
4432	#include <fog_vertex>
4433}`,qyt=`uniform vec3 diffuse;
4434uniform float opacity;
4435#include <common>
4436#include <uv_pars_fragment>
4437#include <map_pars_fragment>
4438#include <alphamap_pars_fragment>
4439#include <alphatest_pars_fragment>
4440#include <alphahash_pars_fragment>
4441#include <fog_pars_fragment>
4442#include <logdepthbuf_pars_fragment>
4443#include <clipping_planes_pars_fragment>
4444void main() {
4445	vec4 diffuseColor = vec4( diffuse, opacity );
4446	#include <clipping_planes_fragment>
4447	vec3 outgoingLight = vec3( 0.0 );
4448	#include <logdepthbuf_fragment>
4449	#include <map_fragment>
4450	#include <alphamap_fragment>
4451	#include <alphatest_fragment>
4452	#include <alphahash_fragment>
4453	outgoingLight = diffuseColor.rgb;
4454	#include <opaque_fragment>
4455	#include <tonemapping_fragment>
4456	#include <colorspace_fragment>
4457	#include <fog_fragment>
4458}`,bn={alphahash_fragment:mgt,alphahash_pars_fragment:ggt,alphamap_fragment:xgt,alphamap_pars_fragment:ygt,alphatest_fragment:vgt,alphatest_pars_fragment:bgt,aomap_fragment:wgt,aomap_pars_fragment:_gt,batching_pars_vertex:Sgt,batching_vertex:Ngt,begin_vertex:jgt,beginnormal_vertex:Cgt,bsdfs:kgt,iridescence_fragment:Egt,bumpmap_pars_fragment:Agt,clipping_planes_fragment:Tgt,clipping_planes_pars_fragment:Mgt,clipping_planes_pars_vertex:Pgt,clipping_planes_vertex:Ogt,color_fragment:Rgt,color_pars_fragment:Igt,color_pars_vertex:Dgt,color_vertex:Lgt,common:$gt,cube_uv_reflection_fragment:Fgt,defaultnormal_vertex:Ugt,displacementmap_pars_vertex:zgt,displacementmap_vertex:Bgt,emissivemap_fragment:Vgt,emissivemap_pars_fragment:Hgt,colorspace_fragment:Wgt,colorspace_pars_fragment:Ggt,envmap_fragment:qgt,envmap_common_pars_fragment:Kgt,envmap_pars_fragment:Ygt,envmap_pars_vertex:Xgt,envmap_physical_pars_fragment:oxt,envmap_vertex:Qgt,fog_vertex:Jgt,fog_pars_vertex:Zgt,fog_fragment:ext,fog_pars_fragment:txt,gradientmap_pars_fragment:nxt,lightmap_pars_fragment:rxt,lights_lambert_fragment:ixt,lights_lambert_pars_fragment:sxt,lights_pars_begin:a
vendor: 6,398 bytes, line 4458
4458xt,lights_toon_fragment:lxt,lights_toon_pars_fragment:cxt,lights_phong_fragment:uxt,lights_phong_pars_fragment:dxt,lights_physical_fragment:fxt,lights_physical_pars_fragment:hxt,lights_fragment_begin:pxt,lights_fragment_maps:mxt,lights_fragment_end:gxt,logdepthbuf_fragment:xxt,logdepthbuf_pars_fragment:yxt,logdepthbuf_pars_vertex:vxt,logdepthbuf_vertex:bxt,map_fragment:wxt,map_pars_fragment:_xt,map_particle_fragment:Sxt,map_particle_pars_fragment:Nxt,metalnessmap_fragment:jxt,metalnessmap_pars_fragment:Cxt,morphinstance_vertex:kxt,morphcolor_vertex:Ext,morphnormal_vertex:Axt,morphtarget_pars_vertex:Txt,morphtarget_vertex:Mxt,normal_fragment_begin:Pxt,normal_fragment_maps:Oxt,normal_pars_fragment:Rxt,normal_pars_vertex:Ixt,normal_vertex:Dxt,normalmap_pars_fragment:Lxt,clearcoat_normal_fragment_begin:$xt,clearcoat_normal_fragment_maps:Fxt,clearcoat_pars_fragment:Uxt,iridescence_pars_fragment:zxt,opaque_fragment:Bxt,packing:Vxt,premultiplied_alpha_fragment:Hxt,project_vertex:Wxt,dithering_fragment:Gxt,dithering_pars_fragment:qxt,roughnessmap_fragment:Kxt,roughnessmap_pars_fragment:Yxt,shadowmap_pars_fragment:Xxt,shadowmap_pars_vertex:Qxt,shadowmap_vertex:Jxt,shadowmask_pars_fragment:Zxt,skinbase_vertex:eyt,skinning_pars_vertex:tyt,skinning_vertex:nyt,skinnormal_vertex:ryt,specularmap_fragment:iyt,specularmap_pars_fragment:syt,tonemapping_fragment:ayt,tonemapping_pars_fragment:oyt,transmission_fragment:lyt,transmission_pars_fragment:cyt,uv_pars_fragment:uyt,uv_pars_vertex:dyt,uv_vertex:fyt,worldpos_vertex:hyt,background_vert:pyt,background_frag:myt,backgroundCube_vert:gyt,backgroundCube_frag:xyt,cube_vert:yyt,cube_frag:vyt,depth_vert:byt,depth_frag:wyt,distanceRGBA_vert:_yt,distanceRGBA_frag:Syt,equirect_vert:Nyt,equirect_frag:jyt,linedashed_vert:Cyt,linedashed_frag:kyt,meshbasic_vert:Eyt,meshbasic_frag:Ayt,meshlambert_vert:Tyt,meshlambert_frag:Myt,meshmatcap_vert:Pyt,meshmatcap_frag:Oyt,meshnormal_vert:Ryt,meshnormal_frag:Iyt,meshphong_vert:Dyt,meshphong_frag:Lyt,meshphysical_vert:$yt,meshphysical_frag:Fyt,meshtoon_vert:Uyt,meshtoon_frag:zyt,points_vert:Byt,points_frag:Vyt,shadow_vert:Hyt,shadow_frag:Wyt,sprite_vert:Gyt,sprite_frag:qyt},ct={common:{diffuse:{value:new cr(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new wn},alphaMap:{value:null},alphaMapTransform:{value:new wn},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new wn}},envmap:{envMap:{value:null},envMapRotation:{value:new wn},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new wn}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new wn}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new wn},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new wn},normalScale:{value:new Mn(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new wn},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new wn}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new wn}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new wn}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new cr(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new cr(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new wn},alphaTest:{value:0},uvTransform:{value:new wn}},sprite:{diffuse:{value:new cr(16777215)},opacity:{value:1},center:{value:new Mn(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new wn},alphaMap:{value:null},alphaMapTransform:{value:new wn},alphaTest:{value:0}}},Lc={basic:{uniforms:ra([ct.common,ct.specularmap,ct.envmap,ct.aomap,ct.lightmap,ct.fog]),vertexShader:bn.meshbasic_vert,fragmentShader:bn.meshbasic_frag},lambert:{uniforms:ra([ct.common,ct.specularmap,ct.envmap,ct.aomap,ct.lightmap,ct.emissivemap,ct.bumpmap,ct.normalmap,ct.displacementmap,ct.fog,ct.lights,{emissive:{value:new cr(0)}}]),vertexShader:bn.meshlambert_vert,fragmentShader:bn.meshlambert_frag},phong:{uniforms:ra([ct.common,ct.specularmap,ct.envmap,ct.aomap,ct.lightmap,ct.emissivemap,ct.bumpmap,ct.normalmap,ct.displacementmap,ct.fog,ct.lights,{emissive:{value:new cr(0)},specular:{value:new cr(1118481)},shininess:{value:30}}]),vertexShader:bn.meshphong_vert,fragmentShader:bn.meshphong_frag},standard:{uniforms:ra([ct.common,ct.envmap,ct.aomap,ct.lightmap,ct.emissivemap,ct.bumpmap,ct.normalmap,ct.displacementmap,ct.roughnessmap,ct.metalnessmap,ct.fog,ct.lights,{emissive:{value:new cr(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:bn.meshphysical_vert,fragmentShader:bn.meshphysical_frag},toon:{uniforms:ra([ct.common,ct.aomap,ct.lightmap,ct.emissivemap,ct.bumpmap,ct.normalmap,ct.displacementmap,ct.gradientmap,ct.fog,ct.lights,{emissive:{value:new cr(0)}}]),vertexShader:bn.meshtoon_vert,fragmentShader:bn.meshtoon_frag},matcap:{uniforms:ra([ct.common,ct.bumpmap,ct.normalmap,ct.displacementmap,ct.fog,{matc
vendor: 4,477 bytes, line 4458
4458ap:{value:null}}]),vertexShader:bn.meshmatcap_vert,fragmentShader:bn.meshmatcap_frag},points:{uniforms:ra([ct.points,ct.fog]),vertexShader:bn.points_vert,fragmentShader:bn.points_frag},dashed:{uniforms:ra([ct.common,ct.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:bn.linedashed_vert,fragmentShader:bn.linedashed_frag},depth:{uniforms:ra([ct.common,ct.displacementmap]),vertexShader:bn.depth_vert,fragmentShader:bn.depth_frag},normal:{uniforms:ra([ct.common,ct.bumpmap,ct.normalmap,ct.displacementmap,{opacity:{value:1}}]),vertexShader:bn.meshnormal_vert,fragmentShader:bn.meshnormal_frag},sprite:{uniforms:ra([ct.sprite,ct.fog]),vertexShader:bn.sprite_vert,fragmentShader:bn.sprite_frag},background:{uniforms:{uvTransform:{value:new wn},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:bn.background_vert,fragmentShader:bn.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new wn}},vertexShader:bn.backgroundCube_vert,fragmentShader:bn.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:bn.cube_vert,fragmentShader:bn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:bn.equirect_vert,fragmentShader:bn.equirect_frag},distanceRGBA:{uniforms:ra([ct.common,ct.displacementmap,{referencePosition:{value:new Re},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:bn.distanceRGBA_vert,fragmentShader:bn.distanceRGBA_frag},shadow:{uniforms:ra([ct.lights,ct.fog,{color:{value:new cr(0)},opacity:{value:1}}]),vertexShader:bn.shadow_vert,fragmentShader:bn.shadow_frag}};Lc.physical={uniforms:ra([Lc.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new wn},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new wn},clearcoatNormalScale:{value:new Mn(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new wn},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new wn},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new wn},sheen:{value:0},sheenColor:{value:new cr(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new wn},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new wn},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new wn},transmissionSamplerSize:{value:new Mn},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new wn},attenuationDistance:{value:0},attenuationColor:{value:new cr(0)},specularColor:{value:new cr(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new wn},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new wn},anisotropyVector:{value:new Mn},anisotropyMap:{value:null},anisotropyMapTransform:{value:new wn}}]),vertexShader:bn.meshphysical_vert,fragmentShader:bn.meshphysical_frag};const Uj={r:0,b:0,g:0},wp=new Md,Kyt=new es;function Yyt(t,e,n,r,i,s,a){const l=new cr(0);let c=s===!0?0:1,u,d,f=null,h=0,p=null;function m(w){let v=w.isScene===!0?w.background:null;return v&&v.isTexture&&(v=(w.backgroundBlurriness>0?n:e).get(v)),v}function x(w){let v=!1;const N=m(w);N===null?g(l,c):N&&N.isColor&&(g(N,1),v=!0);const S=t.xr.getEnvironmentBlendMode();S==="additive"?r.buffers.color.setClear(0,0,0,1,a):S==="alpha-blend"&&r.buffers.color.setClear(0,0,0,0,a),(t.autoClear||v)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))}function y(w,v){const N=m(v);N&&(N.isCubeTexture||N.mapping===QM)?(d===void 0&&(d=new Hc(new iN(1,1,1),new Pd({name:"BackgroundCubeMaterial",uniforms:Gv(Lc.backgroundCube.uniforms),vertexShader:Lc.backgroundCube.vertexShader,fragmentShader:Lc.backgroundCube.fragmentShader,side:Va,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),d.geometry.deleteAttribute("uv"),d.onBeforeRender=function(S,_,j){this.matrixWorld.copyPosition(j.matrixWorld)},Object.defineProperty(d.material,"envMap",{get:function(){return this.uniforms.envMap.value}}
vendor: 5,065 bytes, line 4458
4458),i.update(d)),wp.copy(v.backgroundRotation),wp.x*=-1,wp.y*=-1,wp.z*=-1,N.isCubeTexture&&N.isRenderTargetTexture===!1&&(wp.y*=-1,wp.z*=-1),d.material.uniforms.envMap.value=N,d.material.uniforms.flipEnvMap.value=N.isCubeTexture&&N.isRenderTargetTexture===!1?-1:1,d.material.uniforms.backgroundBlurriness.value=v.backgroundBlurriness,d.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,d.material.uniforms.backgroundRotation.value.setFromMatrix4(Kyt.makeRotationFromEuler(wp)),d.material.toneMapped=Xn.getTransfer(N.colorSpace)!==Fr,(f!==N||h!==N.version||p!==t.toneMapping)&&(d.material.needsUpdate=!0,f=N,h=N.version,p=t.toneMapping),d.layers.enableAll(),w.unshift(d,d.geometry,d.material,0,0,null)):N&&N.isTexture&&(u===void 0&&(u=new Hc(new sN(2,2),new Pd({name:"BackgroundMaterial",uniforms:Gv(Lc.background.uniforms),vertexShader:Lc.background.vertexShader,fragmentShader:Lc.background.fragmentShader,side:$h,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),Object.defineProperty(u.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(u)),u.material.uniforms.t2D.value=N,u.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,u.material.toneMapped=Xn.getTransfer(N.colorSpace)!==Fr,N.matrixAutoUpdate===!0&&N.updateMatrix(),u.material.uniforms.uvTransform.value.copy(N.matrix),(f!==N||h!==N.version||p!==t.toneMapping)&&(u.material.needsUpdate=!0,f=N,h=N.version,p=t.toneMapping),u.layers.enableAll(),w.unshift(u,u.geometry,u.material,0,0,null))}function g(w,v){w.getRGB(Uj,$pe(t)),r.buffers.color.setClear(Uj.r,Uj.g,Uj.b,v,a)}return{getClearColor:function(){return l},setClearColor:function(w,v=1){l.set(w),c=v,g(l,c)},getClearAlpha:function(){return c},setClearAlpha:function(w){c=w,g(l,c)},render:x,addToRenderList:y}}function Xyt(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),r={},i=h(null);let s=i,a=!1;function l(k,M,I,R,E){let P=!1;const O=f(R,I,M);s!==O&&(s=O,u(s.object)),P=p(k,R,I,E),P&&m(k,R,I,E),E!==null&&e.update(E,t.ELEMENT_ARRAY_BUFFER),(P||a)&&(a=!1,N(k,M,I,R),E!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(E).buffer))}function c(){return t.createVertexArray()}function u(k){return t.bindVertexArray(k)}function d(k){return t.deleteVertexArray(k)}function f(k,M,I){const R=I.wireframe===!0;let E=r[k.id];E===void 0&&(E={},r[k.id]=E);let P=E[M.id];P===void 0&&(P={},E[M.id]=P);let O=P[R];return O===void 0&&(O=h(c()),P[R]=O),O}function h(k){const M=[],I=[],R=[];for(let E=0;E<n;E++)M[E]=0,I[E]=0,R[E]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:M,enabledAttributes:I,attributeDivisors:R,object:k,attributes:{},index:null}}function p(k,M,I,R){const E=s.attributes,P=M.attributes;let O=0;const L=I.getAttributes();for(const T in L)if(L[T].location>=0){const F=E[T];let q=P[T];if(q===void 0&&(T==="instanceMatrix"&&k.instanceMatrix&&(q=k.instanceMatrix),T==="instanceColor"&&k.instanceColor&&(q=k.instanceColor)),F===void 0||F.attribute!==q||q&&F.data!==q.data)return!0;O++}return s.attributesNum!==O||s.index!==R}function m(k,M,I,R){const E={},P=M.attributes;let O=0;const L=I.getAttributes();for(const T in L)if(L[T].location>=0){let F=P[T];F===void 0&&(T==="instanceMatrix"&&k.instanceMatrix&&(F=k.instanceMatrix),T==="instanceColor"&&k.instanceColor&&(F=k.instanceColor));const q={};q.attribute=F,F&&F.data&&(q.data=F.data),E[T]=q,O++}s.attributes=E,s.attributesNum=O,s.index=R}function x(){const k=s.newAttributes;for(let M=0,I=k.length;M<I;M++)k[M]=0}function y(k){g(k,0)}function g(k,M){const I=s.newAttributes,R=s.enabledAttributes,E=s.attributeDivisors;I[k]=1,R[k]===0&&(t.enableVertexAttribArray(k),R[k]=1),E[k]!==M&&(t.vertexAttribDivisor(k,M),E[k]=M)}function w(){const k=s.newAttributes,M=s.enabledAttributes;for(let I=0,R=M.length;I<R;I++)M[I]!==k[I]&&(t.disableVertexAttribArray(I),M[I]=0)}function v(k,M,I,R,E,P,O){O===!0?t.vertexAttribIPointer(k,M,I,E,P):t.vertexAttribPointer(k,M,I,R,E,P)}function N(k,M,I,R){x();const E=R.attributes,P=I.getAttributes(),O=M.defaultAttributeValues;for(const L in P){const T=P[L];if(T.location>=0){let D=E[L];if(D===void 0&&(L==="instanceMatrix"&&k.instanceMatrix&&(D=k.instanceMatrix),L==="instanceColor"&&k.instanceColor&&(D=k.instanceColor)),D!==void 0){const F=D.normalized,q=D.itemSize,B=e.get(D);if(B===void 0)continue;const z=B.buffer,H=B.type,W=B.bytesPerElement,G=H===t.INT||H===t.UNSIGNED_INT||D.gpuType===qB;if(D.isInterleavedBufferAttribute){const K=D.data,ee=K.stride,V=D.offset;if(K.isInstancedInterleavedBuffer){for(let J=0;J<T.locationSize;J++)g(T.location+J,K.meshPerAttribute);k.isInstancedMesh!==!0&&R._maxInstanceCount===void 0&&(R._maxInstanceCount=K.meshPerAttribute*K.count)}else for(let J=0;J<T.locationSize;J++)y(T.location+J);t.bindBuffer(t.ARRAY_BUFFER,z);for(let J=0;J<T.locationSize;J++)v(T.location+J,q/T.locationSize,H,F,ee*W,(V+q/T.locationSize*J)*W,G)}else{if(D.isInstancedBufferAttribute){for(let K=0;K<T.locationSize;K++)g(T.location+K,D.meshPerAttribute);k.isInstancedMesh!==!0&&R._maxInstanceCount===void 0&&(R._maxInstanceCount=D.meshPerAttribute*D.count)}
vendor: 15,719 bytes, lines 4458-4533
4458else for(let K=0;K<T.locationSize;K++)y(T.location+K);t.bindBuffer(t.ARRAY_BUFFER,z);for(let K=0;K<T.locationSize;K++)v(T.location+K,q/T.locationSize,H,F,q*W,q/T.locationSize*K*W,G)}}else if(O!==void 0){const F=O[L];if(F!==void 0)switch(F.length){case 2:t.vertexAttrib2fv(T.location,F);break;case 3:t.vertexAttrib3fv(T.location,F);break;case 4:t.vertexAttrib4fv(T.location,F);break;default:t.vertexAttrib1fv(T.location,F)}}}}w()}function S(){A();for(const k in r){const M=r[k];for(const I in M){const R=M[I];for(const E in R)d(R[E].object),delete R[E];delete M[I]}delete r[k]}}function _(k){if(r[k.id]===void 0)return;const M=r[k.id];for(const I in M){const R=M[I];for(const E in R)d(R[E].object),delete R[E];delete M[I]}delete r[k.id]}function j(k){for(const M in r){const I=r[M];if(I[k.id]===void 0)continue;const R=I[k.id];for(const E in R)d(R[E].object),delete R[E];delete I[k.id]}}function A(){C(),a=!0,s!==i&&(s=i,u(s.object))}function C(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:l,reset:A,resetDefaultState:C,dispose:S,releaseStatesOfGeometry:_,releaseStatesOfProgram:j,initAttributes:x,enableAttribute:y,disableUnusedAttributes:w}}function Qyt(t,e,n){let r;function i(u){r=u}function s(u,d){t.drawArrays(r,u,d),n.update(d,r,1)}function a(u,d,f){f!==0&&(t.drawArraysInstanced(r,u,d,f),n.update(d,r,f))}function l(u,d,f){if(f===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(r,u,0,d,0,f);let p=0;for(let m=0;m<f;m++)p+=d[m];n.update(p,r,1)}function c(u,d,f,h){if(f===0)return;const p=e.get("WEBGL_multi_draw");if(p===null)for(let m=0;m<u.length;m++)a(u[m],d[m],h[m]);else{p.multiDrawArraysInstancedWEBGL(r,u,0,d,0,h,0,f);let m=0;for(let x=0;x<f;x++)m+=d[x];for(let x=0;x<h.length;x++)n.update(m,r,h[x])}}this.setMode=i,this.render=s,this.renderInstances=a,this.renderMultiDraw=l,this.renderMultiDrawInstances=c}function Jyt(t,e,n,r){let i;function s(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const _=e.get("EXT_texture_filter_anisotropic");i=t.getParameter(_.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function a(_){return!(_!==ec&&r.convert(_)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT))}function l(_){const j=_===eN&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(_!==Td&&r.convert(_)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE)&&_!==rd&&!j)}function c(_){if(_==="highp"){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";_="mediump"}return _==="mediump"&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let u=n.precision!==void 0?n.precision:"highp";const d=c(u);d!==u&&(console.warn("THREE.WebGLRenderer:",u,"not supported, using",d,"instead."),u=d);const f=n.logarithmicDepthBuffer===!0,h=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),p=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),m=t.getParameter(t.MAX_TEXTURE_SIZE),x=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),y=t.getParameter(t.MAX_VERTEX_ATTRIBS),g=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),w=t.getParameter(t.MAX_VARYING_VECTORS),v=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),N=p>0,S=t.getParameter(t.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:c,textureFormatReadable:a,textureTypeReadable:l,precision:u,logarithmicDepthBuffer:f,maxTextures:h,maxVertexTextures:p,maxTextureSize:m,maxCubemapSize:x,maxAttributes:y,maxVertexUniforms:g,maxVaryings:w,maxFragmentUniforms:v,vertexTextures:N,maxSamples:S}}function Zyt(t){const e=this;let n=null,r=0,i=!1,s=!1;const a=new Rp,l=new wn,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(f,h){const p=f.length!==0||h||r!==0||i;return i=h,r=f.length,p},this.beginShadows=function(){s=!0,d(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,h){n=d(f,h,0)},this.setState=function(f,h,p){const m=f.clippingPlanes,x=f.clipIntersection,y=f.clipShadows,g=t.get(f);if(!i||m===null||m.length===0||s&&!y)s?d(null):u();else{const w=s?0:r,v=w*4;let N=g.clippingState||null;c.value=N,N=d(m,h,v,p);for(let S=0;S!==v;++S)N[S]=n[S];g.clippingState=N,this.numIntersection=x?this.numPlanes:0,this.numPlanes+=w}};function u(){c.value!==n&&(c.value=n,c.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function d(f,h,p,m){const x=f!==null?f.length:0;let y=null;if(x!==0){if(y=c.value,m!==!0||y===null){const g=p+x*4,w=h.matrixWorldInverse;l.getNormalMatrix(w),(y===null||y.length<g)&&(y=new Float32Array(g));for(let v=0,N=p;v!==x;++v,N+=4)a.copy(f[v]).applyMatrix4(w,l),a.normal.toArray(y,N),y[N+3]=a.constant}c.value=y,c.needsUpdate=!0}return e.numPlanes=x,e.numIntersection=0,y}}function evt(t){let e=new WeakMap;function n(a,l){return l===K$?a.mapping=Bv:l===Y$&&(a.mapping=Vv),a}function r(a){if(a&&a.isTexture){const l=a.mapping;if(l===K$||l===Y$)if(e.has(a)){const c=e.get(a).texture;return n(c,a.mapping)}else{const c=a.image;if(c&&c.height>0){const u=new dgt(c.height);return u.fromEquirectangularTexture(t,a),e.set(a,u),a.addEventListener("dispose",i),n(u.texture,a.mapping)}else return null}}return a}function i(a){const l=a.target;l.removeEventListener("dispose",i);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function s(){e=new WeakMap}return{get:r,dispose:s}}class Vpe extends Fpe{constructor(e=-1,n=1,r=1,i=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=n,this.top=r,this.bottom=i,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,n,r,i,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),n=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=r-e,a=r+e,l=i+n,c=i-n;if(this.view!==null&&this.view.enabled){const u=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=u*this.view.offsetX,a=s+u*this.view.width,l-=d*this.view.offsetY,c=l-d*this.view.height}this.projectionMatrix.makeOrthographic(s,a,l,c,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.zoom=this.zoom,n.object.left=this.left,n.object.right=this.right,n.object.top=this.top,n.object.bottom=this.bottom,n.object.near=this.near,n.object.far=this.far,this.view!==null&&(n.object.view=Object.assign({},this.view)),n}}const dy=4,SX=[.125,.215,.35,.446,.526,.582],Vp=20,UI=new Vpe,NX=new cr;let zI=null,BI=0,VI=0,HI=!1;const Ip=(1+Math.sqrt(5))/2,Sx=1/Ip,jX=[new Re(-Ip,Sx,0),new Re(Ip,Sx,0),new Re(-Sx,0,Ip),new Re(Sx,0,Ip),new Re(0,Ip,-Sx),new Re(0,Ip,Sx),new Re(-1,1,-1),new Re(1,1,-1),new Re(-1,1,1),new Re(1,1,1)];class CX{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,n=0,r=.1,i=100){zI=this._renderer.getRenderTarget(),BI=this._renderer.getActiveCubeFace(),VI=this._renderer.getActiveMipmapLevel(),HI=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,r,i,s),n>0&&this._blur(s,0,0,n),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,n=null){return this._fromTexture(e,n)}fromCubemap(e,n=null){return this._fromTexture(e,n)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=AX(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=EX(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(zI,BI,VI),this._renderer.xr.enabled=HI,e.scissorTest=!1,zj(e,0,0,e.width,e.height)}_fromTexture(e,n){e.mapping===Bv||e.mapping===Vv?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),zI=this._renderer.getRenderTarget(),BI=this._renderer.getActiveCubeFace(),VI=this._renderer.getActiveMipmapLevel(),HI=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const r=n||this._allocateTargets();return this._textureToCubeUV(e,r),this._applyPMREM(r),this._cleanup(r),r}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),n=4*this._cubeSize,r={magFilter:Xl,minFilter:Xl,generateMipmaps:!1,type:eN,format:ec,colorSpace:rp,depthBuffer:!1},i=kX(e,n,r);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==n){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=kX(e,n,r);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=tvt(s)),this._blurMaterial=nvt(s,e,n)}return i}_compileMaterial(e){const n=new Hc(this._lodPlanes[0],e);this._renderer.compile(n,UI)}_sceneToCubeUV(e,n,r,i){const l=new ql(90,1,n,r),c=[1,-1,1,1,1,1],u=[1,1,1,-1,-1,-1],d=this._renderer,f=d.autoClear,h=d.toneMapping;d.getClearColor(NX),d.toneMapping=xh,d.autoClear=!1;const p=new Ipe({name:"PMREM.Background",side:Va,depthWrite:!1,depthTest:!1}),m=new Hc(new iN,p);let x=!1;const y=e.background;y?y.isColor&&(p.color.copy(y),e.background=null,x=!0):(p.color.copy(NX),x=!0);for(let g=0;g<6;g++){const w=g%3;w===0?(l.up.set(0,c[g],0),l.lookAt(u[g],0,0)):w===1?(l.up.set(0,0,c[g]),l.lookAt(0,u[g],0)):(l.up.set(0,c[g],0),l.lookAt(0,0,u[g]));const v=this._cubeSize;zj(i,w*v,g>2?v:0,v,v),d.setRenderTarget(i),x&&d.render(m,l),d.render(e,l)}m.geometry.dispose(),m.material.dispose(),d.toneMapping=h,d.autoClear=f,e.background=y}_textureToCubeUV(e,n){const r=this._renderer,i=e.mapping===Bv||e.mapping===Vv;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=AX()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=EX());const s=i?this._cubemapMaterial:this._equirectMaterial,a=new Hc(this._lodPlanes[0],s),l=s.uniforms;l.envMap.value=e;const c=this._cubeSize;zj(n,0,0,3*c,2*c),r.setRenderTarget(n),r.render(a,UI)}_applyPMREM(e){const n=this._renderer,r=n.autoClear;n.autoClear=!1;const i=this._lodPlanes.length;for(let s=1;s<i;s++){const a=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),l=jX[(i-s-1)%jX.length];this._blur(e,s-1,s,a,l)}n.autoClear=r}_blur(e,n,r,i,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,n,r,i,"latitudinal",s),this._halfBlur(a,e,r,r,i,"longitudinal",s)}_halfBlur(e,n,r,i,s,a,l){const c=this._renderer,u=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const d=3,f=new Hc(this._lodPlanes[i],u),h=u.uniforms,p=this._sizeLods[r]-1,m=isFinite(s)?Math.PI/(2*p):2*Math.PI/(2*Vp-1),x=s/m,y=isFinite(s)?1+Math.floor(d*x):Vp;y>Vp&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${y} samples when the maximum is set to ${Vp}`);const g=[];let w=0;for(let j=0;j<Vp;++j){const A=j/x,C=Math.exp(-A*A/2);g.push(C),j===0?w+=C:j<y&&(w+=2*C)}for(let j=0;j<g.length;j++)g[j]=g[j]/w;h.envMap.value=e.texture,h.samples.value=y,h.weights.value=g,h.latitudinal.value=a==="latitudinal",l&&(h.poleAxis.value=l);const{_lodMax:v}=this;h.dTheta.value=m,h.mipInt.value=v-r;const N=this._sizeLods[i],S=3*N*(i>v-dy?i-v+dy:0),_=4*(this._cubeSize-N);zj(n,S,_,3*N,2*N),c.setRenderTarget(n),c.render(f,UI)}}function tvt(t){const e=[],n=[],r=[];let i=t;const s=t-dy+1+SX.length;for(let a=0;a<s;a++){const l=Math.pow(2,i);n.push(l);let c=1/l;a>t-dy?c=SX[a-t+dy-1]:a===0&&(c=0),r.push(c);const u=1/(l-2),d=-u,f=1+u,h=[d,d,f,d,f,f,d,d,f,f,d,f],p=6,m=6,x=3,y=2,g=1,w=new Float32Array(x*m*p),v=new Float32Array(y*m*p),N=new Float32Array(g*m*p);for(let _=0;_<p;_++){const j=_%3*2/3-1,A=_>2?0:-1,C=[j,A,0,j+2/3,A,0,j+2/3,A+1,0,j,A,0,j+2/3,A+1,0,j,A+1,0];w.set(C,x*m*_),v.set(h,y*m*_);const k=[_,_,_,_,_,_];N.set(k,g*m*_)}const S=new Rg;S.setAttribute("position",new Zc(w,x)),S.setAttribute("uv",new Zc(v,y)),S.setAttribute("faceIndex",new Zc(N,g)),e.push(S),i>dy&&i--}return{lodPlanes:e,sizeLods:n,sigmas:r}}function kX(t,e,n){const r=new eg(t,e,n);return r.texture.mapping=QM,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function zj(t,e,n,r,i){t.viewport.set(e,n,r,i),t.scissor.set(e,n,r,i)}function nvt(t,e,n){const r=new Float32Array(Vp),i=new Re(0,1,0);return new Pd({name:"SphericalGaussianBlur",defines:{n:Vp,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:t8(),fragmentShader:`
4459
4460			precision mediump float;
4461			precision mediump int;
4462
4463			varying vec3 vOutputDirection;
4464
4465			uniform sampler2D envMap;
4466			uniform int samples;
4467			uniform float weights[ n ];
4468			uniform bool latitudinal;
4469			uniform float dTheta;
4470			uniform float mipInt;
4471			uniform vec3 poleAxis;
4472
4473			#define ENVMAP_TYPE_CUBE_UV
4474			#include <cube_uv_reflection_fragment>
4475
4476			vec3 getSample( float theta, vec3 axis ) {
4477
4478				float cosTheta = cos( theta );
4479				// Rodrigues' axis-angle rotation
4480				vec3 sampleDirection = vOutputDirection * cosTheta
4481					+ cross( axis, vOutputDirection ) * sin( theta )
4482					+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
4483
4484				return bilinearCubeUV( envMap, sampleDirection, mipInt );
4485
4486			}
4487
4488			void main() {
4489
4490				vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
4491
4492				if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
4493
4494					axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
4495
4496				}
4497
4498				axis = normalize( axis );
4499
4500				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
4501				gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
4502
4503				for ( int i = 1; i < n; i++ ) {
4504
4505					if ( i >= samples ) {
4506
4507						break;
4508
4509					}
4510
4511					float theta = dTheta * float( i );
4512					gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
4513					gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
4514
4515				}
4516
4517			}
4518		`,blending:gh,depthTest:!1,depthWrite:!1})}function EX(){return new Pd({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:t8(),fragmentShader:`
4519
4520			precision mediump float;
4521			precision mediump int;
4522
4523			varying vec3 vOutputDirection;
4524
4525			uniform sampler2D envMap;
4526
4527			#include <common>
4528
4529			void main() {
4530
4531				vec3 outputDirection = normalize( vOutputDirection );
4532				vec2 uv = equirectUv( outputDirection );
4533
4534				gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
4535
4536			}
4537		`,blending:gh,depthTest:!1,depthWrite:!1})}function AX(){return new Pd({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:t8(),fragmentShader:`
4538
4539			precision mediump float;
4540			precision mediump int;
4541
4542			uniform float flipEnvMap;
4543
4544			varying vec3 vOutputDirection;
4545
4546			uniform samplerCube envMap;
4547
4548			void main() {
4549
4550				gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
4551
4552			}
4553		`,blending:gh,depthTest:!1,depthWrite:!1})}function t8(){return`
4554
4555		precision mediump float;
4556		precision mediump int;
4557
4558		attribute float faceIndex;
4559
4560		varying vec3 vOutputDirection;
4561
4562		// RH coordinate system; PMREM face-indexing convention
4563		vec3 getDirection( vec2 uv, float face ) {
4564
4565			uv = 2.0 * uv - 1.0;
4566
4567			vec3 direction = vec3( uv, 1.0 );
4568
4569			if ( face == 0.0 ) {
4570
4571				direction = direction.zyx; // ( 1, v, u ) pos x
4572
4573			} else if ( face == 1.0 ) {
4574
4575				direction = direction.xzy;
4576				direction.xz *= -1.0; // ( -u, 1, -v ) pos y
4577
4578			} else if ( face == 2.0 ) {
4579
4580				direction.x *= -1.0; // ( -u, v, 1 ) pos z
4581
4582			} else if ( face == 3.0 ) {
4583
4584				direction = direction.zyx;
4585				direction.xz *= -1.0; // ( -1, v, -u ) neg x
4586
4587			} else if ( face == 4.0 ) {
4588
4589				direction = direction.xzy;
4590				direction.xy *= -1.0; // ( -u, -1, v ) neg y
4591
4592			} else if ( face == 5.0 ) {
4593
4594				direction.z *= -1.0; // ( u, v, -1 ) neg z
4595
4596			}
4597
4598			return direction;
4599
4600		}
4601
4602		void main() {
4603
4604			vOutputDirection = getDirection( uv, faceIndex );
4605			gl_Position = vec4( position, 1.0 );
4606
4607		}
4608	`}function rvt(t){let e=new WeakMap,n=null;function r(l){if(l&&l.isTexture){const c=l.mapping,u=c===K$||c===Y$,d=c===Bv||c===Vv;if(u||d){let f=e.get(l);const h=f!==void 0?f.texture.pmremVersion:0;if(l.isRenderTargetTexture&&l.pmremVersion!==h)return n===null&&(n=new CX(t)),f=u?n.fromEquirectangular(l,f):n.fromCubemap(l,f),f.texture.pmremVersion=l.pmremVersion,e.set(l,f),f.texture;if(f!==void 0)return f.texture;{const p=l.image;return u&&p&&p.height>0||d&&p&&i(p)?(n===null&&(n=new CX(t)),f=u?n.fromEquirectangular(l):n.fromCubemap(l),f.texture.pmremVersion=l.pmremVersion,e.set(l,f),l.addEventListener("dispose",s),f.texture):null}}}return l}function i(l){let c=0;const u=6;for(let d=0;d<u;d++)l[d]!==void 0&&c++;return c===u}function s(l){const c=l.target;c.removeEventListener("dispose",s);const u=e.get(c);u!==void 0&&(e.delete(c),u.dispose())}function a(){e=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:r,dispose:a}}function ivt(t){const e={};function n(r){if(e[r]!==void 0)return e[r];let i;switch(r){case"WEBGL_depth_texture":i=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=t.getExtension(r)}return e[r]=i,i}return{has:function(r){return n(r)!==null},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(r){const i=n(r);return i===null&&qw("THREE.WebGLRenderer: "+r+" extension not supported."),i}}}function svt(t,e,n,r){const i={},s=new WeakMap;function a(f){const h=f.target;h.index!==null&&e.remove(h.index);for(const m in h.attributes)e.remove(h.attributes[m]);for(const m in h.morphAttributes){const x=h.morphAttributes[m];for(let y=0,g=x.length;y<g;y++)e.remove(x[y])}h.removeEventListener("dispose",a),delete i[h.id];const p=s.get(h);p&&(e.remove(p),s.delete(h)),r.releaseStatesOfGeometry(h),h.isInstancedBufferGeometry===!0&&delete h._maxInstanceCount,n.memory.geometries--}function l(f,h){return i[h.id]===!0||(h.addEventListener("dispose",a),i[h.id]=!0,n.memory.geometries++),h}function c(f){const h=f.attributes;for(const m in h)e.update(h[m],t.ARRAY_BUFFER);const p=f.morphAttributes;for(const m in p){const x=p[m];for(let y=0,g=x.length;y<g;y++)e.update(x[y],t.ARRAY_BUFFER)}}function u(f){const h=[],p=f.index,m=f.attributes.position;let x=0;if(p!==null){const w=p.array;x=p.version;for(let v=0,N=w.length;v<N;v+=3){const S=w[v+0],_=w[v+1],j=w[v+2];h.push(S,_,_,j,j,S)}}else if(m!==void 0){const w=m.array;x=m.version;for(let v=0,N=w.length/3-1;v<N;v+=3){const S=v+0,_=v+1,j=v+2;h.push(S,_,_,j,j,S)}}else return;const y=new(Tpe(h)?Lpe:Dpe)(h,1);y.version=x;const g=s.get(f);g&&e.remove(g),s.set(f,y)}function d(f){const h=s.get(f);if(h){const p=f.index;p!==null&&h.version<p.version&&u(f)}else u(f);return s.get(f)}return{get:l,update:c,getWireframeAttribute:d}}function avt(t,e,n){let r;function i(h){r=h}let s,a;function l(h){s=h.type,a=h.bytesPerElement}function c(h,p){t.drawElements(r,p,s,h*a),n.update(p,r,1)}function u(h,p,m){m!==0&&(t.drawElementsInstanced(r,p,s,h*a,m),n.update(p,r,m))}function d(h,p,m){if(m===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(r,p,0,s,h,0,m);let y=0;for(let g=0;g<m;g++)y+=p[g];n.update(y,r,1)}function f(h,p,m,x){if(m===0)return;const y=e.get("WEBGL_multi_draw");if(y===null)for(let g=0;g<h.length;g++)u(h[g]/a,p[g],x[g]);
vendor: 12,595 bytes, lines 4608-4610
4608else{y.multiDrawElementsInstancedWEBGL(r,p,0,s,h,0,x,0,m);let g=0;for(let w=0;w<m;w++)g+=p[w];for(let w=0;w<x.length;w++)n.update(g,r,x[w])}}this.setMode=i,this.setIndex=l,this.render=c,this.renderInstances=u,this.renderMultiDraw=d,this.renderMultiDrawInstances=f}function ovt(t){const e={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function r(s,a,l){switch(n.calls++,a){case t.TRIANGLES:n.triangles+=l*(s/3);break;case t.LINES:n.lines+=l*(s/2);break;case t.LINE_STRIP:n.lines+=l*(s-1);break;case t.LINE_LOOP:n.lines+=l*s;break;case t.POINTS:n.points+=l*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function i(){n.calls=0,n.triangles=0,n.points=0,n.lines=0}return{memory:e,render:n,programs:null,autoReset:!0,reset:i,update:r}}function lvt(t,e,n){const r=new WeakMap,i=new ps;function s(a,l,c){const u=a.morphTargetInfluences,d=l.morphAttributes.position||l.morphAttributes.normal||l.morphAttributes.color,f=d!==void 0?d.length:0;let h=r.get(l);if(h===void 0||h.count!==f){let k=function(){A.dispose(),r.delete(l),l.removeEventListener("dispose",k)};var p=k;h!==void 0&&h.texture.dispose();const m=l.morphAttributes.position!==void 0,x=l.morphAttributes.normal!==void 0,y=l.morphAttributes.color!==void 0,g=l.morphAttributes.position||[],w=l.morphAttributes.normal||[],v=l.morphAttributes.color||[];let N=0;m===!0&&(N=1),x===!0&&(N=2),y===!0&&(N=3);let S=l.attributes.position.count*N,_=1;S>e.maxTextureSize&&(_=Math.ceil(S/e.maxTextureSize),S=e.maxTextureSize);const j=new Float32Array(S*_*4*f),A=new Ppe(j,S,_,f);A.type=rd,A.needsUpdate=!0;const C=N*4;for(let M=0;M<f;M++){const I=g[M],R=w[M],E=v[M],P=S*_*4*M;for(let O=0;O<I.count;O++){const L=O*C;m===!0&&(i.fromBufferAttribute(I,O),j[P+L+0]=i.x,j[P+L+1]=i.y,j[P+L+2]=i.z,j[P+L+3]=0),x===!0&&(i.fromBufferAttribute(R,O),j[P+L+4]=i.x,j[P+L+5]=i.y,j[P+L+6]=i.z,j[P+L+7]=0),y===!0&&(i.fromBufferAttribute(E,O),j[P+L+8]=i.x,j[P+L+9]=i.y,j[P+L+10]=i.z,j[P+L+11]=E.itemSize===4?i.w:1)}}h={count:f,texture:A,size:new Mn(S,_)},r.set(l,h),l.addEventListener("dispose",k)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)c.getUniforms().setValue(t,"morphTexture",a.morphTexture,n);else{let m=0;for(let y=0;y<u.length;y++)m+=u[y];const x=l.morphTargetsRelative?1:1-m;c.getUniforms().setValue(t,"morphTargetBaseInfluence",x),c.getUniforms().setValue(t,"morphTargetInfluences",u)}c.getUniforms().setValue(t,"morphTargetsTexture",h.texture,n),c.getUniforms().setValue(t,"morphTargetsTextureSize",h.size)}return{update:s}}function cvt(t,e,n,r){let i=new WeakMap;function s(c){const u=r.render.frame,d=c.geometry,f=e.get(c,d);if(i.get(f)!==u&&(e.update(f),i.set(f,u)),c.isInstancedMesh&&(c.hasEventListener("dispose",l)===!1&&c.addEventListener("dispose",l),i.get(c)!==u&&(n.update(c.instanceMatrix,t.ARRAY_BUFFER),c.instanceColor!==null&&n.update(c.instanceColor,t.ARRAY_BUFFER),i.set(c,u))),c.isSkinnedMesh){const h=c.skeleton;i.get(h)!==u&&(h.update(),i.set(h,u))}return f}function a(){i=new WeakMap}function l(c){const u=c.target;u.removeEventListener("dispose",l),n.remove(u.instanceMatrix),u.instanceColor!==null&&n.remove(u.instanceColor)}return{update:s,dispose:a}}class Hpe extends Ha{constructor(e,n,r,i,s,a,l,c,u,d=Oy){if(d!==Oy&&d!==Wv)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");r===void 0&&d===Oy&&(r=Zm),r===void 0&&d===Wv&&(r=Hv),super(null,i,s,a,l,c,d,r,u),this.isDepthTexture=!0,this.image={width:e,height:n},this.magFilter=l!==void 0?l:sl,this.minFilter=c!==void 0?c:sl,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const n=super.toJSON(e);return this.compareFunction!==null&&(n.compareFunction=this.compareFunction),n}}const Wpe=new Ha,TX=new Hpe(1,1),Gpe=new Ppe,qpe=new Kmt,Kpe=new Upe,MX=[],PX=[],OX=new Float32Array(16),RX=new Float32Array(9),IX=new Float32Array(4);function K0(t,e,n){const r=t[0];if(r<=0||r>0)return t;const i=e*n;let s=MX[i];if(s===void 0&&(s=new Float32Array(i),MX[i]=s),e!==0){r.toArray(s,0);for(let a=1,l=0;a!==e;++a)l+=n,t[a].toArray(s,l)}return s}function ns(t,e){if(t.length!==e.length)return!1;for(let n=0,r=t.length;n<r;n++)if(t[n]!==e[n])return!1;return!0}function rs(t,e){for(let n=0,r=e.length;n<r;n++)t[n]=e[n]}function eP(t,e){let n=PX[e];n===void 0&&(n=new Int32Array(e),PX[e]=n);for(let r=0;r!==e;++r)n[r]=t.allocateTextureUnit();return n}function uvt(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function dvt(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(ns(n,e))return;t.uniform2fv(this.addr,e),rs(n,e)}}function fvt(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(e.r!==void 0)(n[0]!==e.r||n[1]!==e.g||n[2]!==e.b)&&(t.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(ns(n,e))return;t.uniform3fv(this.addr,e),rs(n,e)}}function hvt(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(ns(n,e))return;t.uniform4fv(this.addr,e),rs(n,e)}}function pvt(t,e){const n=this.cache,r=e.elements;if(r===void 0){if(ns(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),rs(n,e)}else{if(ns(n,r))return;IX.set(r),t.uniformMatrix2fv(this.addr,!1,IX),rs(n,r)}}function mvt(t,e){const n=this.cache,r=e.elements;if(r===void 0){if(ns(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),rs(n,e)}else{if(ns(n,r))return;RX.set(r),t.uniformMatrix3fv(this.addr,!1,RX),rs(n,r)}}function gvt(t,e){const n=this.cache,r=e.elements;if(r===void 0){if(ns(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),rs(n,e)}else{if(ns(n,r))return;OX.set(r),t.uniformMatrix4fv(this.addr,!1,OX),rs(n,r)}}function xvt(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function yvt(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2i(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(ns(n,e))return;t.uniform2iv(this.addr,e),rs(n,e)}}function vvt(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3i(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(ns(n,e))return;t.uniform3iv(this.addr,e),rs(n,e)}}function bvt(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4i(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(ns(n,e))return;t.uniform4iv(this.addr,e),rs(n,e)}}function wvt(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function _vt(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2ui(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(ns(n,e))return;t.uniform2uiv(this.addr,e),rs(n,e)}}function Svt(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3ui(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(ns(n,e))return;t.uniform3uiv(this.addr,e),rs(n,e)}}function Nvt(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4ui(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(ns(n,e))return;t.uniform4uiv(this.addr,e),rs(n,e)}}function jvt(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i);let s;this.type===t.SAMPLER_2D_SHADOW?(TX.compareFunction=Ape,s=TX):s=Wpe,n.setTexture2D(e||s,i)}function Cvt(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(e||qpe,i)}function kvt(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTextureCube(e||Kpe,i)}function Evt(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(e||Gpe,i)}function Avt(t){switch(t){case 5126:return uvt;case 35664:return dvt;case 35665:return fvt;case 35666:return hvt;case 35674:return pvt;case 35675:return mvt;case 35676:return gvt;case 5124:case 35670:return xvt;case 35667:case 35671:return yvt;case 35668:case 35672:return vvt;case 35669:case 35673:return bvt;case 5125:return wvt;case 36294:return _vt;case 36295:return Svt;case 36296:return Nvt;case 35678:case 36198:case 36298:case 36306:case 35682:return jvt;case 35679:case 36299:case 36307:return Cvt;case 35680:case 36300:case 36308:case 36293:return kvt;case 36289:case 36303:case 36311:case 36292:return Evt}}function Tvt(t,e){t.uniform1fv(this.addr,e)}function Mvt(t,e){const n=K0(e,this.size,2);t.uniform2fv(this.addr,n)}function Pvt(t,e){const n=K0(e,this.size,3);t.uniform3fv(this.addr,n)}function Ovt(t,e){const n=K0(e,this.size,4);t.uniform4fv(this.addr,n)}function Rvt(t,e){const n=K0(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function Ivt(t,e){const n=K0(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function Dvt(t,e){const n=K0(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function Lvt(t,e){t.uniform1iv(this.addr,e)}function $vt(t,e){t.uniform2iv(this.addr,e)}function Fvt(t,e){t.uniform3iv(this.addr,e)}function Uvt(t,e){t.uniform4iv(this.addr,e)}function zvt(t,e){t.uniform1uiv(this.addr,e)}function Bvt(t,e){t.uniform2uiv(this.addr,e)}function Vvt(t,e){t.uniform3uiv(this.addr,e)}function Hvt(t,e){t.uniform4uiv(this.addr,e)}function Wvt(t,e,n){const r=this.cache,i=e.length,s=eP(n,i);ns(r,s)||(t.uniform1iv(this.addr,s),rs(r,s));for(let a=0;a!==i;++a)n.setTexture2D(e[a]||Wpe,s[a])}function Gvt(t,e,n){const r=this.cache,i=e.length,s=eP(n,i);ns(r,s)||(t.uniform1iv(this.addr,s),rs(r,s));for(let a=0;a!==i;++a)n.setTexture3D(e[a]||qpe,s[a])}function qvt(t,e,n){const r=this.cache,i=e.length,s=eP(n,i);ns(r,s)||(t.uniform1iv(this.addr,s),rs(r,s));for(let a=0;a!==i;++a)n.setTextureCube(e[a]||Kpe,s[a])}function Kvt(t,e,n){const r=this.cache,i=e.length,s=eP(n,i);ns(r,s)||(t.uniform1iv(this.addr,s),rs(r,s));for(let a=0;a!==i;++a)n.setTexture2DArray(e[a]||Gpe,s[a])}function Yvt(t){switch(t){case 5126:return Tvt;case 35664:return Mvt;case 35665:return Pvt;case 35666:return Ovt;case 35674:return Rvt;case 35675:return Ivt;case 35676:return Dvt;case 5124:case 35670:return Lvt;case 35667:case 35671:return $vt;case 35668:case 35672:return Fvt;case 35669:case 35673:return Uvt;case 5125:return zvt;case 36294:return Bvt;case 36295:return Vvt;case 36296:return Hvt;case 35678:case 36198:case 36298:case 36306:case 35682:return Wvt;case 35679:case 36299:case 36307:return Gvt;case 35680:case 36300:case 36308:case 36293:return qvt;case 36289:case 36303:case 36311:case 36292:return Kvt}}class Xvt{constructor(e,n,r){this.id=e,this.addr=r,this.cache=[],this.type=n.type,this.setValue=Avt(n.type)}}class Qvt{constructor(e,n,r){this.id=e,this.addr=r,this.cache=[],this.type=n.type,this.size=n.size,this.setValue=Yvt(n.type)}}class Jvt{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,n,r){const i=this.seq;for(let s=0,a=i.length;s!==a;++s){const l=i[s];l.setValue(e,n[l.id],r)}}}const WI=/(\w+)(\])?(\[|\.)?/g;function DX(t,e){t.seq.push(e),t.map[e.id]=e}function Zvt(t,e,n){const r=t.name,i=r.length;for(WI.lastIndex=0;;){const s=WI.exec(r),a=WI.lastIndex;let l=s[1];const c=s[2]==="]",u=s[3];if(c&&(l=l|0),u===void 0||u==="["&&a+2===i){DX(n,u===void 0?new Xvt(l,t,e):new Qvt(l,t,e));break}else{let f=n.map[l];f===void 0&&(f=new Jvt(l),DX(n,f)),n=f}}}class rk{constructor(e,n){this.seq=[],this.map={};const r=e.getProgramParameter(n,e.ACTIVE_UNIFORMS);for(let i=0;i<r;++i){const s=e.getActiveUniform(n,i),a=e.getUniformLocation(n,s.name);Zvt(s,a,this)}}setValue(e,n,r,i){const s=this.map[n];s!==void 0&&s.setValue(e,r,i)}setOptional(e,n,r){const i=n[r];i!==void 0&&this.setValue(e,r,i)}static upload(e,n,r,i){for(let s=0,a=n.length;s!==a;++s){const l=n[s],c=r[l.id];c.needsUpdate!==!1&&l.setValue(e,c.value,i)}}static seqWithValue(e,n){const r=[];for(let i=0,s=e.length;i!==s;++i){const a=e[i];a.id in n&&r.push(a)}return r}}function LX(t,e,n){const r=t.createShader(e);return t.shaderSource(r,n),t.compileShader(r),r}const e0t=37297;let t0t=0;function n0t(t,e){const n=t.split(`
4609`),r=[],i=Math.max(e-6,0),s=Math.min(e+6,n.length);for(let a=i;a<s;a++){const l=a+1;r.push(`${l===e?">":" "} ${l}: ${n[a]}`)}return r.join(`
4610`)}function r0t(t){const e=Xn.getPrimaries(Xn.workingColorSpace),n=Xn.getPrimaries(t);let r;switch(e===n?r="":e===yE&&n===xE?r="LinearDisplayP3ToLinearSRGB":e===xE&&n===yE&&(r="LinearSRGBToLinearDisplayP3"),t){case rp:case JM:return[r,"LinearTransferOETF"];
vendor: 5,063 bytes, lines 4610-4637
4610case Mc:case ZB:return[r,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",t),[r,"LinearTransferOETF"]}}function $X(t,e,n){const r=t.getShaderParameter(e,t.COMPILE_STATUS),i=t.getShaderInfoLog(e).trim();if(r&&i==="")return"";const s=/ERROR: 0:(\d+)/.exec(i);if(s){const a=parseInt(s[1]);return n.toUpperCase()+`
4611
4612`+i+`
4613
4614`+n0t(t.getShaderSource(e),a)}else return i}function i0t(t,e){const n=r0t(e);return`vec4 ${t}( vec4 value ) { return ${n[0]}( ${n[1]}( value ) ); }`}function s0t(t,e){let n;switch(e){case wmt:n="Linear";break;case _mt:n="Reinhard";break;case Smt:n="OptimizedCineon";break;case Nmt:n="ACESFilmic";break;case Cmt:n="AgX";break;case kmt:n="Neutral";break;case jmt:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const Bj=new Re;function a0t(){Xn.getLuminanceCoefficients(Bj);const t=Bj.x.toFixed(4),e=Bj.y.toFixed(4),n=Bj.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",`	const vec3 weights = vec3( ${t}, ${e}, ${n} );`,"	return dot( weights, rgb );","}"].join(`
4615`)}function o0t(t){return[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(gw).join(`
4616`)}function l0t(t){const e=[];for(const n in t){const r=t[n];r!==!1&&e.push("#define "+n+" "+r)}return e.join(`
4617`)}function c0t(t,e){const n={},r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let i=0;i<r;i++){const s=t.getActiveAttrib(e,i),a=s.name;let l=1;s.type===t.FLOAT_MAT2&&(l=2),s.type===t.FLOAT_MAT3&&(l=3),s.type===t.FLOAT_MAT4&&(l=4),n[a]={type:s.type,location:t.getAttribLocation(e,a),locationSize:l}}return n}function gw(t){return t!==""}function FX(t,e){const n=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function UX(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const u0t=/^[ \t]*#include +<([\w\d./]+)>/gm;function j5(t){return t.replace(u0t,f0t)}const d0t=new Map;function f0t(t,e){let n=bn[e];if(n===void 0){const r=d0t.get(e);if(r!==void 0)n=bn[r],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,r);else throw new Error("Can not resolve #include <"+e+">")}return j5(n)}const h0t=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function zX(t){return t.replace(h0t,p0t)}function p0t(t,e,n,r){let i="";for(let s=parseInt(e);s<parseInt(n);s++)i+=r.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return i}function BX(t){let e=`precision ${t.precision} float;
4618	precision ${t.precision} int;
4619	precision ${t.precision} sampler2D;
4620	precision ${t.precision} samplerCube;
4621	precision ${t.precision} sampler3D;
4622	precision ${t.precision} sampler2DArray;
4623	precision ${t.precision} sampler2DShadow;
4624	precision ${t.precision} samplerCubeShadow;
4625	precision ${t.precision} sampler2DArrayShadow;
4626	precision ${t.precision} isampler2D;
4627	precision ${t.precision} isampler3D;
4628	precision ${t.precision} isamplerCube;
4629	precision ${t.precision} isampler2DArray;
4630	precision ${t.precision} usampler2D;
4631	precision ${t.precision} usampler3D;
4632	precision ${t.precision} usamplerCube;
4633	precision ${t.precision} usampler2DArray;
4634	`;return t.precision==="highp"?e+=`
4635#define HIGH_PRECISION`:t.precision==="mediump"?e+=`
4636#define MEDIUM_PRECISION`:t.precision==="lowp"&&(e+=`
4637#define LOW_PRECISION`),e}function m0t(t){let e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===gpe?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===qpt?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===Lu&&(e="SHADOWMAP_TYPE_VSM"),e}function g0t(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case Bv:case Vv:e="ENVMAP_TYPE_CUBE";break;case QM:e="ENVMAP_TYPE_CUBE_UV";break}return e}function x0t(t){let e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case Vv:e="ENVMAP_MODE_REFRACTION";break}return e}function y0t(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case xpe:e="ENVMAP_BLENDING_MULTIPLY";break;case vmt:e="ENVMAP_BLENDING_MIX";break;case bmt:e="ENVMAP_BLENDING_ADD";break}return e}function v0t(t){const e=t.envMapCubeUVHeight;if(e===null)return null;const n=Math.log2(e)-2,r=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,n),7*16)),texelHeight:r,max
vendor: 5,982 bytes, lines 4637-4644
4637Mip:n}}function b0t(t,e,n,r){const i=t.getContext(),s=n.defines;let a=n.vertexShader,l=n.fragmentShader;const c=m0t(n),u=g0t(n),d=x0t(n),f=y0t(n),h=v0t(n),p=o0t(n),m=l0t(s),x=i.createProgram();let y,g,w=n.glslVersion?"#version "+n.glslVersion+`
4638`:"";n.isRawShaderMaterial?(y=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m].filter(gw).join(`
4639`),y.length>0&&(y+=`
4640`),g=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m].filter(gw).join(`
4641`),g.length>0&&(g+=`
4642`)):(y=[BX(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+d:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","	attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","	attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","	uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","	attribute vec2 uv1;","#endif","#ifdef USE_UV2","	attribute vec2 uv2;","#endif","#ifdef USE_UV3","	attribute vec2 uv3;","#endif","#ifdef USE_TANGENT","	attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","	attribute vec4 color;","#elif defined( USE_COLOR )","	attribute vec3 color;","#endif","#ifdef USE_SKINNING","	attribute vec4 skinIndex;","	attribute vec4 skinWeight;","#endif",`
4643`].filter(gw).join(`
4644`),g=[BX(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alph
vendor: 4,086 bytes, lines 4644-4651
4644aToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+u:"",n.envMap?"#define "+d:"",n.envMap?"#define "+f:"",h?"#define CUBEUV_TEXEL_WIDTH "+h.texelWidth:"",h?"#define CUBEUV_TEXEL_HEIGHT "+h.texelHeight:"",h?"#define CUBEUV_MAX_MIP "+h.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==xh?"#define TONE_MAPPING":"",n.toneMapping!==xh?bn.tonemapping_pars_fragment:"",n.toneMapping!==xh?s0t("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",bn.colorspace_pars_fragment,i0t("linearToOutputTexel",n.outputColorSpace),a0t(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",`
4645`].filter(gw).join(`
4646`)),a=j5(a),a=FX(a,n),a=UX(a,n),l=j5(l),l=FX(l,n),l=UX(l,n),a=zX(a),l=zX(l),n.isRawShaderMaterial!==!0&&(w=`#version 300 es
4647`,y=[p,"#define attribute in","#define varying out","#define texture2D texture"].join(`
4648`)+`
4649`+y,g=["#define varying in",n.glslVersion===rX?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===rX?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
4650`)+`
4651`+g);const v=w+y+a,N=w+g+l,S=LX(i,i.VERTEX_SHADER,v),_=LX(i,i.FRAGMENT_SHADER,N);i.attachShader(x,S),i.attachShader(x,_),n.index0AttributeName!==void 0?i.bindAttribLocation(x,0,n.index0AttributeName):n.morphTargets===!0&&i.bindAttribLocation(x,0,"position"),i.linkProgram(x);
vendor: 4,835 bytes, lines 4651-4658
4651function j(M){if(t.debug.checkShaderErrors){const I=i.getProgramInfoLog(x).trim(),R=i.getShaderInfoLog(S).trim(),E=i.getShaderInfoLog(_).trim();let P=!0,O=!0;if(i.getProgramParameter(x,i.LINK_STATUS)===!1)if(P=!1,typeof t.debug.onShaderError=="function")t.debug.onShaderError(i,x,S,_);else{const L=$X(i,S,"vertex"),T=$X(i,_,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(x,i.VALIDATE_STATUS)+`
4652
4653Material Name: `+M.name+`
4654Material Type: `+M.type+`
4655
4656Program Info Log: `+I+`
4657`+L+`
4658`+T)}else I!==""?console.warn("THREE.WebGLProgram: Program Info Log:",I):(R===""||E==="")&&(O=!1);O&&(M.diagnostics={runnable:P,programLog:I,vertexShader:{log:R,prefix:y},fragmentShader:{log:E,prefix:g}})}i.deleteShader(S),i.deleteShader(_),A=new rk(i,x),C=c0t(i,x)}let A;this.getUniforms=function(){return A===void 0&&j(this),A};let C;this.getAttributes=function(){return C===void 0&&j(this),C};let k=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return k===!1&&(k=i.getProgramParameter(x,e0t)),k},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(x),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=t0t++,this.cacheKey=e,this.usedTimes=1,this.program=x,this.vertexShader=S,this.fragmentShader=_,this}let w0t=0;class _0t{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const n=e.vertexShader,r=e.fragmentShader,i=this._getShaderStage(n),s=this._getShaderStage(r),a=this._getShaderCacheForMaterial(e);return a.has(i)===!1&&(a.add(i),i.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const n=this.materialCache.get(e);for(const r of n)r.usedTimes--,r.usedTimes===0&&this.shaderCache.delete(r.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const n=this.materialCache;let r=n.get(e);return r===void 0&&(r=new Set,n.set(e,r)),r}_getShaderStage(e){const n=this.shaderCache;let r=n.get(e);return r===void 0&&(r=new S0t(e),n.set(e,r)),r}}class S0t{constructor(e){this.id=w0t++,this.code=e,this.usedTimes=0}}function N0t(t,e,n,r,i,s,a){const l=new Ope,c=new _0t,u=new Set,d=[],f=i.logarithmicDepthBuffer,h=i.vertexTextures;let p=i.precision;const m={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function x(C){return u.add(C),C===0?"uv":`uv${C}`}function y(C,k,M,I,R){const E=I.fog,P=R.geometry,O=C.isMeshStandardMaterial?I.environment:null,L=(C.isMeshStandardMaterial?n:e).get(C.envMap||O),T=L&&L.mapping===QM?L.image.height:null,D=m[C.type];C.precision!==null&&(p=i.getMaxPrecision(C.precision),p!==C.precision&&console.warn("THREE.WebGLProgram.getParameters:",C.precision,"not supported, using",p,"instead."));const F=P.morphAttributes.position||P.morphAttributes.normal||P.morphAttributes.color,q=F!==void 0?F.length:0;let B=0;P.morphAttributes.position!==void 0&&(B=1),P.morphAttributes.normal!==void 0&&(B=2),P.morphAttributes.color!==void 0&&(B=3);let z,H,W,G;if(D){const me=Lc[D];z=me.vertexShader,H=me.fragmentShader}else z=C.vertexShader,H=C.fragmentShader,c.update(C),W=c.getVertexShaderID(C),G=c.getFragmentShaderID(C);const K=t.getRenderTarget(),ee=R.isInstancedMesh===!0,V=R.isBatchedMesh===!0,J=!!C.map,Y=!!C.matcap,$=!!L,fe=!!C.aoMap,ce=!!C.lightMap,ve=!!C.bumpMap,X=!!C.normalMap,de=!!C.displacementMap,Te=!!C.emissiveMap,Pe=!!C.metalnessMap,se=!!C.roughnessMap,U=C.anisotropy>0,Q=C.clearcoat>0,oe=C.dispersion>0,_e=C.iridescence>0,ye=C.sheen>0,re=C.transmission>0,he=U&&!!C.anisotropyMap,pe=Q&&!!C.clearcoatMap,je=Q&&!!C.clearcoatNormalMap,ae=Q&&!!C.clearcoatRoughnessMap,we=_e&&!!C.iridescenceMap,Ie=_e&&!!C.iridescenceThicknessMap,Ue=ye&&!!C.sheenColorMap,Oe=ye&&!!C.sheenRoughnessMap,ie=!!C.specularMap,De=!!C.specularColorMap,Ve=!!C.specularIntensityMap,xe=re&&!!C.transmissionMap,$e=re&&!!C.thicknessMap,ue=!!C.gradientMap,Ne=!!C.alphaMap,Le=C.alphaTest>0,tt=!!C.alphaHash,St=!!C.extensions;let rt=xh;C.toneMapped&&(K===null||K.isXRRenderTarget===!0)&&(rt=t.toneMapping);const vt={shaderID:D,shaderType:C.type,shaderName:C.name,vertexShader:z,fragmentShader:H,defines:C.defines,customVertexShaderID:W,customFragmentShaderID:G,isRawShaderMaterial:C.isRawShaderMaterial===!0,glslVersion:C.glslVersion,precision:p,batching:V,batchingColor:V&&R._c
vendor: 5,859 bytes, line 4658
4658olorsTexture!==null,instancing:ee,instancingColor:ee&&R.instanceColor!==null,instancingMorph:ee&&R.morphTexture!==null,supportsVertexTextures:h,outputColorSpace:K===null?t.outputColorSpace:K.isXRRenderTarget===!0?K.texture.colorSpace:rp,alphaToCoverage:!!C.alphaToCoverage,map:J,matcap:Y,envMap:$,envMapMode:$&&L.mapping,envMapCubeUVHeight:T,aoMap:fe,lightMap:ce,bumpMap:ve,normalMap:X,displacementMap:h&&de,emissiveMap:Te,normalMapObjectSpace:X&&C.normalMapType===Pmt,normalMapTangentSpace:X&&C.normalMapType===Mmt,metalnessMap:Pe,roughnessMap:se,anisotropy:U,anisotropyMap:he,clearcoat:Q,clearcoatMap:pe,clearcoatNormalMap:je,clearcoatRoughnessMap:ae,dispersion:oe,iridescence:_e,iridescenceMap:we,iridescenceThicknessMap:Ie,sheen:ye,sheenColorMap:Ue,sheenRoughnessMap:Oe,specularMap:ie,specularColorMap:De,specularIntensityMap:Ve,transmission:re,transmissionMap:xe,thicknessMap:$e,gradientMap:ue,opaque:C.transparent===!1&&C.blending===Py&&C.alphaToCoverage===!1,alphaMap:Ne,alphaTest:Le,alphaHash:tt,combine:C.combine,mapUv:J&&x(C.map.channel),aoMapUv:fe&&x(C.aoMap.channel),lightMapUv:ce&&x(C.lightMap.channel),bumpMapUv:ve&&x(C.bumpMap.channel),normalMapUv:X&&x(C.normalMap.channel),displacementMapUv:de&&x(C.displacementMap.channel),emissiveMapUv:Te&&x(C.emissiveMap.channel),metalnessMapUv:Pe&&x(C.metalnessMap.channel),roughnessMapUv:se&&x(C.roughnessMap.channel),anisotropyMapUv:he&&x(C.anisotropyMap.channel),clearcoatMapUv:pe&&x(C.clearcoatMap.channel),clearcoatNormalMapUv:je&&x(C.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ae&&x(C.clearcoatRoughnessMap.channel),iridescenceMapUv:we&&x(C.iridescenceMap.channel),iridescenceThicknessMapUv:Ie&&x(C.iridescenceThicknessMap.channel),sheenColorMapUv:Ue&&x(C.sheenColorMap.channel),sheenRoughnessMapUv:Oe&&x(C.sheenRoughnessMap.channel),specularMapUv:ie&&x(C.specularMap.channel),specularColorMapUv:De&&x(C.specularColorMap.channel),specularIntensityMapUv:Ve&&x(C.specularIntensityMap.channel),transmissionMapUv:xe&&x(C.transmissionMap.channel),thicknessMapUv:$e&&x(C.thicknessMap.channel),alphaMapUv:Ne&&x(C.alphaMap.channel),vertexTangents:!!P.attributes.tangent&&(X||U),vertexColors:C.vertexColors,vertexAlphas:C.vertexColors===!0&&!!P.attributes.color&&P.attributes.color.itemSize===4,pointsUvs:R.isPoints===!0&&!!P.attributes.uv&&(J||Ne),fog:!!E,useFog:C.fog===!0,fogExp2:!!E&&E.isFogExp2,flatShading:C.flatShading===!0,sizeAttenuation:C.sizeAttenuation===!0,logarithmicDepthBuffer:f,skinning:R.isSkinnedMesh===!0,morphTargets:P.morphAttributes.position!==void 0,morphNormals:P.morphAttributes.normal!==void 0,morphColors:P.morphAttributes.color!==void 0,morphTargetsCount:q,morphTextureStride:B,numDirLights:k.directional.length,numPointLights:k.point.length,numSpotLights:k.spot.length,numSpotLightMaps:k.spotLightMap.length,numRectAreaLights:k.rectArea.length,numHemiLights:k.hemi.length,numDirLightShadows:k.directionalShadowMap.length,numPointLightShadows:k.pointShadowMap.length,numSpotLightShadows:k.spotShadowMap.length,numSpotLightShadowsWithMaps:k.numSpotLightShadowsWithMaps,numLightProbes:k.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:C.dithering,shadowMapEnabled:t.shadowMap.enabled&&M.length>0,shadowMapType:t.shadowMap.type,toneMapping:rt,decodeVideoTexture:J&&C.map.isVideoTexture===!0&&Xn.getTransfer(C.map.colorSpace)===Fr,premultipliedAlpha:C.premultipliedAlpha,doubleSided:C.side===Yu,flipSided:C.side===Va,useDepthPacking:C.depthPacking>=0,depthPacking:C.depthPacking||0,index0AttributeName:C.index0AttributeName,extensionClipCullDistance:St&&C.extensions.clipCullDistance===!0&&r.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(St&&C.extensions.multiDraw===!0||V)&&r.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:r.has("KHR_parallel_shader_compile"),customProgramCacheKey:C.customProgramCacheKey()};return vt.vertexUv1s=u.has(1),vt.vertexUv2s=u.has(2),vt.vertexUv3s=u.has(3),u.clear(),vt}function g(C){const k=[];if(C.shaderID?k.push(C.shaderID):(k.push(C.customVertexShaderID),k.push(C.customFragmentShaderID)),C.defines!==void 0)for(const M in C.defines)k.push(M),k.push(C.defines[M]);return C.isRawShaderMaterial===!1&&(w(k,C),v(k,C),k.push(t.outputColorSpace)),k.push(C.customProgramCacheKey),k.join()}function w(C,k){C.push(k.precision),C.push(k.outputColorSpace),C.push(k.envMapMode),C.push(k.envMapCubeUVHeight),C.push(k.mapUv),C.push(k.alphaMapUv),C.push(k.lightMapUv),C.push(k.aoMapUv),C.push(k.bumpMapUv),C.push(k.normalMapUv),C.push(k.displacementMapUv),C.push(k.emissiveMapUv),C.push(k.metalnessMapUv),C.push(k.roughnessMapUv),C.push(k.anisotropyMapUv),C.push(k.clearcoatMapUv),C.push(k.clearcoatNormalMapUv),C.push(k.clearcoatRoughnessMapUv),C.push(k.iridescenceMapUv),C.push(k.iridescenceThicknessMapUv),C.push(k.sheenColorMapUv),C.push(k.sheenRoughnessMapUv),C.push(k.specularMapUv),C.push(k.specularColorMapUv),C.push(k.specularIntensityMapUv),C.push(k.transmissionMapUv),C.push(k.thicknessMapUv),C.push(k.combine),C.push(k.fogExp2),C.push(k.sizeAttenuation),C.push(k.morphTargetsCount),C.push(k.morphAttributeCount),C.push(k.numDirLights),C.push(k.numPointLights),C.push(k.numSpotLights),C.push(k.numSpotLightMaps),C.push(k.numHemiLights),C.push(k.numRectAreaLights),C.push(k.numDirLightShadows),C.push(k.numPointLightShadows),C.push(k.numSpotLightShadows),C.push(k.numSpotLightShadowsWithMaps),C.push(k.numLightProbes),C.push(k.shadowMapType),C.push(k.toneMapping),C.push(k.numClippingPlanes),C.push(k.numClipIntersection),C.push(k.depthPacking)}function v(C,k){l.disableAll(),k.supportsVertexTextures&&l.enable(0),k.instancing&&l.enable(1),k.instancingColor&&l.enable(2),k.instancingMorph&&l.enable(3),k.matcap&&l.enable(4),k.envMap&&l.enable(5),k.normalMapObjectSpace&&l.enable(6),k.normalMapTangentSpace&&l.enable(7),k.clearcoat&&l.enable(8),k.iridescence&&l.enable(9),k.alph
vendor: 4,406 bytes, line 4658
4658aTest&&l.enable(10),k.vertexColors&&l.enable(11),k.vertexAlphas&&l.enable(12),k.vertexUv1s&&l.enable(13),k.vertexUv2s&&l.enable(14),k.vertexUv3s&&l.enable(15),k.vertexTangents&&l.enable(16),k.anisotropy&&l.enable(17),k.alphaHash&&l.enable(18),k.batching&&l.enable(19),k.dispersion&&l.enable(20),k.batchingColor&&l.enable(21),C.push(l.mask),l.disableAll(),k.fog&&l.enable(0),k.useFog&&l.enable(1),k.flatShading&&l.enable(2),k.logarithmicDepthBuffer&&l.enable(3),k.skinning&&l.enable(4),k.morphTargets&&l.enable(5),k.morphNormals&&l.enable(6),k.morphColors&&l.enable(7),k.premultipliedAlpha&&l.enable(8),k.shadowMapEnabled&&l.enable(9),k.doubleSided&&l.enable(10),k.flipSided&&l.enable(11),k.useDepthPacking&&l.enable(12),k.dithering&&l.enable(13),k.transmission&&l.enable(14),k.sheen&&l.enable(15),k.opaque&&l.enable(16),k.pointsUvs&&l.enable(17),k.decodeVideoTexture&&l.enable(18),k.alphaToCoverage&&l.enable(19),C.push(l.mask)}function N(C){const k=m[C.type];let M;if(k){const I=Lc[k];M=ogt.clone(I.uniforms)}else M=C.uniforms;return M}function S(C,k){let M;for(let I=0,R=d.length;I<R;I++){const E=d[I];if(E.cacheKey===k){M=E,++M.usedTimes;break}}return M===void 0&&(M=new b0t(t,k,C,s),d.push(M)),M}function _(C){if(--C.usedTimes===0){const k=d.indexOf(C);d[k]=d[d.length-1],d.pop(),C.destroy()}}function j(C){c.remove(C)}function A(){c.dispose()}return{getParameters:y,getProgramCacheKey:g,getUniforms:N,acquireProgram:S,releaseProgram:_,releaseShaderCache:j,programs:d,dispose:A}}function j0t(){let t=new WeakMap;function e(s){let a=t.get(s);return a===void 0&&(a={},t.set(s,a)),a}function n(s){t.delete(s)}function r(s,a,l){t.get(s)[a]=l}function i(){t=new WeakMap}return{get:e,remove:n,update:r,dispose:i}}function C0t(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function VX(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function HX(){const t=[];let e=0;const n=[],r=[],i=[];function s(){e=0,n.length=0,r.length=0,i.length=0}function a(f,h,p,m,x,y){let g=t[e];return g===void 0?(g={id:f.id,object:f,geometry:h,material:p,groupOrder:m,renderOrder:f.renderOrder,z:x,group:y},t[e]=g):(g.id=f.id,g.object=f,g.geometry=h,g.material=p,g.groupOrder=m,g.renderOrder=f.renderOrder,g.z=x,g.group=y),e++,g}function l(f,h,p,m,x,y){const g=a(f,h,p,m,x,y);p.transmission>0?r.push(g):p.transparent===!0?i.push(g):n.push(g)}function c(f,h,p,m,x,y){const g=a(f,h,p,m,x,y);p.transmission>0?r.unshift(g):p.transparent===!0?i.unshift(g):n.unshift(g)}function u(f,h){n.length>1&&n.sort(f||C0t),r.length>1&&r.sort(h||VX),i.length>1&&i.sort(h||VX)}function d(){for(let f=e,h=t.length;f<h;f++){const p=t[f];if(p.id===null)break;p.id=null,p.object=null,p.geometry=null,p.material=null,p.group=null}}return{opaque:n,transmissive:r,transparent:i,init:s,push:l,unshift:c,finish:d,sort:u}}function k0t(){let t=new WeakMap;function e(r,i){const s=t.get(r);let a;return s===void 0?(a=new HX,t.set(r,[a])):i>=s.length?(a=new HX,s.push(a)):a=s[i],a}function n(){t=new WeakMap}return{get:e,dispose:n}}function E0t(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new Re,color:new cr};break;case"SpotLight":n={position:new Re,direction:new Re,color:new cr,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Re,color:new cr,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Re,skyColor:new cr,groundColor:new cr};break;case"RectAreaLight":n={color:new cr,position:new Re,halfWidth:new Re,halfHeight:new Re};break}return t[e.id]=n,n}}}function A0t(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Mn};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Mn};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Mn,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let T0t=0;function M0t(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}
vendor: 6,902 bytes, lines 4658-4664
4658function P0t(t){const e=new E0t,n=A0t(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let u=0;u<9;u++)r.probe.push(new Re);const i=new Re,s=new es,a=new es;function l(u){let d=0,f=0,h=0;for(let C=0;C<9;C++)r.probe[C].set(0,0,0);let p=0,m=0,x=0,y=0,g=0,w=0,v=0,N=0,S=0,_=0,j=0;u.sort(M0t);for(let C=0,k=u.length;C<k;C++){const M=u[C],I=M.color,R=M.intensity,E=M.distance,P=M.shadow&&M.shadow.map?M.shadow.map.texture:null;if(M.isAmbientLight)d+=I.r*R,f+=I.g*R,h+=I.b*R;else if(M.isLightProbe){for(let O=0;O<9;O++)r.probe[O].addScaledVector(M.sh.coefficients[O],R);j++}else if(M.isDirectionalLight){const O=e.get(M);if(O.color.copy(M.color).multiplyScalar(M.intensity),M.castShadow){const L=M.shadow,T=n.get(M);T.shadowIntensity=L.intensity,T.shadowBias=L.bias,T.shadowNormalBias=L.normalBias,T.shadowRadius=L.radius,T.shadowMapSize=L.mapSize,r.directionalShadow[p]=T,r.directionalShadowMap[p]=P,r.directionalShadowMatrix[p]=M.shadow.matrix,w++}r.directional[p]=O,p++}else if(M.isSpotLight){const O=e.get(M);O.position.setFromMatrixPosition(M.matrixWorld),O.color.copy(I).multiplyScalar(R),O.distance=E,O.coneCos=Math.cos(M.angle),O.penumbraCos=Math.cos(M.angle*(1-M.penumbra)),O.decay=M.decay,r.spot[x]=O;const L=M.shadow;if(M.map&&(r.spotLightMap[S]=M.map,S++,L.updateMatrices(M),M.castShadow&&_++),r.spotLightMatrix[x]=L.matrix,M.castShadow){const T=n.get(M);T.shadowIntensity=L.intensity,T.shadowBias=L.bias,T.shadowNormalBias=L.normalBias,T.shadowRadius=L.radius,T.shadowMapSize=L.mapSize,r.spotShadow[x]=T,r.spotShadowMap[x]=P,N++}x++}else if(M.isRectAreaLight){const O=e.get(M);O.color.copy(I).multiplyScalar(R),O.halfWidth.set(M.width*.5,0,0),O.halfHeight.set(0,M.height*.5,0),r.rectArea[y]=O,y++}else if(M.isPointLight){const O=e.get(M);if(O.color.copy(M.color).multiplyScalar(M.intensity),O.distance=M.distance,O.decay=M.decay,M.castShadow){const L=M.shadow,T=n.get(M);T.shadowIntensity=L.intensity,T.shadowBias=L.bias,T.shadowNormalBias=L.normalBias,T.shadowRadius=L.radius,T.shadowMapSize=L.mapSize,T.shadowCameraNear=L.camera.near,T.shadowCameraFar=L.camera.far,r.pointShadow[m]=T,r.pointShadowMap[m]=P,r.pointShadowMatrix[m]=M.shadow.matrix,v++}r.point[m]=O,m++}else if(M.isHemisphereLight){const O=e.get(M);O.skyColor.copy(M.color).multiplyScalar(R),O.groundColor.copy(M.groundColor).multiplyScalar(R),r.hemi[g]=O,g++}}y>0&&(t.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=ct.LTC_FLOAT_1,r.rectAreaLTC2=ct.LTC_FLOAT_2):(r.rectAreaLTC1=ct.LTC_HALF_1,r.rectAreaLTC2=ct.LTC_HALF_2)),r.ambient[0]=d,r.ambient[1]=f,r.ambient[2]=h;const A=r.hash;(A.directionalLength!==p||A.pointLength!==m||A.spotLength!==x||A.rectAreaLength!==y||A.hemiLength!==g||A.numDirectionalShadows!==w||A.numPointShadows!==v||A.numSpotShadows!==N||A.numSpotMaps!==S||A.numLightProbes!==j)&&(r.directional.length=p,r.spot.length=x,r.rectArea.length=y,r.point.length=m,r.hemi.length=g,r.directionalShadow.length=w,r.directionalShadowMap.length=w,r.pointShadow.length=v,r.pointShadowMap.length=v,r.spotShadow.length=N,r.spotShadowMap.length=N,r.directionalShadowMatrix.length=w,r.pointShadowMatrix.length=v,r.spotLightMatrix.length=N+S-_,r.spotLightMap.length=S,r.numSpotLightShadowsWithMaps=_,r.numLightProbes=j,A.directionalLength=p,A.pointLength=m,A.spotLength=x,A.rectAreaLength=y,A.hemiLength=g,A.numDirectionalShadows=w,A.numPointShadows=v,A.numSpotShadows=N,A.numSpotMaps=S,A.numLightProbes=j,r.version=T0t++)}function c(u,d){let f=0,h=0,p=0,m=0,x=0;const y=d.matrixWorldInverse;for(let g=0,w=u.length;g<w;g++){const v=u[g];if(v.isDirectionalLight){const N=r.directional[f];N.direction.setFromMatrixPosition(v.matrixWorld),i.setFromMatrixPosition(v.target.matrixWorld),N.direction.sub(i),N.direction.transformDirection(y),f++}else if(v.isSpotLight){const N=r.spot[p];N.position.setFromMatrixPosition(v.matrixWorld),N.position.applyMatrix4(y),N.direction.setFromMatrixPosition(v.matrixWorld),i.setFromMatrixPosition(v.target.matrixWorld),N.direction.sub(i),N.direction.transformDirection(y),p++}else if(v.isRectAreaLight){const N=r.rectArea[m];N.position.setFromMatrixPosition(v.matrixWorld),N.position.applyMatrix4(y),a.identity(),s.copy(v.matrixWorld),s.premultiply(y),a.extractRotation(s),N.halfWidth.set(v.width*.5,0,0),N.halfHeight.set(0,v.height*.5,0),N.halfWidth.applyMatrix4(a),N.halfHeight.applyMatrix4(a),m++}else if(v.isPointLight){const N=r.point[h];N.position.setFromMatrixPosition(v.matrixWorld),N.position.applyMatrix4(y),h++}else if(v.isHemisphereLight){const N=r.hemi[x];N.direction.setFromMatrixPosition(v.matrixWorld),N.direction.transformDirection(y),x++}}}return{setup:l,setupView:c,state:r}}function WX(t){const e=new P0t(t),n=[],r=[];function i(d){u.camera=d,n.length=0,r.length=0}function s(d){n.push(d)}function a(d){r.push(d)}function l(){e.setup(n)}function c(d){e.setupView(n,d)}const u={lightsArray:n,shadowsArray:r,camera:null,lights:e,transmissionRenderTarget:{}};return{init:i,state:u,setupLights:l,setupLightsView:c,pushLight:s,pushShadow:a}}function O0t(t){let e=new WeakMap;function n(i,s=0){const a=e.get(i);let l;return a===void 0?(l=new WX(t),e.set(i,[l])):s>=a.length?(l=new WX(t),a.push(l)):l=a[s],l}function r(){e=new WeakMap}return{get:n,dispose:r}}class R0t extends ZM{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Amt,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class I0t extends ZM{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const D0t=`void main() {
4659	gl_Position = vec4( position, 1.0 );
4660}`,L0t=`uniform sampler2D shadow_pass;
4661uniform vec2 resolution;
4662uniform float radius;
4663#include <packing>
4664void main() {
4665	const float samples = float( VSM_SAMPLES );
4666	float mean = 0.0;
4667	float squared_mean = 0.0;
4668	float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
4669	float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
4670	for ( float i = 0.0; i < samples; i ++ ) {
4671		float uvOffset = uvStart + i * uvStride;
4672		#ifdef HORIZONTAL_PASS
4673			vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
4674			mean += distribution.x;
4675			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
4676		#else
4677			float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
4678			mean += depth;
4679			squared_mean += depth * depth;
4680		#endif
4681	}
4682	mean = mean / samples;
4683	squared_mean = squared_mean / samples;
4684	float std_dev = sqrt( squared_mean - mean * mean );
4685	gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
4686}`;function $0t(t,e,n){let r=new zpe;const i=new Mn,s=new Mn,a=new ps,l=new R0t({depthPacking:Tmt}),c=new I0t,u={},d=n.maxTextureSize,f={[$h]:Va,[Va]:$h,[Yu]:Yu},h=new Pd({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Mn},radius:{value:4}},vertexShader:D0t,fragmentShader:L0t}),p=h.clone();p.defines.HORIZONTAL_PASS=1;const m=new Rg;m.setAttribute("position",new Zc(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const x=new Hc(m,h),y=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=gpe;let g=this.type;this.render=function(_,j,A){if(y.enabled===!1||y.autoUpdate===!1&&y.needsUpdate===!1||_.length===0)return;const C=t.getRenderTarget(),k=t.getActiveCubeFace(),M=t.getActiveMipmapLevel(),I=t.state;I.setBlending(gh),I.buffers.color.setClear(1,1,1,1),I.buffers.depth.setTest(!0),I.setScissorTest(!1);const R=g!==Lu&&this.type===Lu,E=g===Lu&&this.type!==Lu;for(let P=0,O=_.length;P<O;P++){const L=_[P],T=L.shadow;if(T===void 0){console.warn("THREE.WebGLShadowMap:",L,"has no shadow.");continue}if(T.autoUpdate===!1&&T.needsUpdate===!1)continue;i.copy(T.mapSize);const D=T.getFrameExtents();if(i.multiply(D),s.copy(T.mapSize),(i.x>d||i.y>d)&&(i.x>d&&(s.x=Math.floor(d/D.x),i.x=s.x*D.x,T.mapSize.x=s.x),i.y>d&&(s.y=Math.floor(d/D.y),i.y=s.y*D.y,T.mapSize.y=s.y)),T.map===null||R===!0||E===!0){const q=this.type!==Lu?{minFilter:sl,magFilter:sl}:{};T.map!==null&&T.map.dispose(),T.map=new eg(i.x,i.y,q),T.map.texture.name=L.name+".shadowMap",T.camera.updateProjectionMatrix()}
vendor: 8,326 bytes, line 4686
4686t.setRenderTarget(T.map),t.clear();const F=T.getViewportCount();for(let q=0;q<F;q++){const B=T.getViewport(q);a.set(s.x*B.x,s.y*B.y,s.x*B.z,s.y*B.w),I.viewport(a),T.updateMatrices(L,q),r=T.getFrustum(),N(j,A,T.camera,L,this.type)}T.isPointLightShadow!==!0&&this.type===Lu&&w(T,A),T.needsUpdate=!1}g=this.type,y.needsUpdate=!1,t.setRenderTarget(C,k,M)};function w(_,j){const A=e.update(x);h.defines.VSM_SAMPLES!==_.blurSamples&&(h.defines.VSM_SAMPLES=_.blurSamples,p.defines.VSM_SAMPLES=_.blurSamples,h.needsUpdate=!0,p.needsUpdate=!0),_.mapPass===null&&(_.mapPass=new eg(i.x,i.y)),h.uniforms.shadow_pass.value=_.map.texture,h.uniforms.resolution.value=_.mapSize,h.uniforms.radius.value=_.radius,t.setRenderTarget(_.mapPass),t.clear(),t.renderBufferDirect(j,null,A,h,x,null),p.uniforms.shadow_pass.value=_.mapPass.texture,p.uniforms.resolution.value=_.mapSize,p.uniforms.radius.value=_.radius,t.setRenderTarget(_.map),t.clear(),t.renderBufferDirect(j,null,A,p,x,null)}function v(_,j,A,C){let k=null;const M=A.isPointLight===!0?_.customDistanceMaterial:_.customDepthMaterial;if(M!==void 0)k=M;else if(k=A.isPointLight===!0?c:l,t.localClippingEnabled&&j.clipShadows===!0&&Array.isArray(j.clippingPlanes)&&j.clippingPlanes.length!==0||j.displacementMap&&j.displacementScale!==0||j.alphaMap&&j.alphaTest>0||j.map&&j.alphaTest>0){const I=k.uuid,R=j.uuid;let E=u[I];E===void 0&&(E={},u[I]=E);let P=E[R];P===void 0&&(P=k.clone(),E[R]=P,j.addEventListener("dispose",S)),k=P}if(k.visible=j.visible,k.wireframe=j.wireframe,C===Lu?k.side=j.shadowSide!==null?j.shadowSide:j.side:k.side=j.shadowSide!==null?j.shadowSide:f[j.side],k.alphaMap=j.alphaMap,k.alphaTest=j.alphaTest,k.map=j.map,k.clipShadows=j.clipShadows,k.clippingPlanes=j.clippingPlanes,k.clipIntersection=j.clipIntersection,k.displacementMap=j.displacementMap,k.displacementScale=j.displacementScale,k.displacementBias=j.displacementBias,k.wireframeLinewidth=j.wireframeLinewidth,k.linewidth=j.linewidth,A.isPointLight===!0&&k.isMeshDistanceMaterial===!0){const I=t.properties.get(k);I.light=A}return k}function N(_,j,A,C,k){if(_.visible===!1)return;if(_.layers.test(j.layers)&&(_.isMesh||_.isLine||_.isPoints)&&(_.castShadow||_.receiveShadow&&k===Lu)&&(!_.frustumCulled||r.intersectsObject(_))){_.modelViewMatrix.multiplyMatrices(A.matrixWorldInverse,_.matrixWorld);const R=e.update(_),E=_.material;if(Array.isArray(E)){const P=R.groups;for(let O=0,L=P.length;O<L;O++){const T=P[O],D=E[T.materialIndex];if(D&&D.visible){const F=v(_,D,C,k);_.onBeforeShadow(t,_,j,A,R,F,T),t.renderBufferDirect(A,null,R,F,_,T),_.onAfterShadow(t,_,j,A,R,F,T)}}}else if(E.visible){const P=v(_,E,C,k);_.onBeforeShadow(t,_,j,A,R,P,null),t.renderBufferDirect(A,null,R,P,_,null),_.onAfterShadow(t,_,j,A,R,P,null)}}const I=_.children;for(let R=0,E=I.length;R<E;R++)N(I[R],j,A,C,k)}function S(_){_.target.removeEventListener("dispose",S);for(const A in u){const C=u[A],k=_.target.uuid;k in C&&(C[k].dispose(),delete C[k])}}}function F0t(t){function e(){let xe=!1;const $e=new ps;let ue=null;const Ne=new ps(0,0,0,0);return{setMask:function(Le){ue!==Le&&!xe&&(t.colorMask(Le,Le,Le,Le),ue=Le)},setLocked:function(Le){xe=Le},setClear:function(Le,tt,St,rt,vt){vt===!0&&(Le*=rt,tt*=rt,St*=rt),$e.set(Le,tt,St,rt),Ne.equals($e)===!1&&(t.clearColor(Le,tt,St,rt),Ne.copy($e))},reset:function(){xe=!1,ue=null,Ne.set(-1,0,0,0)}}}function n(){let xe=!1,$e=null,ue=null,Ne=null;return{setTest:function(Le){Le?G(t.DEPTH_TEST):K(t.DEPTH_TEST)},setMask:function(Le){$e!==Le&&!xe&&(t.depthMask(Le),$e=Le)},setFunc:function(Le){if(ue!==Le){switch(Le){case fmt:t.depthFunc(t.NEVER);break;case hmt:t.depthFunc(t.ALWAYS);break;case pmt:t.depthFunc(t.LESS);break;case mE:t.depthFunc(t.LEQUAL);break;case mmt:t.depthFunc(t.EQUAL);break;case gmt:t.depthFunc(t.GEQUAL);break;case xmt:t.depthFunc(t.GREATER);break;case ymt:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}ue=Le}},setLocked:function(Le){xe=Le},setClear:function(Le){Ne!==Le&&(t.clearDepth(Le),Ne=Le)},reset:function(){xe=!1,$e=null,ue=null,Ne=null}}}function r(){let xe=!1,$e=null,ue=null,Ne=null,Le=null,tt=null,St=null,rt=null,vt=null;return{setTest:function(me){xe||(me?G(t.STENCIL_TEST):K(t.STENCIL_TEST))},setMask:function(me){$e!==me&&!xe&&(t.stencilMask(me),$e=me)},setFunc:function(me,Fe,He){(ue!==me||Ne!==Fe||Le!==He)&&(t.stencilFunc(me,Fe,He),ue=me,Ne=Fe,Le=He)},setOp:function(me,Fe,He){(tt!==me||St!==Fe||rt!==He)&&(t.stencilOp(me,Fe,He),tt=me,St=Fe,rt=He)},setLocked:function(me){xe=me},setClear:function(me){vt!==me&&(t.clearStencil(me),vt=me)},reset:function(){xe=!1,$e=null,ue=null,Ne=null,Le=null,tt=null,St=null,rt=null,vt=null}}}const i=new e,s=new n,a=new r,l=new WeakMap,c=new WeakMap;let u={},d={},f=new WeakMap,h=[],p=null,m=!1,x=null,y=null,g=null,w=null,v=null,N=null,S=null,_=new cr(0,0,0),j=0,A=!1,C=null,k=null,M=null,I=null,R=null;const E=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let P=!1,O=0;const L=t.getParameter(t.VERSION);L.indexOf("WebGL")!==-1?(O=parseFloat(/^WebGL (\d)/.exec(L)[1]),P=O>=1):L.indexOf("OpenGL ES")!==-1&&(O=parseFloat(/^OpenGL ES (\d)/.exec(L)[1]),P=O>=2);let T=null,D={};const F=t.getParameter(t.SCISSOR_BOX),q=t.getParameter(t.VIEWPORT),B=new ps().fromArray(F),z=new ps().fromArray(q);function H(xe,$e,ue,Ne){const Le=new Uint8Array(4),tt=t.createTexture();t.bindTexture(xe,tt),t.texParameteri(xe,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(xe,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let St=0;St<ue;St++)xe===t.TEXTURE_3D||xe===t.TEXTURE_2D_ARRAY?t.texImage3D($e,0,t.RGBA,1,1,Ne,0,t.RGBA,t.UNSIGNED_BYTE,Le):t.texImage2D($e+St,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,Le);return tt}const W={};W[t.TEXTURE_2D]=H(t.TEXTURE_2D,t.TEXTURE_2D,1),W[t.TEXTURE_CUBE_MAP]=H(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),W[t.TEXTURE_2D_ARRAY]=H(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),W[t.TEXTURE_3D]=H(t.TEXTURE_3D,t.TEXTURE_3D,1,1),i.setClear(0,0,0,1),s.setClear(1),a.setClear(0),G(t.DEPTH_TEST),s.setFunc(mE),ve(!1),X(QY),G(t.CULL_FACE),fe(gh);function G(xe){u[xe]!==!0&&(t.enable(xe),u[xe]=!0)}function K(xe){u[xe]!==!1&&(t.disable(xe),u[xe]=!1)}function ee(xe,$e){return d[xe]!==$e?(t.bindFramebuffer(xe,$e),d[xe]=$e,xe===t.DRAW_FRAMEBUFFER&&(d[t.FRAMEBUFFER]=$e),xe===t.FRAMEBUFFER&&(d[t.DRAW_FRAMEBUFFER]=$e),!0):!1}function V(xe,$e){let ue=h,Ne=!1;if(xe){ue=f.get($e),ue===void 0&&(ue=[],f.set($e,ue));const Le=xe.textures;if(ue.length!==Le.length||ue[0]!==t.COLOR_ATTACHMENT0){for(let tt=0,St=Le.length;tt<St;tt++)ue[tt]=t.COLOR_ATTACHMENT0+tt;ue.length=Le.length,Ne=!0}}else ue[0]!==t.BACK&&(ue[0]=t.BACK,Ne=!0);Ne&&t.drawBuffers(ue)}function J(xe){return p!==xe?(t.useProgram(xe),p=xe,!0):!1}const Y={[Bp]:t.FUNC_ADD,[Ypt]:t.FUNC_SUBTRACT,[Xpt]:t.FUNC_REVERSE_SUBTRACT};Y[Qpt]=t.MIN,Y[Jpt]=t.MAX;const $={[Zpt]:t.ZERO,[emt]:t.ONE,[tmt]:t.SRC_COLOR,[G$]:t.SRC_ALPHA,[omt]:t.SRC_ALPHA_SATURATE,[smt]:t.DST_COLOR,[rmt]:t.DST_ALPHA,[nmt]:t.ONE_MINUS_SRC_COLOR,[q$]:t.ONE_MINUS_SRC_ALPHA,[amt]:t.ONE_MINUS_DST_COLOR,[imt]:t.ONE_MINUS_DST_ALPHA,[lmt]:t.CONSTANT_COLOR,[cmt]:t.ONE_MINUS_CONSTANT_COLOR,[umt]:t.CONSTANT_ALPHA,[dmt]:t.ONE_MINUS_CONSTANT_ALPHA};function fe(xe,$e,ue,Ne,Le,tt,St,rt,vt,me){if(xe===gh){m===!0&&(K(t.BLEND),m=!1);return}if(m===!1&&(G(t.BLEND),m=!0),xe!==Kpt){if(xe!==x||me!==A){if((y!==Bp||v!==Bp)&&(t.blendEquation(t.FUNC_ADD),y=Bp,v=Bp),me)switch(xe){case Py:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case JY:t.blendFunc(t.ONE,t.ONE);break;case ZY:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case eX:t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",xe);break}else switch(xe){case Py:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case JY:t.blendFunc(t.SRC_ALPHA,t.ONE);break;case ZY:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case eX:t.blendFunc(t.ZERO,t.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",xe);break}g=null,w=null,N=null,S=null,_.set(0,0,0),j=0,x=xe,A=me}return}Le=Le||$e,tt=tt||ue,St=St||Ne,($e!==y||Le!==v)&&(t.blendEquationSeparate(Y[$e],Y[Le]),y=$e,v=Le),(ue!==g||Ne!==w||tt!==N||St!==S)&&(t.blendFuncSeparate($[ue],$[Ne],$[tt],$[St]),g=ue,w=Ne,N=tt,S=St),(rt.equals(_)===!1||vt!==j)&&(t.blendColor
vendor: 15,467 bytes, line 4686
4686(rt.r,rt.g,rt.b,vt),_.copy(rt),j=vt),x=xe,A=!1}function ce(xe,$e){xe.side===Yu?K(t.CULL_FACE):G(t.CULL_FACE);let ue=xe.side===Va;$e&&(ue=!ue),ve(ue),xe.blending===Py&&xe.transparent===!1?fe(gh):fe(xe.blending,xe.blendEquation,xe.blendSrc,xe.blendDst,xe.blendEquationAlpha,xe.blendSrcAlpha,xe.blendDstAlpha,xe.blendColor,xe.blendAlpha,xe.premultipliedAlpha),s.setFunc(xe.depthFunc),s.setTest(xe.depthTest),s.setMask(xe.depthWrite),i.setMask(xe.colorWrite);const Ne=xe.stencilWrite;a.setTest(Ne),Ne&&(a.setMask(xe.stencilWriteMask),a.setFunc(xe.stencilFunc,xe.stencilRef,xe.stencilFuncMask),a.setOp(xe.stencilFail,xe.stencilZFail,xe.stencilZPass)),Te(xe.polygonOffset,xe.polygonOffsetFactor,xe.polygonOffsetUnits),xe.alphaToCoverage===!0?G(t.SAMPLE_ALPHA_TO_COVERAGE):K(t.SAMPLE_ALPHA_TO_COVERAGE)}function ve(xe){C!==xe&&(xe?t.frontFace(t.CW):t.frontFace(t.CCW),C=xe)}function X(xe){xe!==Wpt?(G(t.CULL_FACE),xe!==k&&(xe===QY?t.cullFace(t.BACK):xe===Gpt?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):K(t.CULL_FACE),k=xe}function de(xe){xe!==M&&(P&&t.lineWidth(xe),M=xe)}function Te(xe,$e,ue){xe?(G(t.POLYGON_OFFSET_FILL),(I!==$e||R!==ue)&&(t.polygonOffset($e,ue),I=$e,R=ue)):K(t.POLYGON_OFFSET_FILL)}function Pe(xe){xe?G(t.SCISSOR_TEST):K(t.SCISSOR_TEST)}function se(xe){xe===void 0&&(xe=t.TEXTURE0+E-1),T!==xe&&(t.activeTexture(xe),T=xe)}function U(xe,$e,ue){ue===void 0&&(T===null?ue=t.TEXTURE0+E-1:ue=T);let Ne=D[ue];Ne===void 0&&(Ne={type:void 0,texture:void 0},D[ue]=Ne),(Ne.type!==xe||Ne.texture!==$e)&&(T!==ue&&(t.activeTexture(ue),T=ue),t.bindTexture(xe,$e||W[xe]),Ne.type=xe,Ne.texture=$e)}function Q(){const xe=D[T];xe!==void 0&&xe.type!==void 0&&(t.bindTexture(xe.type,null),xe.type=void 0,xe.texture=void 0)}function oe(){try{t.compressedTexImage2D.apply(t,arguments)}catch(xe){console.error("THREE.WebGLState:",xe)}}function _e(){try{t.compressedTexImage3D.apply(t,arguments)}catch(xe){console.error("THREE.WebGLState:",xe)}}function ye(){try{t.texSubImage2D.apply(t,arguments)}catch(xe){console.error("THREE.WebGLState:",xe)}}function re(){try{t.texSubImage3D.apply(t,arguments)}catch(xe){console.error("THREE.WebGLState:",xe)}}function he(){try{t.compressedTexSubImage2D.apply(t,arguments)}catch(xe){console.error("THREE.WebGLState:",xe)}}function pe(){try{t.compressedTexSubImage3D.apply(t,arguments)}catch(xe){console.error("THREE.WebGLState:",xe)}}function je(){try{t.texStorage2D.apply(t,arguments)}catch(xe){console.error("THREE.WebGLState:",xe)}}function ae(){try{t.texStorage3D.apply(t,arguments)}catch(xe){console.error("THREE.WebGLState:",xe)}}function we(){try{t.texImage2D.apply(t,arguments)}catch(xe){console.error("THREE.WebGLState:",xe)}}function Ie(){try{t.texImage3D.apply(t,arguments)}catch(xe){console.error("THREE.WebGLState:",xe)}}function Ue(xe){B.equals(xe)===!1&&(t.scissor(xe.x,xe.y,xe.z,xe.w),B.copy(xe))}function Oe(xe){z.equals(xe)===!1&&(t.viewport(xe.x,xe.y,xe.z,xe.w),z.copy(xe))}function ie(xe,$e){let ue=c.get($e);ue===void 0&&(ue=new WeakMap,c.set($e,ue));let Ne=ue.get(xe);Ne===void 0&&(Ne=t.getUniformBlockIndex($e,xe.name),ue.set(xe,Ne))}function De(xe,$e){const Ne=c.get($e).get(xe);l.get($e)!==Ne&&(t.uniformBlockBinding($e,Ne,xe.__bindingPointIndex),l.set($e,Ne))}function Ve(){t.disable(t.BLEND),t.disable(t.CULL_FACE),t.disable(t.DEPTH_TEST),t.disable(t.POLYGON_OFFSET_FILL),t.disable(t.SCISSOR_TEST),t.disable(t.STENCIL_TEST),t.disable(t.SAMPLE_ALPHA_TO_COVERAGE),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ZERO),t.blendFuncSeparate(t.ONE,t.ZERO,t.ONE,t.ZERO),t.blendColor(0,0,0,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(t.LESS),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(t.ALWAYS,0,4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.clearStencil(0),t.cullFace(t.BACK),t.frontFace(t.CCW),t.polygonOffset(0,0),t.activeTexture(t.TEXTURE0),t.bindFramebuffer(t.FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),u={},T=null,D={},d={},f=new WeakMap,h=[],p=null,m=!1,x=null,y=null,g=null,w=null,v=null,N=null,S=null,_=new cr(0,0,0),j=0,A=!1,C=null,k=null,M=null,I=null,R=null,B.set(0,0,t.canvas.width,t.canvas.height),z.set(0,0,t.canvas.width,t.canvas.height),i.reset(),s.reset(),a.reset()}return{buffers:{color:i,depth:s,stencil:a},enable:G,disable:K,bindFramebuffer:ee,drawBuffers:V,useProgram:J,setBlending:fe,setMaterial:ce,setFlipSided:ve,setCullFace:X,setLineWidth:de,setPolygonOffset:Te,setScissorTest:Pe,activeTexture:se,bindTexture:U,unbindTexture:Q,compressedTexImage2D:oe,compressedTexImage3D:_e,texImage2D:we,texImage3D:Ie,updateUBOMapping:ie,uniformBlockBinding:De,texStorage2D:je,texStorage3D:ae,texSubImage2D:ye,texSubImage3D:re,compressedTexSubImage2D:he,compressedTexSubImage3D:pe,scissor:Ue,viewport:Oe,reset:Ve}}function GX(t,e,n,r){const i=U0t(r);switch(n){case _pe:return t*e;case Npe:return t*e;case jpe:return t*e*2;case Cpe:return t*e/i.components*i.byteLength;case XB:return t*e/i.components*i.byteLength;case kpe:return t*e*2/i.components*i.byteLength;case QB:return t*e*2/i.components*i.byteLength;case Spe:return t*e*3/i.components*i.byteLength;case ec:return t*e*4/i.components*i.byteLength;case JB:return t*e*4/i.components*i.byteLength;case JC:case ZC:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case ek:case tk:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case Z$:case t5:return Math.max(t,16)*Math.max(e,8)/4;case J$:case e5:return Math.max(t,8)*Math.max(e,8)/2;case n5:case r5:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case i5:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case s5:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case a5:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case o5:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case l5:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case c5:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case u5:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case d5:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case f5:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case h5:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case p5:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case m5:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case g5:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case x5:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case y5:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case nk:case v5:case b5:return Math.ceil(t/4)*Math.ceil(e/4)*16;case Epe:case w5:return Math.ceil(t/4)*Math.ceil(e/4)*8;case _5:case S5:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}function U0t(t){switch(t){case Td:case vpe:return{byteLength:1,components:1};case R_:case bpe:case eN:return{byteLength:2,components:1};case KB:case YB:return{byteLength:2,components:4};case Zm:case qB:case rd:return{byteLength:4,components:1};case wpe:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}function z0t(t,e,n,r,i,s,a){const l=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,c=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),u=new Mn,d=new WeakMap;let f;const h=new WeakMap;let p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function m(se,U){return p?new OffscreenCanvas(se,U):bE("canvas")}function x(se,U,Q){let oe=1;const _e=Pe(se);if((_e.width>Q||_e.height>Q)&&(oe=Q/Math.max(_e.width,_e.height)),oe<1)if(typeof HTMLImageElement<"u"&&se instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&se instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&se instanceof ImageBitmap||typeof VideoFrame<"u"&&se instanceof VideoFrame){const ye=Math.floor(oe*_e.width),re=Math.floor(oe*_e.height);f===void 0&&(f=m(ye,re));const he=U?m(ye,re):f;return he.width=ye,he.height=re,he.getContext("2d").drawImage(se,0,0,ye,re),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+_e.width+"x"+_e.height+") to ("+ye+"x"+re+")."),he}else return"data"in se&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+_e.width+"x"+_e.height+")."),se;return se}function y(se){return se.generateMipmaps&&se.minFilter!==sl&&se.minFilter!==Xl}function g(se){t.generateMipmap(se)}function w(se,U,Q,oe,_e=!1){if(se!==null){if(t[se]!==void 0)return t[se];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+se+"'")}let ye=U;if(U===t.RED&&(Q===t.FLOAT&&(ye=t.R32F),Q===t.HALF_FLOAT&&(ye=t.R16F),Q===t.UNSIGNED_BYTE&&(ye=t.R8)),U===t.RED_INTEGER&&(Q===t.UNSIGNED_BYTE&&(ye=t.R8UI),Q===t.UNSIGNED_SHORT&&(ye=t.R16UI),Q===t.UNSIGNED_INT&&(ye=t.R32UI),Q===t.BYTE&&(ye=t.R8I),Q===t.SHORT&&(ye=t.R16I),Q===t.INT&&(ye=t.R32I)),U===t.RG&&(Q===t.FLOAT&&(ye=t.RG32F),Q===t.HALF_FLOAT&&(ye=t.RG16F),Q===t.UNSIGNED_BYTE&&(ye=t.RG8)),U===t.RG_INTEGER&&(Q===t.UNSIGNED_BYTE&&(ye=t.RG8UI),Q===t.UNSIGNED_SHORT&&(ye=t.RG16UI),Q===t.UNSIGNED_INT&&(ye=t.RG32UI),Q===t.BYTE&&(ye=t.RG8I),Q===t.SHORT&&(ye=t.RG16I),Q===t.INT&&(ye=t.RG32I)),U===t.RGB&&Q===t.UNSIGNED_INT_5_9_9_9_REV&&(ye=t.RGB9_E5),U===t.RGBA){const re=_e?gE:Xn.getTransfer(oe);Q===t.FLOAT&&(ye=t.RGBA32F),Q===t.HALF_FLOAT&&(ye=t.RGBA16F),Q===t.UNSIGNED_BYTE&&(ye=re===Fr?t.SRGB8_ALPHA8:t.RGBA8),Q===t.UNSIGNED_SHORT_4_4_4_4&&(ye=t.RGBA4),Q===t.UNSIGNED_SHORT_5_5_5_1&&(ye=t.RGB5_A1)}return(ye===t.R16F||ye===t.R32F||ye===t.RG16F||ye===t.RG32F||ye===t.RGBA16F||ye===t.RGBA32F)&&e.get("EXT_color_buffer_float"),ye}function v(se,U){let Q;return se?U===null||U===Zm||U===Hv?Q=t.DEPTH24_STENCIL8:U===rd?Q=t.DEPTH32F_STENCIL8:U===R_&&(Q=t.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):U===null||U===Zm||U===Hv?Q=t.DEPTH_COMPONENT24:U===rd?Q=t.DEPTH_COMPONENT32F:U===R_&&(Q=t.DEPTH_COMPONENT16),Q}function N(se,U){return y(se)===!0||se.isFramebufferTexture&&se.minFilter!==sl&&se.minFilter!==Xl?Math.log2(Math.max(U.width,U.height))+1:se.mipmaps!==void 0&&se.mipmaps.length>0?se.mipmaps.length:se.isCompressedTexture&&Array.isArray(se.image)?U.mipmaps.length:1}function S(se){const U=se.target;U.removeEventListener("dispose",S),j(U),U.isVideoTexture&&d.delete(U)}function _(se){const U=se.target;U.removeEventListener("dispose",_),C(U)}function j(se){const U=r.get(se);if(U.__webglInit===void 0)return;const Q=se.source,oe=h.get(Q);if(oe){const _e=oe[U.__cacheKey];_e.usedTimes--,_e.usedTimes===0&&A(se),Object.keys(oe).length===0&&h.delete(Q)}r.remove(se)}function A(se){const U=r.get(se);t.deleteTexture(U.__webglTexture);const Q=se.source,oe=h.get(Q);delete oe[U.__cacheKey],a.memory.textures--}function C(se){const U=r.get(se);if(se.depthTexture&&se.depthTexture.dispose(),se.isWebGLCubeRenderTarget)for(let oe=0;oe<6;oe++){if(Array.isArray(U.__webglFramebuffer[oe]))for(let _e=0;_e<U.__webglFramebuffer[oe].length;_e++)t.deleteFramebuffer(U.__webglFramebuffer[oe][_e]);else t.deleteFramebuffer(U.__webglFramebuffer[oe]);U.__webglDepthbuffer&&t.deleteRenderbuffer(U.__webglDepthbuffer[oe])}else{if(Array.isArray(U.__webglFramebuffer))for(let oe=0;oe<U.__webglFramebuffer.length;oe++)t.deleteFramebuffer(U.__webglFramebuffer[oe]);else t.deleteFramebuffer(U.__webglFramebuffer);if(U.__webglDepthbuffer&&t.deleteRenderbuffer(U.__webglDepthbuffer),U.__webglMultisampledFramebuffer&&t.deleteFramebuffer(U.__webglMultisampledFramebuffer),U.__webglColorRenderbuffer)for(let oe=0;oe<U.__webglColorRenderbuffer.length;oe++)U.__webglColorRenderbuffer[oe]&&t.deleteRenderbuffer(U.__webglColorRenderbuffer[oe]);U.__webglDepthRenderbuffer&&t.deleteRenderbuffer(U.__webglDepthRenderbuffer)}const Q=se.textures;for(let oe=0,_e=Q.length;oe<_e;oe++){const ye=r.get(Q[oe]);ye.__webglTexture&&(t.deleteTexture(ye.__webglTexture),a.memory.textures--),r.remove(Q[oe])}r.remove(se)}let k=0;function M(){k=0}function I(){const se=k;return se>=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+se+" texture units while this GPU supports only "+i.maxTextures),k+=1,se}function R(se){const U=[];return U.push(se.wrapS),U.push(se.wrapT),U.push(se.wrapR||0),U.push(se.magFilter),U.push(se.minFilter),U.push(se.anisotropy),U.push(se.internalFormat),U.push(se.format),U.push(se.type),U.push(se.generateMipmaps),U.push(se.premultiplyAlpha),U.push(se.flipY),U.push(se.unpackAlignment),U.push(se.colorSpace),U.join()}function E(se,U){const Q=r.get(se);if(se.isVideoTexture&&de(se),se.isRenderTargetTexture===!1&&se.version>0&&Q.__version!==se.version){const oe=se.image;if(oe===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(oe.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{z(Q,se,U);return}}n.bindTexture(t.TEXTURE_2D,Q.__webglTexture,t.TEXTURE0+U)}function P(se,U){const Q=r.get(se);if(se.version>0&&Q.__version!==se.version){z(Q,se,U);return}n.bindTexture(t.TEXTURE_2D_ARRAY,Q.__webglTexture,t.TEXTURE0+U)}function O(se,U){const Q=r.get(se);if(se.version>0&&Q.__version!==se.version){z(Q,se,U);return}n.bindTexture(t.TEXTURE_3D,Q.__webglTexture,t.TEXTURE0+U)}function L(se,U){const Q=r.get(se);if(se.version>0&&Q.__version!==se.version){H(Q,se,U);return}n.bindTexture(t.TEXTURE_CUBE_MAP,Q.__webglTexture,t.TEXTURE0+U)}const T={[X$]:t.REPEAT,[tm]:t.CLAMP_TO_EDGE,[Q$]:t.MIRRORED_REPEAT},D={[sl]:t.NEAREST,[Emt]:t.NEAREST_MIPMAP_NEAREST,[wj]:t.NEAREST_MIPMAP_LINEAR,[Xl]:t.LINEAR,[vI]:t.LINEAR_MIPMAP_NEAREST,[nm]:t.LINEAR_MIPMAP_LINEAR},F={[Omt]:t.NEVER,[Fmt]:t.ALWAYS,[Rmt]:t.LESS,[Ape]:t.LEQUAL,[Imt]:t.EQUAL,[$mt]:t.GEQUAL,[Dmt]:t.GREATER,[Lmt]:t.NOTEQUAL};function q(se,U){if(U.type===rd&&e.has("OES_texture_float_linear")===!1&&(U.magFilter===Xl||U.magFilter===vI||U.magFilter===wj||U.magFilter===nm||U.minFilter===Xl||U.minFilter===vI||U.minFilter===wj||U.minFilter===nm)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(se,t.TEXTURE_WRAP_S,T[U.wrapS]),t.texParameteri(se,t.TEXTURE_WRAP_T,T[U.wrapT]),(se===t.TEXTURE_3D||se===t.TEXTURE_2D_ARRAY)&&t.texParameteri(se,t.TEXTURE_WRAP_R,T[U.wrapR]),t.texParameteri(se,t.TEXTURE_MAG_FILTER,D[U.magFilter]),t.texParameteri(se,t.TEXTURE_MIN_FILTER,D[U.minFilter]),U.compareFunction&&(t.texParameteri(se,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(se,t.TEXTURE_COMPARE_FUNC,F[U.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(U.magFilter===sl||U.minFilter!==wj&&U.minFilter!==nm||U.type===rd&&e.has("OES_texture_float_linear")===!1)return;if(U.anisotropy>1||r.get(U).__currentAnisotropy){const Q=e.get("EXT_texture_filter_anisotropic");t.texParameterf(se,Q.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(U.anisotropy,i.getMaxAnisotropy())),r.get(U).__currentAnisotropy=U.anisotropy}}}function B(se,U){let Q=!1;se.__webglInit===void 0&&(se.__webglInit=!0,U.addEventListener("dispose",S));const oe=U.source;let _e=h.get(oe);_e===void 0&&(_e={},h.set(oe,_e));const ye=R(U);if(ye!==se.__cacheKey){_e[ye]===void 0&&(_e[ye]={texture:t.createTexture(),usedTimes:0},a.memory.textures++,Q=!0),_e[ye].usedTimes++;const re=_e[se.__cacheKey];re!==void 0&&(_e[se.__cacheKey].usedTimes--,re.usedTimes===0&&A(U)),se.__cacheKey=ye,se.__webglTexture=_e[ye].texture}return Q}
vendor: 4,820 bytes, line 4686
4686function z(se,U,Q){let oe=t.TEXTURE_2D;(U.isDataArrayTexture||U.isCompressedArrayTexture)&&(oe=t.TEXTURE_2D_ARRAY),U.isData3DTexture&&(oe=t.TEXTURE_3D);const _e=B(se,U),ye=U.source;n.bindTexture(oe,se.__webglTexture,t.TEXTURE0+Q);const re=r.get(ye);if(ye.version!==re.__version||_e===!0){n.activeTexture(t.TEXTURE0+Q);const he=Xn.getPrimaries(Xn.workingColorSpace),pe=U.colorSpace===Af?null:Xn.getPrimaries(U.colorSpace),je=U.colorSpace===Af||he===pe?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,U.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,U.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,U.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,je);let ae=x(U.image,!1,i.maxTextureSize);ae=Te(U,ae);const we=s.convert(U.format,U.colorSpace),Ie=s.convert(U.type);let Ue=w(U.internalFormat,we,Ie,U.colorSpace,U.isVideoTexture);q(oe,U);let Oe;const ie=U.mipmaps,De=U.isVideoTexture!==!0,Ve=re.__version===void 0||_e===!0,xe=ye.dataReady,$e=N(U,ae);if(U.isDepthTexture)Ue=v(U.format===Wv,U.type),Ve&&(De?n.texStorage2D(t.TEXTURE_2D,1,Ue,ae.width,ae.height):n.texImage2D(t.TEXTURE_2D,0,Ue,ae.width,ae.height,0,we,Ie,null));else if(U.isDataTexture)if(ie.length>0){De&&Ve&&n.texStorage2D(t.TEXTURE_2D,$e,Ue,ie[0].width,ie[0].height);for(let ue=0,Ne=ie.length;ue<Ne;ue++)Oe=ie[ue],De?xe&&n.texSubImage2D(t.TEXTURE_2D,ue,0,0,Oe.width,Oe.height,we,Ie,Oe.data):n.texImage2D(t.TEXTURE_2D,ue,Ue,Oe.width,Oe.height,0,we,Ie,Oe.data);U.generateMipmaps=!1}else De?(Ve&&n.texStorage2D(t.TEXTURE_2D,$e,Ue,ae.width,ae.height),xe&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,ae.width,ae.height,we,Ie,ae.data)):n.texImage2D(t.TEXTURE_2D,0,Ue,ae.width,ae.height,0,we,Ie,ae.data);else if(U.isCompressedTexture)if(U.isCompressedArrayTexture){De&&Ve&&n.texStorage3D(t.TEXTURE_2D_ARRAY,$e,Ue,ie[0].width,ie[0].height,ae.depth);for(let ue=0,Ne=ie.length;ue<Ne;ue++)if(Oe=ie[ue],U.format!==ec)if(we!==null)if(De){if(xe)if(U.layerUpdates.size>0){const Le=GX(Oe.width,Oe.height,U.format,U.type);for(const tt of U.layerUpdates){const St=Oe.data.subarray(tt*Le/Oe.data.BYTES_PER_ELEMENT,(tt+1)*Le/Oe.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,ue,0,0,tt,Oe.width,Oe.height,1,we,St,0,0)}U.clearLayerUpdates()}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,ue,0,0,0,Oe.width,Oe.height,ae.depth,we,Oe.data,0,0)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,ue,Ue,Oe.width,Oe.height,ae.depth,0,Oe.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else De?xe&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,ue,0,0,0,Oe.width,Oe.height,ae.depth,we,Ie,Oe.data):n.texImage3D(t.TEXTURE_2D_ARRAY,ue,Ue,Oe.width,Oe.height,ae.depth,0,we,Ie,Oe.data)}else{De&&Ve&&n.texStorage2D(t.TEXTURE_2D,$e,Ue,ie[0].width,ie[0].height);for(let ue=0,Ne=ie.length;ue<Ne;ue++)Oe=ie[ue],U.format!==ec?we!==null?De?xe&&n.compressedTexSubImage2D(t.TEXTURE_2D,ue,0,0,Oe.width,Oe.height,we,Oe.data):n.compressedTexImage2D(t.TEXTURE_2D,ue,Ue,Oe.width,Oe.height,0,Oe.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):De?xe&&n.texSubImage2D(t.TEXTURE_2D,ue,0,0,Oe.width,Oe.height,we,Ie,Oe.data):n.texImage2D(t.TEXTURE_2D,ue,Ue,Oe.width,Oe.height,0,we,Ie,Oe.data)}else if(U.isDataArrayTexture)if(De){if(Ve&&n.texStorage3D(t.TEXTURE_2D_ARRAY,$e,Ue,ae.width,ae.height,ae.depth),xe)if(U.layerUpdates.size>0){const ue=GX(ae.width,ae.height,U.format,U.type);for(const Ne of U.layerUpdates){const Le=ae.data.subarray(Ne*ue/ae.data.BYTES_PER_ELEMENT,(Ne+1)*ue/ae.data.BYTES_PER_ELEMENT);n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,Ne,ae.width,ae.height,1,we,Ie,Le)}U.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,ae.width,ae.height,ae.depth,we,Ie,ae.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,Ue,ae.width,ae.height,ae.depth,0,we,Ie,ae.data);else if(U.isData3DTexture)De?(Ve&&n.texStorage3D(t.TEXTURE_3D,$e,Ue,ae.width,ae.height,ae.depth),xe&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,ae.width,ae.height,ae.depth,we,Ie,ae.data)):n.texImage3D(t.TEXTURE_3D,0,Ue,ae.width,ae.height,ae.depth,0,we,Ie,ae.data);else if(U.isFramebufferTexture){if(Ve)if(De)n.texStorage2D(t.TEXTURE_2D,$e,Ue,ae.width,ae.height);else{let ue=ae.width,Ne=ae.height;for(let Le=0;Le<$e;Le++)n.texImage2D(t.TEXTURE_2D,Le,Ue,ue,Ne,0,we,Ie,null),ue>>=1,Ne>>=1}}else if(ie.length>0){if(De&&Ve){const ue=Pe(ie[0]);n.texStorage2D(t.TEXTURE_2D,$e,Ue,ue.width,ue.height)}for(let ue=0,Ne=ie.length;ue<Ne;ue++)Oe=ie[ue],De?xe&&n.texSubImage2D(t.TEXTURE_2D,ue,0,0,we,Ie,Oe):n.texImage2D(t.TEXTURE_2D,ue,Ue,we,Ie,Oe);U.generateMipmaps=!1}else if(De){if(Ve){const ue=Pe(ae);n.texStorage2D(t.TEXTURE_2D,$e,Ue,ue.width,ue.height)}xe&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,we,Ie,ae)}else n.texImage2D(t.TEXTURE_2D,0,Ue,we,Ie,ae);
vendor: 9,319 bytes, line 4686
4686y(U)&&g(oe),re.__version=ye.version,U.onUpdate&&U.onUpdate(U)}se.__version=U.version}function H(se,U,Q){if(U.image.length!==6)return;const oe=B(se,U),_e=U.source;n.bindTexture(t.TEXTURE_CUBE_MAP,se.__webglTexture,t.TEXTURE0+Q);const ye=r.get(_e);if(_e.version!==ye.__version||oe===!0){n.activeTexture(t.TEXTURE0+Q);const re=Xn.getPrimaries(Xn.workingColorSpace),he=U.colorSpace===Af?null:Xn.getPrimaries(U.colorSpace),pe=U.colorSpace===Af||re===he?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,U.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,U.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,U.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,pe);const je=U.isCompressedTexture||U.image[0].isCompressedTexture,ae=U.image[0]&&U.image[0].isDataTexture,we=[];for(let Ne=0;Ne<6;Ne++)!je&&!ae?we[Ne]=x(U.image[Ne],!0,i.maxCubemapSize):we[Ne]=ae?U.image[Ne].image:U.image[Ne],we[Ne]=Te(U,we[Ne]);const Ie=we[0],Ue=s.convert(U.format,U.colorSpace),Oe=s.convert(U.type),ie=w(U.internalFormat,Ue,Oe,U.colorSpace),De=U.isVideoTexture!==!0,Ve=ye.__version===void 0||oe===!0,xe=_e.dataReady;let $e=N(U,Ie);q(t.TEXTURE_CUBE_MAP,U);let ue;if(je){De&&Ve&&n.texStorage2D(t.TEXTURE_CUBE_MAP,$e,ie,Ie.width,Ie.height);for(let Ne=0;Ne<6;Ne++){ue=we[Ne].mipmaps;for(let Le=0;Le<ue.length;Le++){const tt=ue[Le];U.format!==ec?Ue!==null?De?xe&&n.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Ne,Le,0,0,tt.width,tt.height,Ue,tt.data):n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Ne,Le,ie,tt.width,tt.height,0,tt.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):De?xe&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Ne,Le,0,0,tt.width,tt.height,Ue,Oe,tt.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Ne,Le,ie,tt.width,tt.height,0,Ue,Oe,tt.data)}}}else{if(ue=U.mipmaps,De&&Ve){ue.length>0&&$e++;const Ne=Pe(we[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,$e,ie,Ne.width,Ne.height)}for(let Ne=0;Ne<6;Ne++)if(ae){De?xe&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Ne,0,0,0,we[Ne].width,we[Ne].height,Ue,Oe,we[Ne].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Ne,0,ie,we[Ne].width,we[Ne].height,0,Ue,Oe,we[Ne].data);for(let Le=0;Le<ue.length;Le++){const St=ue[Le].image[Ne].image;De?xe&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Ne,Le+1,0,0,St.width,St.height,Ue,Oe,St.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Ne,Le+1,ie,St.width,St.height,0,Ue,Oe,St.data)}}else{De?xe&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Ne,0,0,0,Ue,Oe,we[Ne]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Ne,0,ie,Ue,Oe,we[Ne]);for(let Le=0;Le<ue.length;Le++){const tt=ue[Le];De?xe&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Ne,Le+1,0,0,Ue,Oe,tt.image[Ne]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Ne,Le+1,ie,Ue,Oe,tt.image[Ne])}}}y(U)&&g(t.TEXTURE_CUBE_MAP),ye.__version=_e.version,U.onUpdate&&U.onUpdate(U)}se.__version=U.version}function W(se,U,Q,oe,_e,ye){const re=s.convert(Q.format,Q.colorSpace),he=s.convert(Q.type),pe=w(Q.internalFormat,re,he,Q.colorSpace);if(!r.get(U).__hasExternalTextures){const ae=Math.max(1,U.width>>ye),we=Math.max(1,U.height>>ye);_e===t.TEXTURE_3D||_e===t.TEXTURE_2D_ARRAY?n.texImage3D(_e,ye,pe,ae,we,U.depth,0,re,he,null):n.texImage2D(_e,ye,pe,ae,we,0,re,he,null)}n.bindFramebuffer(t.FRAMEBUFFER,se),X(U)?l.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,oe,_e,r.get(Q).__webglTexture,0,ve(U)):(_e===t.TEXTURE_2D||_e>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&_e<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,oe,_e,r.get(Q).__webglTexture,ye),n.bindFramebuffer(t.FRAMEBUFFER,null)}function G(se,U,Q){if(t.bindRenderbuffer(t.RENDERBUFFER,se),U.depthBuffer){const oe=U.depthTexture,_e=oe&&oe.isDepthTexture?oe.type:null,ye=v(U.stencilBuffer,_e),re=U.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,he=ve(U);X(U)?l.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,he,ye,U.width,U.height):Q?t.renderbufferStorageMultisample(t.RENDERBUFFER,he,ye,U.width,U.height):t.renderbufferStorage(t.RENDERBUFFER,ye,U.width,U.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,re,t.RENDERBUFFER,se)}else{const oe=U.textures;for(let _e=0;_e<oe.length;_e++){const ye=oe[_e],re=s.convert(ye.format,ye.colorSpace),he=s.convert(ye.type),pe=w(ye.internalFormat,re,he,ye.colorSpace),je=ve(U);Q&&X(U)===!1?t.renderbufferStorageMultisample(t.RENDERBUFFER,je,pe,U.width,U.height):X(U)?l.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,je,pe,U.width,U.height):t.renderbufferStorage(t.RENDERBUFFER,pe,U.width,U.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function K(se,U){if(U&&U.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(t.FRAMEBUFFER,se),!(U.depthTexture&&U.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!r.get(U.depthTexture).__webglTexture||U.depthTexture.image.width!==U.width||U.depthTexture.image.height!==U.height)&&(U.depthTexture.image.width=U.width,U.depthTexture.image.height=U.height,U.depthTexture.needsUpdate=!0),E(U.depthTexture,0);const oe=r.get(U.depthTexture).__webglTexture,_e=ve(U);if(U.depthTexture.format===Oy)X(U)?l.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,oe,0,_e):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,oe,0);else if(U.depthTexture.format===Wv)X(U)?l.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,oe,0,_e):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,oe,0);else throw new Error("Unknown depthTexture format")}function ee(se){const U=r.get(se),Q=se.isWebGLCubeRenderTarget===!0;if(se.depthTexture&&!U.__autoAllocateDepthBuffer){if(Q)throw new Error("target.depthTexture not supported in Cube render targets");K(U.__webglFramebuffer,se)}else if(Q){U.__webglDepthbuffer=[];for(let oe=0;oe<6;oe++)n.bindFramebuffer(t.FRAMEBUFFER,U.__webglFramebuffer[oe]),U.__webglDepthbuffer[oe]=t.createRenderbuffer(),G(U.__webglDepthbuffer[oe],se,!1)}else n.bindFramebuffer(t.FRAMEBUFFER,U.__webglFramebuffer),U.__webglDepthbuffer=t.createRenderbuffer(),G(U.__webglDepthbuffer,se,!1);n.bindFramebuffer(t.FRAMEBUFFER,null)}function V(se,U,Q){const oe=r.get(se);U!==void 0&&W(oe.__webglFramebuffer,se,se.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),Q!==void 0&&ee(se)}function J(se){const U=se.texture,Q=r.get(se),oe=r.get(U);se.addEventListener("dispose",_);const _e=se.textures,ye=se.isWebGLCubeRenderTarget===!0,re=_e.length>1;if(re||(oe.__webglTexture===void 0&&(oe.__webglTexture=t.createTexture()),oe.__version=U.version,a.memory.textures++),ye){Q.__webglFramebuffer=[];for(let he=0;he<6;he++)if(U.mipmaps&&U.mipmaps.length>0){Q.__webglFramebuffer[he]=[];for(let pe=0;pe<U.mipmaps.length;pe++)Q.__webglFramebuffer[he][pe]=t.createFramebuffer()}else Q.__webglFramebuffer[he]=t.createFramebuffer()}else{if(U.mipmaps&&U.mipmaps.length>0){Q.__webglFramebuffer=[];for(let he=0;he<U.mipmaps.length;he++)Q.__webglFramebuffer[he]=t.createFramebuffer()}else Q.__webglFramebuffer=t.createFramebuffer();if(re)for(let he=0,pe=_e.length;he<pe;he++){const je=r.get(_e[he]);je.__webglTexture===void 0&&(je.__webglTexture=t.createTexture(),a.memory.textures++)}if(se.samples>0&&X(se)===!1){Q.__webglMultisampledFramebuffer=t.createFramebuffer(),Q.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,Q.__webglMultisampledFramebuffer);for(let he=0;he<_e.length;he++){const pe=_e[he];Q.__webglColorRenderbuffer[he]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,Q.__webglColorRenderbuffer[he]);const je=s.convert(pe.format,pe.colorSpace),ae=s.convert(pe.type),we=w(pe.internalFormat,je,ae,pe.colorSpace,se.isXRRenderTarget===!0),Ie=ve(se);t.renderbufferStorageMultisample(t.RENDERBUFFER,Ie,we,se.width,se.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+he,t.RENDERBUFFER,Q.__webglColorRenderbuffer[he])}t.bindRenderbuffer(t.RENDERBUFFER,null),se.depthBuffer&&(Q.__webglDepthRenderbuffer=t.createRenderbuffer(),G(Q.__webglDepthRenderbuffer,se,!0)),n.bindFramebuffer(t.FRAMEBUFFER,null)}}if(ye){n.bindTexture(t.TEXTURE_CUBE_MAP,oe.__webglTexture),q(t.TEXTURE_CUBE_MAP,U);for(let he=0;he<6;he++)if(U.mipmaps&&U.mipmaps.length>0)for(let pe=0;pe<U.mipmaps.length;pe++)W(Q.__webglFramebuffer[he][pe],se,U,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+he,pe);else W(Q.__webglFramebuffer[he],se,U,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+he,0);y(U)&&g(t.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(re){for(let he=0,pe=_e.length;he<pe;he++){const je=_e[he],ae=r.get(je);n.bindTexture(t.TEXTURE_2D,ae.__webglTexture),q(t.TEXTURE_2D,je),W(Q.__webglFramebuffer,se,je,t.COLOR_ATTACHMENT0+he,t.TEXTURE_2D,0),y(je)&&g(t.TEXTURE_2D)}n.unbindTexture()}else{let he=t.TEXTURE_2D;if((se.isWebGL3DRenderTarget||se.isWebGLArrayRenderTarget)&&(he=se.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(he,oe.__webglTexture),q(he,U),U.mipmaps&&U.mipmaps.length>0)for(let pe=0;pe<U.mipmaps.length;pe++)W(Q.__webglFramebuffer[pe],se,U,t.COLOR_ATTACHMENT0,he,pe);else W(Q.__webglFramebuffer,se,U,t.COLOR_ATTACHMENT0,he,0);y(U)&&g(he),n.unbindTexture()}se.depthBuffer&&ee(se)}function Y(se){const U=se.textures;for(let Q=0,oe=U.length;Q<oe;Q++){const _e=U[Q];
vendor: 7,431 bytes, line 4686
4686if(y(_e)){const ye=se.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,re=r.get(_e).__webglTexture;n.bindTexture(ye,re),g(ye),n.unbindTexture()}}}const $=[],fe=[];function ce(se){if(se.samples>0){if(X(se)===!1){const U=se.textures,Q=se.width,oe=se.height;let _e=t.COLOR_BUFFER_BIT;const ye=se.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,re=r.get(se),he=U.length>1;if(he)for(let pe=0;pe<U.length;pe++)n.bindFramebuffer(t.FRAMEBUFFER,re.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+pe,t.RENDERBUFFER,null),n.bindFramebuffer(t.FRAMEBUFFER,re.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+pe,t.TEXTURE_2D,null,0);n.bindFramebuffer(t.READ_FRAMEBUFFER,re.__webglMultisampledFramebuffer),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,re.__webglFramebuffer);for(let pe=0;pe<U.length;pe++){if(se.resolveDepthBuffer&&(se.depthBuffer&&(_e|=t.DEPTH_BUFFER_BIT),se.stencilBuffer&&se.resolveStencilBuffer&&(_e|=t.STENCIL_BUFFER_BIT)),he){t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,re.__webglColorRenderbuffer[pe]);const je=r.get(U[pe]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,je,0)}t.blitFramebuffer(0,0,Q,oe,0,0,Q,oe,_e,t.NEAREST),c===!0&&($.length=0,fe.length=0,$.push(t.COLOR_ATTACHMENT0+pe),se.depthBuffer&&se.resolveDepthBuffer===!1&&($.push(ye),fe.push(ye),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,fe)),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,$))}if(n.bindFramebuffer(t.READ_FRAMEBUFFER,null),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),he)for(let pe=0;pe<U.length;pe++){n.bindFramebuffer(t.FRAMEBUFFER,re.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+pe,t.RENDERBUFFER,re.__webglColorRenderbuffer[pe]);const je=r.get(U[pe]).__webglTexture;n.bindFramebuffer(t.FRAMEBUFFER,re.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+pe,t.TEXTURE_2D,je,0)}n.bindFramebuffer(t.DRAW_FRAMEBUFFER,re.__webglMultisampledFramebuffer)}else if(se.depthBuffer&&se.resolveDepthBuffer===!1&&c){const U=se.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[U])}}}function ve(se){return Math.min(i.maxSamples,se.samples)}function X(se){const U=r.get(se);return se.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&U.__useRenderToTexture!==!1}function de(se){const U=a.render.frame;d.get(se)!==U&&(d.set(se,U),se.update())}function Te(se,U){const Q=se.colorSpace,oe=se.format,_e=se.type;return se.isCompressedTexture===!0||se.isVideoTexture===!0||Q!==rp&&Q!==Af&&(Xn.getTransfer(Q)===Fr?(oe!==ec||_e!==Td)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",Q)),U}function Pe(se){return typeof HTMLImageElement<"u"&&se instanceof HTMLImageElement?(u.width=se.naturalWidth||se.width,u.height=se.naturalHeight||se.height):typeof VideoFrame<"u"&&se instanceof VideoFrame?(u.width=se.displayWidth,u.height=se.displayHeight):(u.width=se.width,u.height=se.height),u}this.allocateTextureUnit=I,this.resetTextureUnits=M,this.setTexture2D=E,this.setTexture2DArray=P,this.setTexture3D=O,this.setTextureCube=L,this.rebindTextures=V,this.setupRenderTarget=J,this.updateRenderTargetMipmap=Y,this.updateMultisampleRenderTarget=ce,this.setupDepthRenderbuffer=ee,this.setupFrameBufferTexture=W,this.useMultisampledRTT=X}function B0t(t,e){function n(r,i=Af){let s;const a=Xn.getTransfer(i);if(r===Td)return t.UNSIGNED_BYTE;if(r===KB)return t.UNSIGNED_SHORT_4_4_4_4;if(r===YB)return t.UNSIGNED_SHORT_5_5_5_1;if(r===wpe)return t.UNSIGNED_INT_5_9_9_9_REV;if(r===vpe)return t.BYTE;if(r===bpe)return t.SHORT;if(r===R_)return t.UNSIGNED_SHORT;if(r===qB)return t.INT;if(r===Zm)return t.UNSIGNED_INT;if(r===rd)return t.FLOAT;if(r===eN)return t.HALF_FLOAT;if(r===_pe)return t.ALPHA;if(r===Spe)return t.RGB;if(r===ec)return t.RGBA;if(r===Npe)return t.LUMINANCE;if(r===jpe)return t.LUMINANCE_ALPHA;if(r===Oy)return t.DEPTH_COMPONENT;if(r===Wv)return t.DEPTH_STENCIL;if(r===Cpe)return t.RED;if(r===XB)return t.RED_INTEGER;if(r===kpe)return t.RG;if(r===QB)return t.RG_INTEGER;if(r===JB)return t.RGBA_INTEGER;if(r===JC||r===ZC||r===ek||r===tk)if(a===Fr)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(r===JC)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===ZC)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===ek)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===tk)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(r===JC)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===ZC)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===ek)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===tk)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===J$||r===Z$||r===e5||r===t5)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(r===J$)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===Z$)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===e5)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===t5)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===n5||r===r5||r===i5)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(r===n5||r===r5)return a===Fr?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(r===i5)return a===Fr?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(r===s5||r===a5||r===o5||r===l5||r===c5||r===u5||r===d5||r===f5||r===h5||r===p5||r===m5||r===g5||r===x5||r===y5)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(r===s5)return a===Fr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===a5)return a===Fr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===o5)return a===Fr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===l5)return a===Fr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===c5)return a===Fr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===u5)return a===Fr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===d5)return a===Fr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===f5)return a===Fr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===h5)return a===Fr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===p5)return a===Fr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===m5)return a===Fr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===g5)return a===Fr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===x5)return a===Fr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===y5)return a===Fr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===nk||r===v5||r===b5)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(r===nk)return a===Fr?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(r===v5)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(r===b5)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(r===Epe||r===w5||r===_5||r===S5)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(r===nk)return s.COMPRESSED_RED_RGT
vendor: 9,895 bytes, lines 4686-4710
4686C1_EXT;if(r===w5)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===_5)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===S5)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===Hv?t.UNSIGNED_INT_24_8:t[r]!==void 0?t[r]:null}return{convert:n}}class V0t extends ql{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Vj extends Co{constructor(){super(),this.isGroup=!0,this.type="Group"}}const H0t={type:"move"};class GI{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Vj,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Vj,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Re,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Re),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Vj,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Re,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Re),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const n=this._hand;if(n)for(const r of e.hand.values())this._getHandJoint(n,r)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,n,r){let i=null,s=null,a=null;const l=this._targetRay,c=this._grip,u=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(u&&e.hand){a=!0;for(const x of e.hand.values()){const y=n.getJointPose(x,r),g=this._getHandJoint(u,x);y!==null&&(g.matrix.fromArray(y.transform.matrix),g.matrix.decompose(g.position,g.rotation,g.scale),g.matrixWorldNeedsUpdate=!0,g.jointRadius=y.radius),g.visible=y!==null}const d=u.joints["index-finger-tip"],f=u.joints["thumb-tip"],h=d.position.distanceTo(f.position),p=.02,m=.005;u.inputState.pinching&&h>p+m?(u.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!u.inputState.pinching&&h<=p-m&&(u.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(s=n.getPose(e.gripSpace,r),s!==null&&(c.matrix.fromArray(s.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,s.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(s.linearVelocity)):c.hasLinearVelocity=!1,s.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(s.angularVelocity)):c.hasAngularVelocity=!1));l!==null&&(i=n.getPose(e.targetRaySpace,r),i===null&&s!==null&&(i=s),i!==null&&(l.matrix.fromArray(i.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,i.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(i.linearVelocity)):l.hasLinearVelocity=!1,i.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(i.angularVelocity)):l.hasAngularVelocity=!1,this.dispatchEvent(H0t)))}return l!==null&&(l.visible=i!==null),c!==null&&(c.visible=s!==null),u!==null&&(u.visible=a!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const r=new Vj;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[n.jointName]=r,e.add(r)}return e.joints[n.jointName]}}const W0t=`
4687void main() {
4688
4689	gl_Position = vec4( position, 1.0 );
4690
4691}`,G0t=`
4692uniform sampler2DArray depthColor;
4693uniform float depthWidth;
4694uniform float depthHeight;
4695
4696void main() {
4697
4698	vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
4699
4700	if ( coord.x >= 1.0 ) {
4701
4702		gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
4703
4704	} else {
4705
4706		gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
4707
4708	}
4709
4710}`;class q0t{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,n,r){if(this.texture===null){const i=new Ha,s=e.properties.get(i);s.__webglTexture=n.texture,(n.depthNear!=r.depthNear||n.depthFar!=r.depthFar)&&(this.depthNear=n.depthNear,this.depthFar=n.depthFar),this.texture=i}}getMesh(e){if(this.texture!==null&&this.mesh===null){const n=e.cameras[0].viewport,r=new Pd({vertexShader:W0t,fragmentShader:G0t,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new Hc(new sN(20,20),r)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class K0t extends q0{constructor(e,n){super();const r=this;let i=null,s=1,a=null,l="local-floor",c=1,u=null,d=null,f=null,h=null,p=null,m=null;const x=new q0t,y=n.getContextAttributes();let g=null,w=null;const v=[],N=[],S=new Mn;let _=null;const j=new ql;j.layers.enable(1),j.viewport=new ps;const A=new ql;A.layers.enable(2),A.viewport=new ps;const C=[j,A],k=new V0t;k.layers.enable(1),k.layers.enable(2);let M=null,I=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(H){let W=v[H];return W===void 0&&(W=new GI,v[H]=W),W.getTargetRaySpace()},this.getControllerGrip=function(H){let W=v[H];return W===void 0&&(W=new GI,v[H]=W),W.getGripSpace()},this.getHand=function(H){let W=v[H];return W===void 0&&(W=new GI,v[H]=W),W.getHandSpace()};function R(H){const W=N.indexOf(H.inputSource);if(W===-1)return;const G=v[W];G!==void 0&&(G.update(H.inputSource,H.frame,u||a),G.dispatchEvent({type:H.type,data:H.inputSource}))}function E(){i.removeEventListener("select",R),i.removeEventListener("selectstart",R),i.removeEventListener("selectend",R),i.removeEventListener("squeeze",R),i.removeEventListener("squeezestart",R),i.removeEventListener("squeezeend",R),i.removeEventListener("end",E),i.removeEventListener("inputsourceschange",P);for(let H=0;H<v.length;H++){const W=N[H];W!==null&&(N[H]=null,v[H].disconnect(W))}M=null,I=null,x.reset(),e.setRenderTarget(g),p=null,h=null,f=null,i=null,w=null,z.stop(),r.isPresenting=!1,e.setPixelRatio(_),e.setSize(S.width,S.height,!1),r.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(H){s=H,r.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(H){l=H,r.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return u||a},this.setReferenceSpace=function(H){u=H},this.getBaseLayer=function(){return h!==null?h:p},this.getBinding=function(){return f},this.getFrame=function(){return m},this.getSession=function(){return i},this.setSession=async function(H){if(i=H,i!==null){if(g=e.getRenderTarget(),i.addEventListener("select",R),i.addEventListener("selectstart",R),i.addEventListener("selectend",R),i.addEventListener("squeeze",R),i.addEventListener("squeezestart",R),i.addEventListener("squeezeend",R),i.addEventListener("end",E),i.addEventListener("inputsourceschange",P),y.xrCompatible!==!0&&await n.makeXRCompatible(),_=e.getPixelRatio(),e.getSize(S),i.renderState.layers===void 0){const W={antialias:y.antialias,alpha:!0,depth:y.depth,stencil:y.stencil,framebufferScaleFactor:s};p=new XRWebGLLayer(i,n,W),i.updateRenderState({baseLayer:p}),e.setPixelRatio(1),e.setSize(p.framebufferWidth,p.framebufferHeight,!1),w=new eg(p.framebufferWidth,p.framebufferHeight,{format:ec,type:Td,colorSpace:e.outputColorSpace,stencilBuffer:y.stencil})}else{let W=null,G=null,K=null;y.depth&&(K=y.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,W=y.stencil?Wv:Oy,G=y.stencil?Hv:Zm);const ee={colorFormat:n.RGBA8,depthFormat:K,scaleFactor:s};f=new XRWebGLBinding(i,n),h=f.createProjectionLayer(ee),i.updateRenderState({layers:[h]}),e.setPixelRatio(1),e.setSize(h.textureWidth,h.textureHeight,!1),w=new eg(h.textureWidth,h.textureHeight,{format:ec,type:Td,depthTexture:new Hpe(h.textureWidth,h.textureHeight,G,void 0,void 0,void 0,void 0,void 0,void 0,W),stencilBuffer:y.stencil,colorSpace:e.outputColorSpace,samples:y.antialias?4:0,resolveDepthBuffer:h.ignoreDepthValues===!1})}w.isXRRenderTarget=!0,this.setFoveation(c),u=null,a=await i.requestReferenceSpace(l),z.setContext(i),z.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return x.getDepthTexture()};function P(H){for(let W=0;W<H.removed.length;W++){const G=H.removed[W],K=N.indexOf(G);K>=0&&(N[K]=null,v[K].disconnect(G))}for(let W=0;W<H.added.length;W++){const G=H.added[W];let K=N.indexOf(G);if(K===-1){for(let V=0;V<v.length;V++)if(V>=N.length){N.push(G),K=V;break}else if(N[V]===null){N[V]=G,K=V;break}if(K===-1)break}const ee=v[K];ee&&ee.connect(G)}}const O=new Re,L=new Re;function T(H,W,G){O.setFromMatrixPosition(W.matrixWorld),L.setFromMatrixPosition(G.matrixWorld);const K=O.distanceTo(L),ee=W.projectionMatrix.elements,V=G.projectionMatrix.elements,J=ee[14]/(ee[10]-1),Y=ee[14]/(ee[10]+1),$=(ee[9]+1)/ee[5],fe=(ee[9]-1)/ee[5],ce=(ee[8]-1)/ee[0],ve=(V[8]+1)/V[0],X=J*ce,de=J*ve,Te=K/(-ce+ve),Pe=Te*-ce;W.matrixWorld.decompose(H.position,H.quaternion,H.scale),H.translateX(Pe),H.translateZ(Te),H.matrixWorld.compose(H.position,H.quaternion,H.scale),H.matrixWorldInverse.copy(H.matrixWorld).invert();const se=J+Te,U=Y+Te,Q=X-Pe,oe=de+(K-Pe),_e=$*Y/U*se,ye=fe*Y/U*se;H.projectionMatrix.makePerspective(Q,oe,_e,ye,se,U),H.projectionMatrixInverse.copy(H.projectionMatrix).invert()}function D(H,W){W===null?H.matrixWorld.copy(H.matrix):H.matrixWorld.multiplyMatrices(W.matrixWorld,H.matrix
vendor: 30,692 bytes, line 4710
4710),H.matrixWorldInverse.copy(H.matrixWorld).invert()}this.updateCamera=function(H){if(i===null)return;x.texture!==null&&(H.near=x.depthNear,H.far=x.depthFar),k.near=A.near=j.near=H.near,k.far=A.far=j.far=H.far,(M!==k.near||I!==k.far)&&(i.updateRenderState({depthNear:k.near,depthFar:k.far}),M=k.near,I=k.far,j.near=M,j.far=I,A.near=M,A.far=I,j.updateProjectionMatrix(),A.updateProjectionMatrix(),H.updateProjectionMatrix());const W=H.parent,G=k.cameras;D(k,W);for(let K=0;K<G.length;K++)D(G[K],W);G.length===2?T(k,j,A):k.projectionMatrix.copy(j.projectionMatrix),F(H,k,W)};function F(H,W,G){G===null?H.matrix.copy(W.matrixWorld):(H.matrix.copy(G.matrixWorld),H.matrix.invert(),H.matrix.multiply(W.matrixWorld)),H.matrix.decompose(H.position,H.quaternion,H.scale),H.updateMatrixWorld(!0),H.projectionMatrix.copy(W.projectionMatrix),H.projectionMatrixInverse.copy(W.projectionMatrixInverse),H.isPerspectiveCamera&&(H.fov=N5*2*Math.atan(1/H.projectionMatrix.elements[5]),H.zoom=1)}this.getCamera=function(){return k},this.getFoveation=function(){if(!(h===null&&p===null))return c},this.setFoveation=function(H){c=H,h!==null&&(h.fixedFoveation=H),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=H)},this.hasDepthSensing=function(){return x.texture!==null},this.getDepthSensingMesh=function(){return x.getMesh(k)};let q=null;function B(H,W){if(d=W.getViewerPose(u||a),m=W,d!==null){const G=d.views;p!==null&&(e.setRenderTargetFramebuffer(w,p.framebuffer),e.setRenderTarget(w));let K=!1;G.length!==k.cameras.length&&(k.cameras.length=0,K=!0);for(let V=0;V<G.length;V++){const J=G[V];let Y=null;if(p!==null)Y=p.getViewport(J);else{const fe=f.getViewSubImage(h,J);Y=fe.viewport,V===0&&(e.setRenderTargetTextures(w,fe.colorTexture,h.ignoreDepthValues?void 0:fe.depthStencilTexture),e.setRenderTarget(w))}let $=C[V];$===void 0&&($=new ql,$.layers.enable(V),$.viewport=new ps,C[V]=$),$.matrix.fromArray(J.transform.matrix),$.matrix.decompose($.position,$.quaternion,$.scale),$.projectionMatrix.fromArray(J.projectionMatrix),$.projectionMatrixInverse.copy($.projectionMatrix).invert(),$.viewport.set(Y.x,Y.y,Y.width,Y.height),V===0&&(k.matrix.copy($.matrix),k.matrix.decompose(k.position,k.quaternion,k.scale)),K===!0&&k.cameras.push($)}const ee=i.enabledFeatures;if(ee&&ee.includes("depth-sensing")){const V=f.getDepthInformation(G[0]);V&&V.isValid&&V.texture&&x.init(e,V,i.renderState)}}for(let G=0;G<v.length;G++){const K=N[G],ee=v[G];K!==null&&ee!==void 0&&ee.update(K,W,u||a)}q&&q(H,W),W.detectedPlanes&&r.dispatchEvent({type:"planesdetected",data:W}),m=null}const z=new Bpe;z.setAnimationLoop(B),this.setAnimationLoop=function(H){q=H},this.dispose=function(){}}}const _p=new Md,Y0t=new es;function X0t(t,e){function n(y,g){y.matrixAutoUpdate===!0&&y.updateMatrix(),g.value.copy(y.matrix)}function r(y,g){g.color.getRGB(y.fogColor.value,$pe(t)),g.isFog?(y.fogNear.value=g.near,y.fogFar.value=g.far):g.isFogExp2&&(y.fogDensity.value=g.density)}function i(y,g,w,v,N){g.isMeshBasicMaterial||g.isMeshLambertMaterial?s(y,g):g.isMeshToonMaterial?(s(y,g),f(y,g)):g.isMeshPhongMaterial?(s(y,g),d(y,g)):g.isMeshStandardMaterial?(s(y,g),h(y,g),g.isMeshPhysicalMaterial&&p(y,g,N)):g.isMeshMatcapMaterial?(s(y,g),m(y,g)):g.isMeshDepthMaterial?s(y,g):g.isMeshDistanceMaterial?(s(y,g),x(y,g)):g.isMeshNormalMaterial?s(y,g):g.isLineBasicMaterial?(a(y,g),g.isLineDashedMaterial&&l(y,g)):g.isPointsMaterial?c(y,g,w,v):g.isSpriteMaterial?u(y,g):g.isShadowMaterial?(y.color.value.copy(g.color),y.opacity.value=g.opacity):g.isShaderMaterial&&(g.uniformsNeedUpdate=!1)}function s(y,g){y.opacity.value=g.opacity,g.color&&y.diffuse.value.copy(g.color),g.emissive&&y.emissive.value.copy(g.emissive).multiplyScalar(g.emissiveIntensity),g.map&&(y.map.value=g.map,n(g.map,y.mapTransform)),g.alphaMap&&(y.alphaMap.value=g.alphaMap,n(g.alphaMap,y.alphaMapTransform)),g.bumpMap&&(y.bumpMap.value=g.bumpMap,n(g.bumpMap,y.bumpMapTransform),y.bumpScale.value=g.bumpScale,g.side===Va&&(y.bumpScale.value*=-1)),g.normalMap&&(y.normalMap.value=g.normalMap,n(g.normalMap,y.normalMapTransform),y.normalScale.value.copy(g.normalScale),g.side===Va&&y.normalScale.value.negate()),g.displacementMap&&(y.displacementMap.value=g.displacementMap,n(g.displacementMap,y.displacementMapTransform),y.displacementScale.value=g.displacementScale,y.displacementBias.value=g.displacementBias),g.emissiveMap&&(y.emissiveMap.value=g.emissiveMap,n(g.emissiveMap,y.emissiveMapTransform)),g.specularMap&&(y.specularMap.value=g.specularMap,n(g.specularMap,y.specularMapTransform)),g.alphaTest>0&&(y.alphaTest.value=g.alphaTest);const w=e.get(g),v=w.envMap,N=w.envMapRotation;v&&(y.envMap.value=v,_p.copy(N),_p.x*=-1,_p.y*=-1,_p.z*=-1,v.isCubeTexture&&v.isRenderTargetTexture===!1&&(_p.y*=-1,_p.z*=-1),y.envMapRotation.value.setFromMatrix4(Y0t.makeRotationFromEuler(_p)),y.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,y.reflectivity.value=g.reflectivity,y.ior.value=g.ior,y.refractionRatio.value=g.refractionRatio),g.lightMap&&(y.lightMap.value=g.lightMap,y.lightMapIntensity.value=g.lightMapIntensity,n(g.lightMap,y.lightMapTransform)),g.aoMap&&(y.aoMap.value=g.aoMap,y.aoMapIntensity.value=g.aoMapIntensity,n(g.aoMap,y.aoMapTransform))}function a(y,g){y.diffuse.value.copy(g.color),y.opacity.value=g.opacity,g.map&&(y.map.value=g.map,n(g.map,y.mapTransform))}function l(y,g){y.dashSize.value=g.dashSize,y.totalSize.value=g.dashSize+g.gapSize,y.scale.value=g.scale}function c(y,g,w,v){y.diffuse.value.copy(g.color),y.opacity.value=g.opacity,y.size.value=g.size*w,y.scale.value=v*.5,g.map&&(y.map.value=g.map,n(g.map,y.uvTransform)),g.alphaMap&&(y.alphaMap.value=g.alphaMap,n(g.alphaMap,y.alphaMapTransform)),g.alphaTest>0&&(y.alphaTest.value=g.alphaTest)}function u(y,g){y.diffuse.value.copy(g.color),y.opacity.value=g.opacity,y.rotation.value=g.rotation,g.map&&(y.map.value=g.map,n(g.map,y.mapTransform)),g.alphaMap&&(y.alphaMap.value=g.alphaMap,n(g.alphaMap,y.alphaMapTransform)),g.alphaTest>0&&(y.alphaTest.value=g.alphaTest)}function d(y,g){y.specular.value.copy(g.specular),y.shininess.value=Math.max(g.shininess,1e-4)}function f(y,g){g.gradientMap&&(y.gradientMap.value=g.gradientMap)}function h(y,g){y.metalness.value=g.metalness,g.metalnessMap&&(y.metalnessMap.value=g.metalnessMap,n(g.metalnessMap,y.metalnessMapTransform)),y.roughness.value=g.roughness,g.roughnessMap&&(y.roughnessMap.value=g.roughnessMap,n(g.roughnessMap,y.roughnessMapTransform)),g.envMap&&(y.envMapIntensity.value=g.envMapIntensity)}function p(y,g,w){y.ior.value=g.ior,g.sheen>0&&(y.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),y.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(y.sheenColorMap.value=g.sheenColorMap,n(g.sheenColorMap,y.sheenColorMapTransform)),g.sheenRoughnessMap&&(y.sheenRoughnessMap.value=g.sheenRoughnessMap,n(g.sheenRoughnessMap,y.sheenRoughnessMapTransform))),g.clearcoat>0&&(y.clearcoat.value=g.clearcoat,y.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(y.clearcoatMap.value=g.clearcoatMap,n(g.clearcoatMap,y.clearcoatMapTransform)),g.clearcoatRoughnessMap&&(y.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap,n(g.clearcoatRoughnessMap,y.clearcoatRoughnessMapTransform)),g.clearcoatNormalMap&&(y.clearcoatNormalMap.value=g.clearcoatNormalMap,n(g.clearcoatNormalMap,y.clearcoatNormalMapTransform),y.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),g.side===Va&&y.clearcoatNormalScale.value.negate())),g.dispersion>0&&(y.dispersion.value=g.dispersion),g.iridescence>0&&(y.iridescence.value=g.iridescence,y.iridescenceIOR.value=g.iridescenceIOR,y.iridescenceThicknessMinimum.value=g.iridescenceThicknessRange[0],y.iridescenceThicknessMaximum.value=g.iridescenceThicknessRange[1],g.iridescenceMap&&(y.iridescenceMap.value=g.iridescenceMap,n(g.iridescenceMap,y.iridescenceMapTransform)),g.iridescenceThicknessMap&&(y.iridescenceThicknessMap.value=g.iridescenceThicknessMap,n(g.iridescenceThicknessMap,y.iridescenceThicknessMapTransform))),g.transmission>0&&(y.transmission.value=g.transmission,y.transmissionSamplerMap.value=w.texture,y.transmissionSamplerSize.value.set(w.width,w.height),g.transmissionMap&&(y.transmissionMap.value=g.transmissionMap,n(g.transmissionMap,y.transmissionMapTransform)),y.thickness.value=g.thickness,g.thicknessMap&&(y.thicknessMap.value=g.thicknessMap,n(g.thicknessMap,y.thicknessMapTransform)),y.attenuationDistance.value=g.attenuationDistance,y.attenuationColor.value.copy(g.attenuationColor)),g.anisotropy>0&&(y.anisotropyVector.value.set(g.anisotropy*Math.cos(g.anisotropyRotation),g.anisotropy*Math.sin(g.anisotropyRotation)),g.anisotropyMap&&(y.anisotropyMap.value=g.anisotropyMap,n(g.anisotropyMap,y.anisotropyMapTransform))),y.specularIntensity.value=g.specularIntensity,y.specularColor.value.copy(g.specularColor),g.specularColorMap&&(y.specularColorMap.value=g.specularColorMap,n(g.specularColorMap,y.specularColorMapTransform)),g.specularIntensityMap&&(y.specularIntensityMap.value=g.specularIntensityMap,n(g.specularIntensityMap,y.specularIntensityMapTransform))}function m(y,g){g.matcap&&(y.matcap.value=g.matcap)}function x(y,g){const w=e.get(g).light;y.referencePosition.value.setFromMatrixPosition(w.matrixWorld),y.nearDistance.value=w.shadow.camera.near,y.farDistance.value=w.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function Q0t(t,e,n,r){let i={},s={},a=[];const l=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function c(w,v){const N=v.program;r.uniformBlockBinding(w,N)}function u(w,v){let N=i[w.id];N===void 0&&(m(w),N=d(w),i[w.id]=N,w.addEventListener("dispose",y));const S=v.program;r.updateUBOMapping(w,S);const _=e.render.frame;s[w.id]!==_&&(h(w),s[w.id]=_)}function d(w){const v=f();w.__bindingPointIndex=v;const N=t.createBuffer(),S=w.__size,_=w.usage;return t.bindBuffer(t.UNIFORM_BUFFER,N),t.bufferData(t.UNIFORM_BUFFER,S,_),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,v,N),N}function f(){for(let w=0;w<l;w++)if(a.indexOf(w)===-1)return a.push(w),w;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function h(w){const v=i[w.id],N=w.uniforms,S=w.__cache;t.bindBuffer(t.UNIFORM_BUFFER,v);for(let _=0,j=N.length;_<j;_++){const A=Array.isArray(N[_])?N[_]:[N[_]];for(let C=0,k=A.length;C<k;C++){const M=A[C];if(p(M,_,C,S)===!0){const I=M.__offset,R=Array.isArray(M.value)?M.value:[M.value];let E=0;for(let P=0;P<R.length;P++){const O=R[P],L=x(O);typeof O=="number"||typeof O=="boolean"?(M.__data[0]=O,t.bufferSubData(t.UNIFORM_BUFFER,I+E,M.__data)):O.isMatrix3?(M.__data[0]=O.elements[0],M.__data[1]=O.elements[1],M.__data[2]=O.elements[2],M.__data[3]=0,M.__data[4]=O.elements[3],M.__data[5]=O.elements[4],M.__data[6]=O.elements[5],M.__data[7]=0,M.__data[8]=O.elements[6],M.__data[9]=O.elements[7],M.__data[10]=O.elements[8],M.__data[11]=0):(O.toArray(M.__data,E),E+=L.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,I,M.__data)}}}t.bindBuffer(t.UNIFORM_BUFFER,null)}function p(w,v,N,S){const _=w.value,j=v+"_"+N;if(S[j]===void 0)return typeof _=="number"||typeof _=="boolean"?S[j]=_:S[j]=_.clone(),!0;{const A=S[j];if(typeof _=="number"||typeof _=="boolean"){if(A!==_)return S[j]=_,!0}else if(A.equals(_)===!1)return A.copy(_),!0}return!1}function m(w){const v=w.uniforms;let N=0;const S=16;for(let j=0,A=v.length;j<A;j++){const C=Array.isArray(v[j])?v[j]:[v[j]];for(let k=0,M=C.length;k<M;k++){const I=C[k],R=Array.isArray(I.value)?I.value:[I.value];for(let E=0,P=R.length;E<P;E++){const O=R[E],L=x(O),T=N%S,D=T%L.boundary,F=T+D;N+=D,F!==0&&S-F<L.storage&&(N+=S-F),I.__data=new Float32Array(L.storage/Float32Array.BYTES_PER_ELEMENT),I.__offset=N,N+=L.storage}}}const _=N%S;return _>0&&(N+=S-_),w.__size=N,w.__cache={},this}function x(w){const v={boundary:0,storage:0};return typeof w=="number"||typeof w=="boolean"?(v.boundary=4,v.storage=4):w.isVector2?(v.boundary=8,v.storage=8):w.isVector3||w.isColor?(v.boundary=16,v.storage=12):w.isVector4?(v.boundary=16,v.storage=16):w.isMatrix3?(v.boundary=48,v.storage=48):w.isMatrix4?(v.boundary=64,v.storage=64):w.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",w),v}function y(w){const v=w.target;v.removeEventListener("dispose",y);const N=a.indexOf(v.__bindingPointIndex);a.splice(N,1),t.deleteBuffer(i[v.id]),delete i[v.id],delete s[v.id]}function g(){for(const w in i)t.deleteBuffer(i[w]);a=[],i={},s={}}return{bind:c,update:u,dispose:g}}class J0t{constructor(e={}){const{canvas:n=zmt(),context:r=null,depth:i=!0,stencil:s=!1,alpha:a=!1,antialias:l=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:u=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:f=!1}=e;this.isWebGLRenderer=!0;let h;if(r!==null){if(typeof WebGLRenderingContext<"u"&&r instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");h=r.getContextAttributes().alpha}else h=a;const p=new Uint32Array(4),m=new Int32Array(4);let x=null,y=null;const g=[],w=[];this.domElement=n,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Mc,this.toneMapping=xh,this.toneMappingExposure=1;const v=this;let N=!1,S=0,_=0,j=null,A=-1,C=null;const k=new ps,M=new ps;let I=null;const R=new cr(0);let E=0,P=n.width,O=n.height,L=1,T=null,D=null;const F=new ps(0,0,P,O),q=new ps(0,0,P,O);let B=!1;const z=new zpe;let H=!1,W=!1;const G=new es,K=new Re,ee=new ps,V={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let J=!1;function Y(){return j===null?L:1}let $=r;function fe(Z,Se){return n.getContext(Z,Se)}try{const Z={alpha:!0,depth:i,stencil:s,antialias:l,premultipliedAlpha:c,preserveDrawingBuffer:u,powerPreference:d,failIfMajorPerformanceCaveat:f};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${GB}`),n.addEventListener("webglcontextlost",ue,!1),n.addEventListener("webglcontextrestored",Ne,!1),n.addEventListener("webglcontextcreationerror",Le,!1),$===null){const Se="webgl2";if($=fe(Se,Z),$===null)throw fe(Se)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(Z){throw console.error("THREE.WebGLRenderer: "+Z.message),Z}let ce,ve,X,de,Te,Pe,se,U,Q,oe,_e,ye,re,he,pe,je,ae,we,Ie,Ue,Oe,ie,De,Ve;function xe(){ce=new ivt($),ce.init(),ie=new B0t($,ce),ve=new Jyt($,ce,e,ie),X=new F0t($),de=new ovt($),Te=new j0t,Pe=new z0t($,ce,X,Te,ve,ie,de),se=new evt(v),U=new rvt(v),Q=new pgt($),De=new Xyt($,Q),oe=new svt($,Q,de,De),_e=new cvt($,oe,Q,de),Ie=new lvt($,ve,Pe),je=new Zyt(Te),ye=new N0t(v,se,U,ce,ve,De,je),re=new X0t(v,Te),he=new k0t,pe=new O0t(ce),we=new Yyt(v,se,U,X,_e,h,c),ae=new $0t(v,_e,ve),Ve=new Q0t($,de,ve,X),Ue=new Qyt($,ce,de),Oe=new avt($,ce,de),de.programs=ye.programs,v.capabilities=ve,v.extensions=ce,v.properties=Te,v.renderLists=he,v.shadowMap=ae,v.state=X,v.info=de}xe();const $e=new K0t(v,$);this.xr=$e,this.getContext=function(){return $},this.getContextAttributes=function(){return $.getContextAttributes()},this.forceContextLoss=function(){const Z=ce.get("WEBGL_lose_context");Z&&Z.loseContext()},this.forceContextRestore=function(){const Z=ce.get("WEBGL_lose_context");Z&&Z.restoreContext()},this.getPixelRatio=function(){return L},this.setPixelRatio=function(Z){Z!==void 0&&(L=Z,this.setSize(P,O,!1))},this.getSize=function(Z){return Z.set(P,O)},this.setSize=function(Z,Se,ke=!0){if($e.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}P=Z,O=Se,n.width=Math.floor(Z*L),n.height=Math.floor(Se*L),ke===!0&&(n.style.width=Z+"px",n.style.height=Se+"px"),this.setViewport(0,0,Z,Se)},this.getDrawingBufferSize=function(Z){return Z.set(P*L,O*L).floor()},this.setDrawingBufferSize=function(Z,Se,ke){P=Z,O=Se,L=ke,n.width=Math.floor(Z*ke),n.height=Math.floor(Se*ke),this.setViewport(0,0,Z,Se)},this.getCurrentViewport=function(Z){return Z.copy(k)},this.getViewport=function(Z){return Z.copy(F)},this.setViewport=function(Z,Se,ke,Ee){Z.isVector4?F.set(Z.x,Z.y,Z.z,Z.w):F.set(Z,Se,ke,Ee),X.viewport(k.copy(F).multiplyScalar(L).round())},this.getScissor=function(Z){return Z.copy(q)},this.setScissor=function(Z,Se,ke,Ee){Z.isVector4?q.set(Z.x,Z.y,Z.z,Z.w):q.set(Z,Se,ke,Ee),X.scissor(M.copy(q).multiplyScalar(L).round())},this.getScissorTest=function(){return B},this.setScissorTest=function(Z){X.setScissorTest(B=Z)},this.setOpaqueSort=function(Z){T=Z},this.setTransparentSort=function(Z){D=Z},this.getClearColor=function(Z){return Z.copy(we.getClearColor())},this.setClearColor=function(){we.setClearColor.apply(we,arguments)},this.getClearAlpha=function(){return we.getClearAlpha()},this.setClearAlpha=function(){we.setClearAlpha.apply(we,arguments)},this.clear=function(Z=!0,Se=!0,ke=!0){let Ee=0;if(Z){let Ae=!1;if(j!==null){const qe=j.texture.format;Ae=qe===JB||qe===QB||qe===XB}if(Ae){const qe=j.texture.type,st=qe===Td||qe===Zm||qe===R_||qe===Hv||qe===KB||qe===YB,it=we.getClearColor(),lt=we.getClearAlpha(),ht=it.r,At=it.g,pt=it.b;st?(p[0]=ht,p[1]=At,p[2]=pt,p[3]=lt,$.clearBufferuiv($.COLOR,0,p)):(m[0]=ht,m[1]=At,m[2]=pt,m[3]=lt,$.clearBufferiv($.COLOR,0,m))}else Ee|=$.COLOR_BUFFER_BIT}Se&&(Ee|=$.DEPTH_BUFFER_BIT),ke&&(Ee|=$.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),$.clear(Ee)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){n.removeEventListener("webglcontextlost",ue,!1),n.removeEventListener("webglcontextrestored",Ne,!1),n.removeEventListener("webglcontextcreationerror",Le,!1),he.dispose(),pe.dispose(),Te.dispose(),se.dispose(),U.dispose(),_e.dispose(),De.dispose(),Ve.dispose(),ye.dispose(),$e.dispose(),$e.removeEventListener("sessionstart",He),$e.removeEventListener("sessionend",Ye),Nt.stop()};function ue(Z){Z.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),N=!0}function Ne(){console.log("THREE.WebGLRenderer: Context Restored."),N=!1;const Z=de.autoReset,Se=ae.enabled,ke=ae.autoUpdate,Ee=ae.needsUpdate,Ae=ae.type;xe(),de.autoReset=Z,ae.enabled=Se,ae.autoUpdate=ke,ae.needsUpdate=Ee,ae.type=Ae}function Le(Z){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",Z.statusMessage)}function tt(Z){const Se=Z.target;Se.removeEventListener("dispose",tt),St(Se)}function St(Z){rt(Z),Te.remove(Z)}function rt(Z){const Se=Te.get(Z).programs;Se!==void 0&&(Se.forEach(function(ke){ye.releaseProgram(ke)}),Z.isShaderMaterial&&ye.releaseShaderCache(Z))}this.renderBufferDirect=function(Z,Se,ke,Ee,Ae,qe){Se===null&&(Se=V);const st=Ae.isMesh&&Ae.matrixWorld.determinant()<0,it=as(Z,Se,ke,Ee,Ae);X.setMaterial(Ee,st);let lt=ke.index,ht=1;if(Ee.wireframe===!0){if(lt=oe.getWireframeAttribute(ke),lt===void 0)return;ht=2}const At=ke.drawRange,pt=ke.attributes.position;let xn=At.start*ht,Fn=(At.start+At.count)*ht;qe!==null&&(xn=Math.max(xn,qe.start*ht),Fn=Math.min(Fn,(qe.start+qe.count)*ht)),lt!==null?(xn=Math.max(xn,0),Fn=Math.min(Fn,lt.count)):pt!=null&&(xn=Math.max(xn,0),Fn=Math.min(Fn,pt.count));const qr=Fn-xn;if(qr<0||qr===1/0)return;De.setup(Ae,Ee,it,ke,lt);let $s,Un=Ue;if(lt!==null&&($s=Q.get(lt),Un=Oe,Un.setIndex($s)),Ae.isMesh)Ee.wireframe===!0?(X.setLineWidth(Ee.wireframeLinewidth*Y()),Un.setMode($.LINES)):Un.setMode($.TRIANGLES);else if(Ae.isLine){let Ot=Ee.linewidth;Ot===void 0&&(Ot=1),X.setLineWidth(Ot*Y()),Ae.isLineSegments?Un.setMode($.LINES):Ae.isLineLoop?Un.setMode($.LINE_LOOP):Un.setMode($.LINE_STRIP)}else Ae.isPoints?Un.setMode($.POINTS):Ae.isSprite&&Un.setMode($.TRIANGLES);if(Ae.isBatchedMesh)if(Ae._multiDrawInstances!==null)Un.renderMultiDrawInstances(Ae._multiDrawStarts,Ae._multiDrawCounts,Ae._multiDrawCount,Ae._multiDrawInstances);else if(ce.get("WEBGL_multi_draw"))Un.renderMultiDraw(Ae._multiDrawStarts,Ae._multiDrawCounts,Ae._multiDrawCount);else{const Ot=Ae._multiDrawStarts,Fi=Ae._multiDrawCounts,zn=Ae._multiDrawCount,Za=lt?Q.get(lt).bytesPerElement:1,Yd=Te.get(Ee).currentProgram.getUniforms();for(let ta=0;ta<zn;ta++)Yd.setValue($,"_gl_DrawID",ta),Un.render(Ot[ta]/Za,Fi[ta])}else if(Ae.isInstancedMesh)Un.renderInstances(xn,qr,Ae.count);else if(ke.isInstancedBufferGeometry){const Ot=ke._maxInstanceCount!==void 0?ke._maxInstanceCount:1/0,Fi=Math.min(ke.instanceCount,Ot);Un.renderInstances(xn,qr,Fi)}else Un.render(xn,qr)};function vt(Z,Se,ke){Z.transparent===!0&&Z.side===Yu&&Z.forceSinglePass===!1?(Z.side=Va,Z.needsUpdate=!0,Jn(Z,Se,ke),Z.side=$h,Z.needsUpdate=!0,Jn(Z,Se,ke),Z.side=Yu):Jn(Z,Se,ke)}this.compile=function(Z,Se,ke=null){ke===null&&(ke=Z),y=pe.get(ke),y.init(Se),w.push(y),ke.traverseVisible(function(Ae){Ae.isLight&&Ae.layers.test(Se.layers)&&(y.pushLight(Ae),Ae.castShadow&&y.pushShadow(Ae))}),Z!==ke&&Z.traverseVisible(function(Ae){Ae.isLight&&Ae.layers.test(Se.layers)&&(y.pushLight(Ae),Ae.castShadow&&y.pushShadow(Ae))}),y.setupLights();const Ee=new Set;return Z.traverse(function(Ae){const qe=Ae.material;if(qe)if(Array.isArray(qe))for(let st=0;st<qe.length;st++){const it=qe[st];vt(it,ke,Ae),Ee.add(it)}else vt(qe,ke,Ae),Ee.add(qe)}),w.pop(),y=null,Ee},this.compileAsync=function(Z,Se,ke=null){const Ee=this.compile(Z,Se,ke);return new Promise(Ae=>{function qe(){if(Ee.forEach(function(st){Te.get(st).currentProgram.isReady()&&Ee.delete(st)}),Ee.size===0){Ae(Z);return}setTimeout(qe,10)}ce.get("KHR_parallel_shader_compile")!==null?qe():setTimeout(qe,10)})};let me=null;function Fe(Z){me&&me(Z)}function He(){Nt.stop()}function Ye(){Nt.start()}const Nt=new Bpe;Nt.setAnimationLoop(Fe),typeof self<"u"&&Nt.setContext(self),this.setAnimationLoop=function(Z){me=Z,$e.setAnimationLoop(Z),Z===null?Nt.stop():Nt.start()},$e.addEventListener("sessionstart",He),$e.addEventListener("sessionend",Ye),this.render=function(Z,Se){if(Se!==void 0&&Se.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(N===!0)return;if(Z.matrixWorldAutoUpdate===!0&&Z.updateMatrixWorld(),Se.parent===null&&Se.matrixWorldAutoUpdate===!0&&Se.updateMatrixWorld(),$e.enabled===!0&&$e.isPresenting===!0&&($e.cameraAutoUpdate===!0&&$e.updateCamera(Se),Se=$e.getCamera()),Z.isScene===!0&&Z.onBeforeRender(v,Z,Se,j),y=pe.get(Z,w.length),y.init(Se),w.push(y),G.multiplyMatrices(Se.projectionMatrix,Se.matrixWorldInverse),z.setFromProjectionMatrix(G),W=this.localClippingEnabled,H=je.init(this.clippingPlanes,W),x=he.get(Z,g.length),x.init(),g.push(x),$e.enabled===!0&&$e.isPresenting===!0){const qe=v.xr.getDepthSensingMesh();qe!==null&&qt(qe,Se,-1/0,v.sortObjects)}qt(Z,Se,0,v.sortObjects),x.finish(),v.sortObjects===!0&&x.sort(T,D),J=$e.enabled===!1||$e.isPresenting===!1||$e.hasDepthSensing()===!1,J&&we.addToRenderList(x,Z),this.info.render.frame++,H===!0&&je.beginShadows();const ke=y.state.shadowsArray;ae.render(ke,Z,Se),H===!0&&je.endShadows(),this.info.autoReset===!0&&this.info.reset();const Ee=x.opaque,Ae=x.transmissive;if(y.setupLights(),Se.isArrayCamera){const qe=Se.cameras;if(Ae.length>0)for(let st=0,it=qe.length;st<it;st++){const lt=qe[st];ea(Ee,Ae,Z,lt)}J&&we.render(Z);for(let st=0,it=qe.length;st<it;st++){const lt=qe[st];Jt(x,Z,lt,lt.viewport)}}else Ae.length>0&&ea(Ee,Ae,Z,Se),J&&we.render(Z),Jt(x,Z,Se);j!==null&&(Pe.updateMultisampleRenderTarget(j),Pe.updateRenderTargetMipmap(j)),Z.isScene===!0&&Z.onAfterRender(v,Z,Se),De.resetDefaultState(),A=-1,C=null,w.pop(),w.length>0?(y=w[w.length-1],H===!0&&je.setGlobalState(v.clippingPlanes,y.state.camera)):y=null,g.pop(),g.length>0?x=g[g.length-1]:x=null};function qt(Z,Se,ke,Ee){if(Z.visible===!1)return;if(Z.layers.test(Se.layers)){if(Z.isGroup)ke=Z.renderOrder;else if(Z.isLOD)Z.autoUpdate===!0&&Z.update(Se);else if(Z.isLight)y.pushLight(Z),Z.castShadow&&y.pushShadow(Z);else if(Z.isSprite){if(!Z.frustumCulled||z.intersectsSprite(Z)){Ee&&ee.setFromMatrixPosition(Z.matrixWorld).applyMatrix4(G);const st=_e.update(Z),it=Z.material;it.visible&&x.push(Z,st,it,ke,ee.z,null)}}else if((Z.isMesh||Z.isLine||Z.isPoints)&&(!Z.frustumCulled||z.intersectsObject(Z))){const st=_e.update(Z),it=Z.material;if(Ee&&(Z.boundingSphere!==void 0?(Z.boundingSphere===null&&Z.computeBoundingSphere(),ee.copy(Z.boundingSphere.center)):(st.boundingSphere===null&&st.computeBoundingSphere(),ee.copy(st.boundingSphere.center)),ee.applyMatrix4(Z.matrixWorld).applyMatrix4(G)),Array.isArray(it)){const lt=st.groups;for(let ht=0,At=lt.length;ht<At;ht++){const pt=lt[ht],xn=it[pt.materialIndex];xn&&xn.visible&&x.push(Z,st,xn,ke,ee.z,pt)}}else it.visible&&x.push(Z,st,it,ke,ee.z,null)}}const qe=Z.children;for(let st=0,it=qe.length;st<it;st++)qt(qe[st],Se,ke,Ee)}function Jt(Z,Se,ke,Ee){const Ae=Z.opaque,qe=Z.transmissive,st=Z.transparent;y.setupLightsView(ke),H===!0&&je.setGlobalState(v.clippingPlanes,ke),Ee&&X.viewport(k.copy(Ee)),Ae.length>0&&hn(Ae,Se,ke),qe.length>0&&hn(qe,Se,ke),st.length>0&&hn(st,Se,ke),X.buffers.depth.setTest(!0),X.buffers.depth.setMask(!0),X.buffers.color.setMask(!0),X.setPolygonOffset(!1)}function ea(Z,Se,ke,Ee){if((ke.isScene===!0?ke.overrideMaterial:null)!==null)return;y.state.transmissionRenderTarget[Ee.id]===void 0&&(y.state.transmissionRenderTarget[Ee.id]=new eg(1,1,{generateMipmaps:!0,type:ce.has("EXT_color_buffer_half_float")||ce.has("EXT_color_buffer_float")?eN:Td,minFilter:nm,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Xn.workingColorSpace}));const qe=y.state.transmissionRenderTarget[Ee.id],st=Ee.viewport||k;qe.setSize(st.z,st.w);const it=v.getRenderTarget();v.setRenderTarget(qe),v.getClearColor(R),E=v.getClearAlpha(),E<1&&v.setClearColor(16777215,.5),v.clear(),J&&we.render(ke);const lt=v.toneMapping;v.toneMapping=xh;const ht=Ee.viewport;if(Ee.viewport!==void 0&&(Ee.viewport=void 0),y.setupLightsView(Ee),H===!0&&je.setGlobalState(v.clippingPlanes,Ee),hn(Z,ke,Ee),Pe.updateMultisampleRenderTarget(qe),Pe.updateRenderTargetMipmap(qe),ce.has("WEBGL_multisampled_render_to_texture")===!1){let At=!1;for(let pt=0,xn=Se.length;pt<xn;pt++){const Fn=Se[pt],qr=Fn.object,$s=Fn.geometry,Un=Fn.material,Ot=Fn.group;if(Un.side===Yu&&qr.layers.test(Ee.layers)){const Fi=Un.side;Un.side=Va,Un.needsUpdate=!0,sn(qr,ke,Ee,$s,Un,Ot),Un.side=Fi,Un.needsUpdate=!0,At=!0}}At===!0&&(Pe.updateMultisampleRenderTarget(qe),Pe.updateRenderTargetMipmap(qe))}v.setRenderTarget(it),v.setClearColor(R,E),ht!==void 0&&(Ee.viewport=ht),v.toneMapping=lt}function hn(Z,Se,ke){const Ee=Se.isScene===!0?Se.overrideMaterial:null;for(let Ae=0,qe=Z.length;Ae<qe;Ae++){const st=Z[Ae],it=st.object,lt=st.geometry,ht=Ee===null?st.material:Ee,At=st.group;it.layers.test(ke.layers)&&sn(it,Se,ke,lt,ht,At)}}function sn(Z,Se,ke,Ee,Ae,qe){Z.onBeforeRender(v,Se,ke,Ee,Ae,qe),Z.modelViewMatrix.multiplyMatrices(ke.matrixWorldInverse,Z.matrixWorld),Z.normalMatrix.getNormalMatrix(Z.modelViewMatrix),Ae.transparent===!0&&Ae.side===Yu&&Ae.forceSinglePass===!1?(Ae.side=Va,Ae.needsUpdate=!0,v.renderBufferDirect(ke,Se,Ee,Ae,Z,qe),Ae.side=$h,Ae.needsUpdate=!0,v.renderBufferDirect(ke,Se,Ee,Ae,Z,qe),Ae.side=Yu):v.renderBufferDirect(ke,Se,Ee,Ae,Z,qe),Z.onAfterRender(v,Se,ke,Ee,Ae,qe)}function Jn(Z,Se,ke){Se.isScene!==!0&&(Se=V);const Ee=Te.get(Z),Ae=y.state.lights,qe=y.state.shadowsArray,st=Ae.state.version,it=ye.getParameters(Z,Ae.state,qe,Se,ke),lt=ye.getProgramCacheKey(it);let ht=Ee.programs;Ee.environment=Z.isMeshStandardMaterial?Se.environment:null,Ee.fog=Se.fog,Ee.envMap=(Z.isMeshStandardMaterial?U:se).get(Z.envMap||Ee.environment),Ee.envMapRotation=Ee.environment!==null&&Z.envMap===null?Se.environmentRotation:Z.envMapRotation,ht===void 0&&(Z.addEventListener("dispose",tt),ht=new Map,Ee.programs=ht);let At=ht.get(lt);if(At!==void 0){if(Ee.currentProgram===At&&Ee.lightsStateVersion===st)return ar(Z,it),At}else it.uniforms=ye.getUniforms(Z),Z.onBeforeCompile(it,v),At=ye.acquireProgram(it,lt),ht.set(lt,At),Ee.uniforms=it.uniforms;const pt=Ee.uniforms;return(!Z.isShaderMaterial&&!Z.isRawShaderMaterial||Z.clipping===!0)&&(pt.clippingPlanes=je.uniform),ar(Z,it),Ee.needsLights=en(Z),Ee.lightsStateVersion=st,Ee.needsLights&&(pt.ambientLightColor.value=Ae.state.ambient,pt.lightProbe.value=Ae.state.probe,pt.directionalLights.value=Ae.state.directional,pt.directionalLightShadows.value=Ae.state.directionalShadow,pt.spotLights.value=Ae.state.spot,pt.spotLightShadows.value=Ae.state.spotShadow,pt.rectAreaLights.value=Ae.state.rectArea,pt.ltc_1.value=Ae.state.rectAreaLTC1,pt.ltc_2.value=Ae.state.rectAreaLTC2,pt.pointLights.value=Ae.state.point,pt.pointLightShadows.value=Ae.state.pointShadow,pt.hemisphereLights.value=Ae.state.hemi,pt.directionalShadowMap.value=Ae.state.directionalShadowMap,pt.directionalShadowMatrix.value=Ae.state.directionalShadowMatrix,pt.spotShadowMap.value=Ae.state.spotShadowMap,pt.spotLightMatrix.value=Ae.state.spotLightMatrix,pt.spotLightMap.value=Ae.state.spotLightMap,pt.pointShadowMap.value=Ae.state.pointShadowMap,pt.pointShadowMatrix.value=Ae.state.pointShadowMatrix),Ee.currentProgram=At,Ee.uniformsList=null,At}function sr(Z){if(Z.uniformsList===null){const Se=Z.currentProgram.getUniforms();Z.uniformsList=rk.seqWithValue(Se.seq,Z.uniforms)}return Z.uniformsList}function ar(Z,Se){const ke=Te.get(Z);ke.outputColorSpace=Se.outputColorSpace,ke.batching=Se.batching,ke.batchingColor=Se.batchingColor,ke.instancing=Se.instancing,ke.instancingColor=Se.instancingColor,ke.instancingMorph=Se.instancingMorph,ke.skinning=Se.skinning,ke.morphTargets=Se.morphTargets,ke.morphNormals=Se.morphNormals,ke.morphColors=Se.morphColors,ke.morphTargetsCount=Se.morphTargetsCount,ke.numClippingPlanes=Se.numClippingPlanes,ke.numIntersection=Se.numClipIntersection,ke.vertexAlphas=Se.vertexAlphas,ke.vertexTangents=Se.vertexTangents,ke.toneMapping=Se.toneMapping}function as(Z,Se,ke,Ee,Ae){Se.isScene!==!0&&(Se=V),Pe.resetTextureUnits();const qe=Se.fog,st=Ee.isMeshStandardMaterial?Se.environment:null,it=j===null?v.outputColorSpace:j.isXRRenderTarget===!0?j.texture.colorSpace:rp,lt=(Ee.isMeshStandardMaterial?U:se).get(Ee.envMap||st),ht=Ee.vertexColors===!0&&!!ke.attributes.color&&ke.attributes.color.itemSize===4,At=!!ke.attributes.tangent&&(!!Ee.normalMap||Ee.anisotropy>0),pt=!!ke.morphAttributes.position,xn=!!ke.morphAttributes.normal,Fn=!!ke.morphAttributes.color;let qr=xh;Ee.toneMapped&&(j===null||j.isXRRenderTarget===!0)&&(qr=v.toneMapping);const $s=ke.morphAttributes.position||ke.morphAttributes.normal||ke.morphAttributes.color,Un=$s!==void 0?$s.length:0,Ot=Te.get(Ee),Fi=y.state.lights;if(H===!0&&(W===!0||Z!==C)){const Ea=Z===C&&Ee.id===A;je.setState(Ee,Z,Ea)}let zn=!1;
vendor: 5,323 bytes, line 4710
4710Ee.version===Ot.__version?(Ot.needsLights&&Ot.lightsStateVersion!==Fi.state.version||Ot.outputColorSpace!==it||Ae.isBatchedMesh&&Ot.batching===!1||!Ae.isBatchedMesh&&Ot.batching===!0||Ae.isBatchedMesh&&Ot.batchingColor===!0&&Ae.colorTexture===null||Ae.isBatchedMesh&&Ot.batchingColor===!1&&Ae.colorTexture!==null||Ae.isInstancedMesh&&Ot.instancing===!1||!Ae.isInstancedMesh&&Ot.instancing===!0||Ae.isSkinnedMesh&&Ot.skinning===!1||!Ae.isSkinnedMesh&&Ot.skinning===!0||Ae.isInstancedMesh&&Ot.instancingColor===!0&&Ae.instanceColor===null||Ae.isInstancedMesh&&Ot.instancingColor===!1&&Ae.instanceColor!==null||Ae.isInstancedMesh&&Ot.instancingMorph===!0&&Ae.morphTexture===null||Ae.isInstancedMesh&&Ot.instancingMorph===!1&&Ae.morphTexture!==null||Ot.envMap!==lt||Ee.fog===!0&&Ot.fog!==qe||Ot.numClippingPlanes!==void 0&&(Ot.numClippingPlanes!==je.numPlanes||Ot.numIntersection!==je.numIntersection)||Ot.vertexAlphas!==ht||Ot.vertexTangents!==At||Ot.morphTargets!==pt||Ot.morphNormals!==xn||Ot.morphColors!==Fn||Ot.toneMapping!==qr||Ot.morphTargetsCount!==Un)&&(zn=!0):(zn=!0,Ot.__version=Ee.version);let Za=Ot.currentProgram;zn===!0&&(Za=Jn(Ee,Se,Ae));let Yd=!1,ta=!1,eb=!1;const Dr=Za.getUniforms(),Nc=Ot.uniforms;if(X.useProgram(Za.program)&&(Yd=!0,ta=!0,eb=!0),Ee.id!==A&&(A=Ee.id,ta=!0),Yd||C!==Z){Dr.setValue($,"projectionMatrix",Z.projectionMatrix),Dr.setValue($,"viewMatrix",Z.matrixWorldInverse);const Ea=Dr.map.cameraPosition;Ea!==void 0&&Ea.setValue($,K.setFromMatrixPosition(Z.matrixWorld)),ve.logarithmicDepthBuffer&&Dr.setValue($,"logDepthBufFC",2/(Math.log(Z.far+1)/Math.LN2)),(Ee.isMeshPhongMaterial||Ee.isMeshToonMaterial||Ee.isMeshLambertMaterial||Ee.isMeshBasicMaterial||Ee.isMeshStandardMaterial||Ee.isShaderMaterial)&&Dr.setValue($,"isOrthographic",Z.isOrthographicCamera===!0),C!==Z&&(C=Z,ta=!0,eb=!0)}if(Ae.isSkinnedMesh){Dr.setOptional($,Ae,"bindMatrix"),Dr.setOptional($,Ae,"bindMatrixInverse");const Ea=Ae.skeleton;Ea&&(Ea.boneTexture===null&&Ea.computeBoneTexture(),Dr.setValue($,"boneTexture",Ea.boneTexture,Pe))}Ae.isBatchedMesh&&(Dr.setOptional($,Ae,"batchingTexture"),Dr.setValue($,"batchingTexture",Ae._matricesTexture,Pe),Dr.setOptional($,Ae,"batchingIdTexture"),Dr.setValue($,"batchingIdTexture",Ae._indirectTexture,Pe),Dr.setOptional($,Ae,"batchingColorTexture"),Ae._colorsTexture!==null&&Dr.setValue($,"batchingColorTexture",Ae._colorsTexture,Pe));const Wg=ke.morphAttributes;if((Wg.position!==void 0||Wg.normal!==void 0||Wg.color!==void 0)&&Ie.update(Ae,ke,Za),(ta||Ot.receiveShadow!==Ae.receiveShadow)&&(Ot.receiveShadow=Ae.receiveShadow,Dr.setValue($,"receiveShadow",Ae.receiveShadow)),Ee.isMeshGouraudMaterial&&Ee.envMap!==null&&(Nc.envMap.value=lt,Nc.flipEnvMap.value=lt.isCubeTexture&&lt.isRenderTargetTexture===!1?-1:1),Ee.isMeshStandardMaterial&&Ee.envMap===null&&Se.environment!==null&&(Nc.envMapIntensity.value=Se.environmentIntensity),ta&&(Dr.setValue($,"toneMappingExposure",v.toneMappingExposure),Ot.needsLights&&Cs(Nc,eb),qe&&Ee.fog===!0&&re.refreshFogUniforms(Nc,qe),re.refreshMaterialUniforms(Nc,Ee,L,O,y.state.transmissionRenderTarget[Z.id]),rk.upload($,sr(Ot),Nc,Pe)),Ee.isShaderMaterial&&Ee.uniformsNeedUpdate===!0&&(rk.upload($,sr(Ot),Nc,Pe),Ee.uniformsNeedUpdate=!1),Ee.isSpriteMaterial&&Dr.setValue($,"center",Ae.center),Dr.setValue($,"modelViewMatrix",Ae.modelViewMatrix),Dr.setValue($,"normalMatrix",Ae.normalMatrix),Dr.setValue($,"modelMatrix",Ae.matrixWorld),Ee.isShaderMaterial||Ee.isRawShaderMaterial){const Ea=Ee.uniformsGroups;for(let tb=0,nb=Ea.length;tb<nb;tb++){const SN=Ea[tb];Ve.update(SN,Za),Ve.bind(SN,Za)}}return Za}function Cs(Z,Se){Z.ambientLightColor.needsUpdate=Se,Z.lightProbe.needsUpdate=Se,Z.directionalLights.needsUpdate=Se,Z.directionalLightShadows.needsUpdate=Se,Z.pointLights.needsUpdate=Se,Z.pointLightShadows.needsUpdate=Se,Z.spotLights.needsUpdate=Se,Z.spotLightShadows.needsUpdate=Se,Z.rectAreaLights.needsUpdate=Se,Z.hemisphereLights.needsUpdate=Se}function en(Z){return Z.isMeshLambertMaterial||Z.isMeshToonMaterial||Z.isMeshPhongMaterial||Z.isMeshStandardMaterial||Z.isShadowMaterial||Z.isShaderMaterial&&Z.lights===!0}this.getActiveCubeFace=function(){return S},this.getActiveMipmapLevel=function(){return _},this.getRenderTarget=function(){return j},this.setRenderTargetTextures=function(Z,Se,ke){Te.get(Z.texture).__webglTexture=Se,Te.get(Z.depthTexture).__webglTexture=ke;const Ee=Te.get(Z);Ee.__hasExternalTextures=!0,Ee.__autoAllocateDepthBuffer=ke===void 0,Ee.__autoAllocateDepthBuffer||ce.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),Ee.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(Z,Se){const ke=Te.get(Z);ke.__webglFramebuffer=Se,ke.__useDefaultFramebuffer=Se===void 0},this.setRenderTarget=function(Z,Se=0,ke=0){j=Z,S=Se,_=ke;let Ee=!0,Ae=null,qe=!1,st=!1;if(Z){const lt=Te.get(Z);lt.__useDefaultFramebuffer!==void 0?(X.bindFramebuffer($.FRAMEBUFFER,null),Ee=!1):lt.__webglFramebuffer===void 0?Pe.setupRenderTarget(Z):lt.__hasExternalTextures&&Pe.rebindTextures(Z,Te.get(Z.texture).__webglTexture,Te.get(Z.depthTexture).__webglTexture);const ht=Z.texture;(ht.isData3DTexture||ht.isDataArrayTexture||ht.isCompressedArrayTexture)&&(st=!0);const At=Te.get(Z).__webglFramebuffer;
4710Z.isWebGLCubeRenderTarget?(Array.isArray(At[Se])?Ae=At[Se][ke]:Ae=At[Se],qe=!0):Z.samples>0&&Pe.useMultisampledRTT(Z)===!1?Ae=Te.get(Z).__webglMultisampledFramebuffer:Array.isArray(At)?Ae=At[ke]:Ae=At,k.copy(Z.viewport),M.copy(Z.scissor),I=Z.scissorTest}else k.copy(F).multiplyScalar(L).floor(),M.copy(q).multiplyScalar(L).floor(),I=B;if(X.bindFramebuffer($.FRAMEBUFFER,Ae)&&Ee&&X.drawBuffers(Z,Ae),X.viewport(k),X.scissor(M),X.setScissorTest(I),qe){const lt=Te.get(Z.texture);$.framebufferTexture2D($.FRAMEBUFFER,$.COLOR_ATTACHMENT0,$.TEXTURE_CUBE_MAP_POSITIVE_X+Se,lt.__webglTexture,ke)}else if(st){const lt=Te.get(Z.texture),ht=Se||0;$.framebufferTextureLayer($.FRAMEBUFFER,$.COLOR_ATTACHMENT0,lt.__webglTexture,ke||0,ht)}A=-1},this.readRenderTargetPixels=function(Z,Se,ke,Ee,Ae,qe,st){if(!(Z&&Z.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let it=Te.get(Z).__webglFramebuffer;if(Z.isWebGLCubeRenderTarget&&st!==void 0&&(it=it[st]),it){X.bindFramebuffer($.FRAMEBUFFER,it);try{const lt=Z.texture,ht=lt.format,At=lt.type;if(!ve.textureFormatReadable(ht)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!ve.textureTypeReadable(At)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Se>=0&&Se<=Z.width-Ee&&ke>=0&&ke<=Z.height-Ae&&$.readPixels(Se,ke,Ee,Ae,ie.convert(ht),ie.convert(At),qe)}finally{const lt=j!==null?Te.get(j).__webglFramebuffer:null;X.bindFramebuffer($.FRAMEBUFFER,lt)}}},this.readRenderTargetPixelsAsync=async function(Z,Se,ke,Ee,Ae,qe,st){if(!(Z&&Z.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let it=Te.get(Z).__webglFramebuffer;if(Z.isWebGLCubeRenderTarget&&st!==void 0&&(it=it[st]),it){X.bindFramebuffer($.FRAMEBUFFER,it);try{const lt=Z.texture,ht=lt.format,At=lt.type;if(!ve.textureFormatReadable(ht))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!ve.textureTypeReadable(At))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(Se>=0&&Se<=Z.width-Ee&&ke>=0&&ke<=Z.height-Ae){const pt=$.createBuffer();$.bindBuffer($.PIXEL_PACK_BUFFER,pt),$.bufferData($.PIXEL_PACK_BUFFER,qe.byteLength,$.STREAM_READ),$.readPixels(Se,ke,Ee,Ae,ie.convert(ht),ie.convert(At),0),$.flush();const xn=$.fenceSync($.SYNC_GPU_COMMANDS_COMPLETE,0);await Bmt($,xn,4);try{$.bindBuffer($.PIXEL_PACK_BUFFER,pt),$.getBufferSubData($.PIXEL_PACK_BUFFER,0,qe)}finally{$.deleteBuffer(pt),$.deleteSync(xn)}return qe}}finally{const lt=j!==null?Te.get(j).__webglFramebuffer:null;X.bindFramebuffer($.FRAMEBUFFER,lt)}}},this.copyFramebufferToTexture=function(Z,Se=null,ke=0){Z.isTexture!==!0&&(qw("WebGLRenderer: copyFramebufferToTexture function signature has changed."),Se=arguments[0]||null,Z=arguments[1]);const Ee=Math.pow(2,-ke),Ae=Math.floor(Z.image.width*Ee),qe=Math.floor(Z.image.height*Ee),st=Se!==null?Se.x:0,it=Se!==null?Se.y:0;Pe.setTexture2D(Z,0),$.copyTexSubImage2D($.TEXTURE_2D,ke,0,0,st,it,Ae,qe),X.unbindTexture()},this.copyTextureToTexture=function(Z,Se,ke=null,Ee=null,Ae=0){Z.isTexture!==!0&&(qw("WebGLRenderer: copyTextureToTexture function signature has changed."),Ee=arguments[0]||null,Z=arguments[1],Se=arguments[2],Ae=arguments[3]||0,ke=null);let qe,st,it,lt,ht,At;ke!==null?(qe=ke.max.x-ke.min.x,st=ke.max.y-ke.min.y,it=ke.min.x,lt=ke.min.y):(qe=Z.image.width,st=Z.image.height,it=0,lt=0),Ee!==null?(ht=Ee.x,At=Ee.y):(ht=0,At=0);const pt=ie.convert(Se.format),xn=ie.convert(Se.type);Pe.setTexture2D(Se,0),$.pixelStorei($.UNPACK_FLIP_Y_WEBGL,Se.flipY),$.pixelStorei($.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Se.premultiplyAlpha),$.pixelStorei($.UNPACK_ALIGNMENT,Se.unpackAlignment);const Fn=$.getParameter($.UNPACK_ROW_LENGTH),qr=$.getParameter($.UNPACK_IMAGE_HEIGHT),$s=$.getParameter($.UNPACK_SKIP_PIXELS),Un=$.getParameter($.UNPACK_SKIP_ROWS),Ot=$.getParameter($.UNPACK_SKIP_IMAGES),Fi=Z.isCompressedTexture?Z.mipmaps[Ae]:Z.image;$.pixelStorei($.UNPACK_ROW_LENGTH,Fi.width),$.pixelStorei($.UNPACK_IMAGE_HEIGHT,Fi.height),$.pixelStorei($.UNPACK_SKIP_PIXELS,it),$.pixelStorei($.UNPACK_SKIP_ROWS,lt),Z.isDataTexture?$.texSubImage2D($.TEXTURE_2D,Ae,ht,At,qe,st,pt,xn,Fi.data):Z.isCompressedTexture?$.compressedTexSubImage2D($.TEXTURE_2D,Ae,ht,At,Fi.width,Fi.height,pt,Fi.data):$.texSubImage2D($.TEXTURE_2D,Ae,ht,At,qe,st,pt,xn,Fi),$.pixelStorei($.UNPACK_ROW_LENGTH,Fn),$.pixelStorei($.UNPACK_IMAGE_HEIGHT,qr),$.pixelStorei($.UNPACK_SKIP_PIXELS,$s),$.pixelStorei($.UNPACK_SKIP_ROWS,Un),$.pixelStorei($.UNPACK_SKIP_IMAGES,Ot),Ae===0&&Se.generateMipmaps&&$.generateMipmap($.TEXTURE_2D),X.unbindTexture()},this.copyTextureToTexture3D=function(Z,Se,ke=null,Ee=null,Ae=0){Z.isTexture!==!0&&(qw("WebGLRenderer: copyTextureToTexture3D function signature has changed."),ke=arguments[0]||null,Ee=arguments[1]||null,Z=arguments[2],Se=arguments[3],Ae=arguments[4]||0);let qe,st,it,lt,ht,At,pt,xn,Fn;const qr=Z.isCompressedTexture?Z.mipmaps[Ae]:Z.image;ke!==null?(qe=ke.max.x-ke.min.x,st=ke.max.y-ke.min.y,it=ke.max.z-ke.min.z,lt=ke.min.x,ht=ke.min.y,At=ke.min.z):(qe=qr.width,st=qr.height,it=qr.depth,lt=0,ht=0,At=0),Ee!==null?(pt=Ee.x,xn=Ee.y,Fn=Ee.z):(pt=0,xn=0,Fn=0);const $s=ie.convert(Se.format),Un=ie.convert(Se.type);let Ot;if(Se.isData3DTexture)Pe.setTexture3D(Se,0),Ot=$.TEXTURE_3D;else if(Se.isDataArrayTexture||Se.isCompressedArrayTexture)Pe.setTexture2DArray(Se,0),Ot=$.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}$.pixelStorei($.UNPACK_FLIP_Y_WEBGL,Se.flipY),$.pixelStorei($.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Se.premultiplyAlpha),$.pixelStorei($.UNPACK_ALIGNMENT,Se.unpackAlignment);const Fi=$.getParameter($.UNPACK_ROW_LENGTH),zn=$.getParameter($.UNPACK_IMAGE_HEIGHT),Za=$.getParameter($.UNPACK_SKIP_PIXELS),Yd=$.getParameter($.UNPACK_SKIP_ROWS),ta=$.getParameter($.UNPACK_SKIP_IMAGES);$.pixelStorei($.UNPACK_ROW_LENGTH,qr.width),$.pixelStorei($.UNPACK_IMAGE_HEIGHT,qr.height),$.pixelStorei($.UNPACK_SKIP_PIXELS,lt),$.pixelStorei($.UNPACK_SKIP_ROWS,ht),$.pixelStorei($.UNPACK_SKIP_IMAGES,At),Z.isDataTexture||Z.isData3DTexture?$.texSubImage3D(Ot,Ae,pt,xn,Fn,qe,st,it,$s,Un,qr.data):Se.isCompressedArrayTexture?$.compressedTexSubImage3D(Ot,Ae,pt,xn,Fn,qe,st,it,$s,qr.data):$.texSubImage3D(Ot,Ae,pt,xn,Fn,qe,st,it,$s,Un,qr),$.pixelStorei($.UNPACK_ROW_LENGTH,Fi),$.pixelStorei($.UNPACK_IMAGE_HEIGHT,zn),$.pixelStorei($.UNPACK_SKIP_PIXELS,Za),$.pixelStorei($.UNPACK_SKIP_ROWS,Yd),$.pixelStorei($.UNPACK_SKIP_IMAGES,ta),Ae===0&&Se.generateMipmaps&&$.generateMipmap(Ot),X.unbindTexture()},this.initRenderTarget=function(Z){Te.get(Z).__webglFramebuffer===void 0&&Pe.setupRenderTarget(Z)},this.initTexture=function(Z){Z.isCubeTexture?Pe.setTextureCube(Z,0):Z.isData3DTexture?Pe.setTexture3D(Z,0):Z.isDataArrayTexture||Z.isCompressedArrayTexture?Pe.setTexture2DArray(Z,0):Pe.setTexture2D(Z,0),X.unbindTexture()},this.resetState=function(){S=0,_=0,j=null,X.reset(),De.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return id}get outputColorSpace(){return this._outputColorSpace}
vendor: 5,152 bytes, lines 4710-4816
4710set outputColorSpace(e){this._outputColorSpace=e;const n=this.getContext();n.drawingBufferColorSpace=e===ZB?"display-p3":"srgb",n.unpackColorSpace=Xn.workingColorSpace===JM?"display-p3":"srgb"}}class Z0t extends Co{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Md,this.environmentIntensity=1,this.environmentRotation=new Md,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,n){return super.copy(e,n),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const n=super.toJSON(e);return this.fog!==null&&(n.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(n.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(n.object.backgroundIntensity=this.backgroundIntensity),n.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(n.object.environmentIntensity=this.environmentIntensity),n.object.environmentRotation=this.environmentRotation.toArray(),n}}class ebt{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=qX(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const n=qX();e=(n-this.oldTime)/1e3,this.oldTime=n,this.elapsedTime+=e}return e}}function qX(){return(typeof performance>"u"?Date:performance).now()}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:GB}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=GB);const tbt=`
4711precision highp float;
4712
4713void main() {
4714  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
4715}
4716`,nbt=`
4717precision highp float;
4718
4719uniform float iTime;
4720uniform vec3  iResolution;
4721uniform float animationSpeed;
4722
4723uniform bool enableTop;
4724uniform bool enableMiddle;
4725uniform bool enableBottom;
4726
4727uniform int topLineCount;
4728uniform int middleLineCount;
4729uniform int bottomLineCount;
4730
4731uniform float topLineDistance;
4732uniform float middleLineDistance;
4733uniform float bottomLineDistance;
4734
4735uniform vec3 topWavePosition;
4736uniform vec3 middleWavePosition;
4737uniform vec3 bottomWavePosition;
4738
4739uniform vec2 iMouse;
4740uniform bool interactive;
4741uniform float bendRadius;
4742uniform float bendStrength;
4743uniform float bendInfluence;
4744
4745uniform bool parallax;
4746uniform float parallaxStrength;
4747uniform vec2 parallaxOffset;
4748
4749uniform vec3 lineGradient[8];
4750uniform int lineGradientCount;
4751
4752const vec3 BLACK = vec3(0.0);
4753const vec3 PINK  = vec3(233.0, 71.0, 245.0) / 255.0;
4754const vec3 BLUE  = vec3(47.0,  75.0, 162.0) / 255.0;
4755
4756mat2 rotate(float r) {
4757  return mat2(cos(r), sin(r), -sin(r), cos(r));
4758}
4759
4760vec3 background_color(vec2 uv) {
4761  vec3 col = vec3(0.0);
4762
4763  float y = sin(uv.x - 0.2) * 0.3 - 0.1;
4764  float m = uv.y - y;
4765
4766  col += mix(BLUE, BLACK, smoothstep(0.0, 1.0, abs(m)));
4767  col += mix(PINK, BLACK, smoothstep(0.0, 1.0, abs(m - 0.8)));
4768  return col * 0.5;
4769}
4770
4771vec3 getLineColor(float t, vec3 baseColor) {
4772  if (lineGradientCount <= 0) {
4773    return baseColor;
4774  }
4775
4776  vec3 gradientColor;
4777  
4778  if (lineGradientCount == 1) {
4779    gradientColor = lineGradient[0];
4780  } else {
4781    float clampedT = clamp(t, 0.0, 0.9999);
4782    float scaled = clampedT * float(lineGradientCount - 1);
4783    int idx = int(floor(scaled));
4784    float f = fract(scaled);
4785    int idx2 = min(idx + 1, lineGradientCount - 1);
4786
4787    vec3 c1 = lineGradient[idx];
4788    vec3 c2 = lineGradient[idx2];
4789    
4790    gradientColor = mix(c1, c2, f);
4791  }
4792  
4793  return gradientColor * 0.5;
4794}
4795
4796  float wave(vec2 uv, float offset, vec2 screenUv, vec2 mouseUv, bool shouldBend) {
4797  float time = iTime * animationSpeed;
4798
4799  float x_offset   = offset;
4800  float x_movement = time * 0.1;
4801  float amp        = sin(offset + time * 0.2) * 0.3;
4802  float y          = sin(uv.x + x_offset + x_movement) * amp;
4803
4804  if (shouldBend) {
4805    vec2 d = screenUv - mouseUv;
4806    float influence = exp(-dot(d, d) * bendRadius); // radial falloff around cursor
4807    float bendOffset = (mouseUv.y - screenUv.y) * influence * bendStrength * bendInfluence;
4808    y += bendOffset;
4809  }
4810
4811  float m = uv.y - y;
4812  return 0.0175 / max(abs(m) + 0.01, 1e-3) + 0.01;
4813}
4814
4815void mainImage(out vec4 fragColor, in vec2 fragCoord) {
4816  vec2 baseUv = (2.0 * fragCoord - iResolution.xy) / iResolution.y;
4817  baseUv.y *= -1.0;
4818  
4819  if (parallax) {
4820    baseUv += parallaxOffset;
4821  }
4822
4823  vec3 col = vec3(0.0);
4824
4825  vec3 b = lineGradientCount > 0 ? vec3(0.0) : background_color(baseUv);
4826
4827  vec2 mouseUv = vec2(0.0);
4828  if (interactive) {
4829    mouseUv = (2.0 * iMouse - iResolution.xy) / iResolution.y;
4830    mouseUv.y *= -1.0;
4831  }
4832  
4833  if (enableBottom) {
4834    for (int i = 0; i < bottomLineCount; ++i) {
4835      float fi = float(i);
4836      float t = fi / max(float(bottomLineCount - 1), 1.0);
4837      vec3 lineCol = getLineColor(t, b);
4838      
4839      float angle = bottomWavePosition.z * log(length(baseUv) + 1.0);
4840      vec2 ruv = baseUv * rotate(angle);
4841      col += lineCol * wave(
4842        ruv + vec2(bottomLineDistance * fi + bottomWavePosition.x, bottomWavePosition.y),
4843        1.5 + 0.2 * fi,
4844        baseUv,
4845        mouseUv,
4846        interactive
4847      ) * 0.2;
4848    }
4849  }
4850
4851  if (enableMiddle) {
4852    for (int i = 0; i < middleLineCount; ++i) {
4853      float fi = float(i);
4854      float t = fi / max(float(middleLineCount - 1), 1.0);
4855      vec3 lineCol = getLineColor(t, b);
4856      
4857      float angle = middleWavePosition.z * log(length(baseUv) + 1.0);
4858      vec2 ruv = baseUv * rotate(angle);
4859      col += lineCol * wave(
4860        ruv + vec2(middleLineDistance * fi + middleWavePosition.x, middleWavePosition.y),
4861        2.0 + 0.15 * fi,
4862        baseUv,
4863        mouseUv,
4864        interactive
4865      );
4866    }
4867  }
4868
4869  if (enableTop) {
4870    for (int i = 0; i < topLineCount; ++i) {
4871      float fi = float(i);
4872      float t = fi / max(float(topLineCount - 1), 1.0);
4873      vec3 lineCol = getLineColor(t, b);
4874      
4875      float angle = topWavePosition.z * log(length(baseUv) + 1.0);
4876      vec2 ruv = baseUv * rotate(angle);
4877      ruv.x *= -1.0;
4878      col += lineCol * wave(
4879        ruv + vec2(topLineDistance * fi + topWavePosition.x, topWavePosition.y),
4880        1.0 + 0.2 * fi,
4881        baseUv,
4882        mouseUv,
4883        interactive
4884      ) * 0.1;
4885    }
4886  }
4887
4888  fragColor = vec4(col, 1.0);
4889}
4890
4891void main() {
4892  vec4 color = vec4(0.0);
4893  mainImage(color, gl_FragCoord.xy);
4894  gl_FragColor = color;
4895}
4896`,KX=8;function rbt(t){let e=t.trim();e.startsWith("#")&&(e=e.slice(1));let n=255,r=255,i=255;return e.length===3?(n=parseInt(e[0]+e[0],16),r=parseInt(e[1]+e[1],16),i=parseInt(e[2]+e[2],16)):e.length===6&&(n=parseInt(e.slice(0,2),16),r=parseInt(e.slice(2,4),16),i=parseInt(e.slice(4,6),16)),new Re(n/255,r/255,i/255)}function ibt({linesGradient:t,enabledWaves:e=["top","middle","bottom"],lineCount:n=[6],lineDistance:r=[5],topWavePosition:i,middleWavePosition:s,bottomWavePosition:a={x:2,y:-.7,rotate:-1},animationSpeed:l=1,interactive:c=!0,bendRadius:u=5,bendStrength:d=-.5,mouseDamping:f=.05,parallax:h=!0,parallaxStrength:p=.2,mixBlendMode:m="screen"}){const x=b.useRef(null),y=b.useRef(new Mn(-1e3,-1e3)),g=b.useRef(new Mn(-1e3,-1e3)),w=b.useRef(0),v=b.useRef(0),N=b.useRef(new Mn(0,0)),S=b.useRef(new Mn(0,0)),_=E=>{if(typeof n=="number")return n;if(!e.includes(E))return 0;const P=e.indexOf(E);return n[P]??6},j=E=>{if(typeof r=="number")return r;if(!e.includes(E))return .1;const P=e.indexOf(E);return r[P]??.1},A=e.includes("top")?_("top"):0,C=e.includes("middle")?_("middle"):0,k=e.includes("bottom")?_("bottom"):0,M=e.includes("top")?j("top")*.01:.01,I=e.includes("middle")?j("middle")*.01:.01,R=e.includes("bottom")?j("bottom")*.01:.01;return b.useEffect(()=>{if(!x.current)return;const E=x.current,P=new Z0t,O=new Vpe(-1,1,1,-1,0,1);O.position.z=1;const L=new J0t({antialias:!0,alpha:!1});L.setPixelRatio(Math.min(window.devicePixelRatio||1,2)),L.domElement.style.width="100%",L.domElement.style.height="100%",E.appendChild(L.domElement);const T={iTime:{value:0},iResolution:{value:new Re(1,1,1)},animationSpeed:{value:l},enableTop:{value:e.includes("top")},enableMiddle:{value:e.includes("middle")},enableBottom:{value:e.includes("bottom")},topLineCount:{value:A},middleLineCount:{value:C},bottomLineCount:{value:k},topLineDistance:{value:M},middleLineDistance:{value:I},bottomLineDistance:{value:R},topWavePosition:{value:new Re((i==null?void 0:i.x)??10,(i==null?void 0:i.y)??.5,(i==null?void 0:i.rotate)??-.4)},middleWavePosition:{value:new Re((s==null?void 0:s.x)??5,(s==null?void 0:s.y)??0,(s==null?void 0:s.rotate)??.2)},bottomWavePosition:{value:new Re((a==null?void 0:a.x)??2,(a==null?void 0:a.y)??-.7,(a==null?void 0:a.rotate)??.4)},iMouse:{value:new Mn(-1e3,-1e3)},interactive:{value:c},bendRadius:{value:u},bendStrength:{value:d},bendInfluence:{value:0},parallax:{value:h},parallaxStrength:{value:p},parallaxOffset:{value:new Mn(0,0)},lineGradient:{value:Array.from({length:KX},()=>new Re(1,1,1))},lineGradientCount:{value:0}};if(t&&t.length>0){const V=t.slice(0,KX);
4896T.lineGradientCount.value=V.length,V.forEach((J,Y)=>{const $=rbt(J);T.lineGradient.value[Y].set($.x,$.y,$.z)})}const D=new Pd({uniforms:T,vertexShader:tbt,fragmentShader:nbt}),F=new sN(2,2),q=new Hc(F,D);P.add(q);const B=new ebt,z=()=>{const V=E,J=V.clientWidth||1,Y=V.clientHeight||1;L.setSize(J,Y,!1);const $=L.domElement.width,fe=L.domElement.height;T.iResolution.value.set($,fe,1)};z();const H=typeof ResizeObserver<"u"?new ResizeObserver(z):null;H&&E&&H.observe(E);const W=V=>{const J=L.domElement.getBoundingClientRect(),Y=V.clientX-J.left,$=V.clientY-J.top,fe=L.getPixelRatio();if(y.current.set(Y*fe,(J.height-$)*fe),w.current=1,h){const ce=J.width/2,ve=J.height/2,X=(Y-ce)/J.width,de=-($-ve)/J.height;N.current.set(X*p,de*p)}},G=()=>{w.current=0};c&&(L.domElement.addEventListener("pointermove",W),L.domElement.addEventListener("pointerleave",G));let K=0;const ee=()=>{T.iTime.value=B.getElapsedTime(),c&&(g.current.lerp(y.current,f),T.iMouse.value.copy(g.current),v.current+=(w.current-v.current)*f,T.bendInfluence.value=v.current),h&&(S.current.lerp(N.current,f),T.parallaxOffset.value.copy(S.current)),L.render(P,O),K=requestAnimationFrame(ee)};return ee(),()=>{cancelAnimationFrame(K),H&&E&&H.disconnect(),c&&(L.domElement.removeEventListener("pointermove",W),L.domElement.removeEventListener("pointerleave",G)),F.dispose(),D.dispose(),L.dispose(),L.domElement.parentElement&&L.domElement.parentElement.removeChild(L.domElement)}},[t,e,n,r,i,s,a,l,c,u,d,f,h,p]),o.jsx("div",{ref:x,className:"floating-lines-container",style:{mixBlendMode:m}})}const qI={product:[{label:"Features",href:"/features"},{label:"Models",href:"/models"},{label:"Pricing",href:"/pricing"}],company:[{label:"About",href:"/about"}],legal:[{label:"Terms of Service",href:"/terms"},{label:"Privacy Policy",href:"/privacy"},{label:"Cookie Policy",href:"/cookies"},{label:"AI Disclaimer",href:"/ai-disclaimer"}]};function sbt(){const t=new Date().getFullYear();return o.jsxs("footer",{children:[o.jsx("div",{children:o.jsx("div",{className:"mx-auto max-w-6xl px-4",children:o.jsxs("div",{className:"relative bg-black rounded-xl text-center py-16 md:py-20 overflow-hidden",children:[o.jsx("div",{className:"absolute inset-0 opacity-25",children:o.jsx(ibt,{linesGradient:["#3c7c6f","#2f90c1","#47f592"],lineCount:8,lineDistance:30,animationSpeed:1.4,interactive:!0,bendRadius:30,bendStrength:1.6,mouseDamping:.16,parallax:!1,parallaxStrength:0})}),o.jsxs("div",{className:"relative z-10 pointer-events-none px-4 pb-10",children:[o.jsx("h2",{className:"text-2xl font-bold tracking-tight sm:text-3xl text-white",children:"Ready to track your AI visibility?"}),o.jsx("p",{className:"mt-3 text-white",children:"Start monitoring your brand across AI search engines today."})]}),o.jsx("div",{className:"inline-block relative z-10 width-fit mx-auto",children:o.jsx(le,{size:"lg",variant:"outline",asChild:!0,children:o.jsxs(Mt,{to:"/sign-up",children:["Get started now",o.jsx(Ai,{className:"h-5 w-5"})]})})})]})})}),o.jsxs("div",{className:"mx-auto max-w-6xl py-12 md:py-16",children:[o.jsxs("div",{className:"grid gap-8 md:grid-cols-2 lg:grid-cols-4",children:[o.jsxs("div",{className:"space-y-4 px-4",children:[o.jsxs(Mt,{to:"/",className:"flex items-center gap-2",children:[o.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg bg-accent",children:o.jsx("img",{src:"/images/logo/logo-icon-current-color.svg",alt:"Hjaelp.ai",className:"h-5 w-5"})}),o.jsx("img",{src:"/images/logo/logo-text.svg",alt:"Hjaelp.ai",className:"h-6"})]}),o.jsx("p",{className:"text-sm text-foreground max-w-xs",children:"Track your brand visibility across AI-powered search engines and stay ahead of the competition."}),o.jsxs("p",{className:"text-xs text-foreground",children:[o.jsx("strong",{className:"font-bold mb-1 block",children:"Hjaelp.ai ApS"}),"Rosenkrantzgade 28, 1 Th.,",o.jsx("br",{})," 8000 Aarhus C,",o.jsx("br",{})," Denmark."]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"CVR DK43930494"})]}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-sm font-semibold mb-4",children:"Product"}),o.jsx("ul",{className:"space-y-3",children:qI.product.map(e=>o.jsx("li",{children:o.jsx(Mt,{to:e.href,className:"text-sm text-muted-foreground hover:text-foreground transition-colors",children:e.label})},e.href))})]}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-sm font-semibold mb-4",children:"Company"}),o.jsx("ul",{className:"space-y-3",children:qI.company.map(e=>o.jsx("li",{children:o.jsx(Mt,{to:e.href,className:"text-sm text-muted-foreground hover:text-foreground transition-colors",children:e.label})},e.href))})]}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-sm font-semibold mb-4",children:"Legal"}),o.jsx("ul",{className:"space-y-3",children:qI.legal.map(e=>o.jsx("li",{children:o.jsx(Mt,{to:e.href,className:"text-sm text-muted-foreground hover:text-foreground transition-colors",children:e.label})},e.href))})]})]}),o.jsx("div",{className:"mt-12 pt-8 border-t",children:o.jsxs("p",{className:"text-sm text-muted-foreground text-center",children:["© ",t," Hjaelp.ai. All rights reserved."]})})]})]})}function abt(){const{pathname:t}=Ya();return b.useEffect(()=>{window.scrollTo({top:0,behavior:"smooth"})},[t]),o.jsxs("div",{className:"flex min-h-screen flex-col",children:[o.jsx(vhe,{}),o.jsx("main",{className:"flex-1",children:o.jsx(fT,{})}),o.jsx(sbt,{})]})}const KI="Hjaelp.ai",obt="Monitor and improve your brand visibility across AI-powered search engines like ChatGPT, Claude, and Gemini.",Ype="https://hjaelp.ai",lbt=`${Ype}/og-image.png`;function ot({title:t,description:e,image:n,noIndex:r}){const{pathname:i}=Ya(),s=t?`${t} | ${KI}`:KI,a=e||obt,l=`${Ype}${i}`,c=n||lbt;return b.useEffect(()=>{document.title=s;const u=(f,h,p=!1)=>{const m=p?"property":"name";let x=document.querySelector(`meta[${m}="${f}"]`);x||(x=document.createElement("meta"),x.setAttribute(m,f),document.head.appendChild(x)),x.setAttribute("content",h)};u("description",a),u("og:title",s,!0),u("og:description",a,!0),u("og:url",l,!0),u("og:image",c,!0),u("og:type","website",!0),u("og:site_name",KI,!0),u("twitter:card","summary_large_image"),u("twitter:title",s),u("twitter:description",a),u("twitter:image",c);let d=document.querySelector('link[rel="canonical"]');if(d||(d=document.createElement("link"),d.rel="canonical",document.head.appendChild(d)),d.href=l,r)u("robots","noindex, nofollow");else{const f=document.querySelector('meta[name="robots"]');f&&f.remove()}},[s,a,l,c,r]),null}const Dt=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:ne("rounded-xl border border-border bg-card text-card-foreground shadow-sm",t),...e}));
4896Dt.displayName="Card";const Zt=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:ne("flex flex-col space-y-1.5 p-6",t),...e}));Zt.displayName="CardHeader";const tn=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:ne("text-lg font-semibold leading-none tracking-tight",t),...e}));tn.displayName="CardTitle";const Kn=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:ne("text-sm text-muted-foreground",t),...e}));Kn.displayName="CardDescription";const Vt=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:ne("p-6 pt-0",t),...e}));Vt.displayName="CardContent";const qv=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:ne("flex items-center p-6 pt-0",t),...e}));qv.displayName="CardFooter";const cbt={xs:{outer:"h-6 w-6",inner:"h-4 w-4",text:"text-[9px]",icon:"h-3 w-3",infoIcon:"h-3 w-3",iconGap:"gap-1"},sm:{outer:"h-7 w-7",inner:"h-5 w-5",text:"text-[10px]",icon:"h-3.5 w-3.5",infoIcon:"h-3 w-3",iconGap:"gap-1"},md:{outer:"h-8 w-8",inner:"h-6 w-6",text:"text-xs",icon:"h-4 w-4",infoIcon:"h-3.5 w-3.5",iconGap:"gap-1.5"},lg:{outer:"h-10 w-10",inner:"h-8 w-8",text:"text-sm",icon:"h-4.5 w-4.5",infoIcon:"h-4 w-4",iconGap:"gap-2"},xl:{outer:"h-14 w-14",inner:"h-10 w-10",text:"",icon:"h-5 w-5",infoIcon:"h-4 w-4",iconGap:"gap-2"},responsive:{outer:"h-6 w-6 md:h-8 md:w-8",inner:"h-4 w-4 md:h-6 md:w-6",text:"text-[10px] md:text-xs",icon:"h-3.5 w-3.5 md:h-4 md:w-4",infoIcon:"h-3 w-3 md:h-3.5 md:w-3.5",iconGap:"gap-1 md:gap-1.5"}};function ubt(t){let e=t%1===0?String(Math.round(t)):String(t);return e=t.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:1}),e}function nr({value:t,size:e="md",variant:n="percentage",displayText:r,max:i=100,tooltipTitle:s,className:a}){const l=cbt[e];let c,u;n==="rank"?(c=Math.max(0,100-(t-1)*10),u=JAe(t)):(c=t/i*100,u=ZAe(t));const d=n==="percentage"&&t>=i;let f;return d?f=o.jsx("div",{className:ne("inline-flex items-center justify-center rounded-full bg-primary",l.outer),children:o.jsx("div",{className:ne("flex items-center justify-center rounded-full bg-background",l.inner),children:o.jsx("div",{className:ne("border-4 bg-primary border-primary rounded-full transform scale-50",l.icon)})})}):f=o.jsx("div",{className:ne("inline-flex items-center justify-center rounded-full",l.outer),style:{background:`conic-gradient(${u} ${c}%, oklch(0.3 0 0 / 0.2) 0)`},children:o.jsx("div",{className:ne("flex items-center justify-center rounded-full bg-accent",l.inner,l.text),children:r??ubt(t)})}),s?o.jsx(on,{children:o.jsxs(Ft,{children:[o.jsx(Ut,{asChild:!0,children:o.jsxs("div",{className:ne("inline-flex items-center",l.iconGap,a),children:[f,o.jsx(xr,{className:ne(l.infoIcon,"text-muted-foreground shrink-0")})]})}),o.jsx(zt,{children:o.jsx("p",{children:s})})]})}):o.jsx("div",{className:ne("inline-flex items-center",a),children:f})}function C5(t){return t.startsWith("http://")||t.startsWith("https://")?t:`https://${t}`}function YX(t){try{return new URL(C5(t)).hostname.replace(/^www\./,"")}catch{return t}}function dbt(t){const{brandName:e,brandAliases:n=[],competitors:r,sources:i,hoveredCompetitor:s,focusedCompetitor:a,hoveredSource:l,focusedSource:c,onCompetitorClick:u,onSourceClick:d}=t,f=b.useMemo(()=>{const w=new Set,v=new Set;return i.forEach(N=>{const S=YX(N.url);S&&w.add(S.toLowerCase()),N.title&&v.add(N.title.toLowerCase())}),{domains:w,titles:v}},[i]),h=b.useMemo(()=>{const w=new Set;return e&&w.add(e.toLowerCase()),n.forEach(v=>w.add(v.toLowerCase())),r.forEach(v=>{w.add(v.name.toLowerCase()),v.originalName&&v.originalName!==v.name&&w.add(v.originalName.toLowerCase())}),w},[e,n,r]),p=b.useCallback(w=>{const v=w.toLowerCase();if(e&&v===e.toLowerCase()||n.some(S=>S.toLowerCase()===v))return e;const N=r.find(S=>S.name.toLowerCase()===v||S.originalName&&S.originalName.toLowerCase()===v);return(N==null?void 0:N.name)||w},[e,n,r]),m=b.useCallback(w=>{const v=w.toLowerCase().replace(/^www\./,"");return i.find(N=>{const S=N.url.toLowerCase(),_=YX(N.url).toLowerCase();return S===v||S.includes(v)||_===v||v.includes(_)})},[i]),x=b.useCallback(w=>{if(!w)return w;const v=/(?:https?:\/\/)?(?:www\.)?[\w.-]+\.[a-z]{2,}(?:\/[\w./?=#%-]*)?/gi,N=[];let S=0,_;const j=[];for(;(_=v.exec(w))!==null;)j.push({url:_[0],start:_.index,end:_.index+_[0].length});return j.length===0?N.push(w):(j.forEach(A=>{A.start>S&&N.push(w.slice(S,A.start)),N.push(A.url),S=A.end}),S<w.length&&N.push(w.slice(S))),N.map((A,C)=>{if(v.test(A)){v.lastIndex=0;const I=m(A);
4896if(I){const R=l===I.url,E=c===I.url,P=o.jsx("a",{href:C5(I.url),target:"_blank",rel:"noopener noreferrer","data-highlight-source":I.url,className:ne("px-1 rounded cursor-pointer transition-all duration-200 inline-flex items-center gap-1",E&&"bg-blue-500 text-white ring-2 ring-blue-500 ring-offset-1",R&&!E&&"bg-blue-500/30",!R&&!E&&"bg-blue-500/10 text-blue-600 hover:bg-blue-500/20"),onClick:O=>{O.preventDefault(),O.stopPropagation(),d==null||d(I.url)},children:A},C);return I.title||I.context?o.jsxs(Ft,{children:[o.jsx(Ut,{asChild:!0,children:P}),o.jsx(zt,{side:"top",className:"max-w-xs",children:o.jsx("p",{className:"text-xs line-clamp-3",children:I.context||I.title})})]},C):P}return o.jsx("a",{href:C5(A),target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline",children:A},C)}const k=/(\b[\w'-]+\b)/gi;return A.split(k).map((I,R)=>{const E=I.toLowerCase();if(f.titles.has(E)){const P=i.find(O=>{var L;return((L=O.title)==null?void 0:L.toLowerCase())===E});if(P){const O=l===P.url,L=c===P.url,T=o.jsx("span",{"data-highlight-source":P.url,className:ne("px-1 rounded cursor-pointer transition-all duration-200 inline-flex items-center gap-1",L&&"bg-blue-500 text-white ring-2 ring-blue-500 ring-offset-1",O&&!L&&"bg-blue-500/30",!O&&!L&&"bg-blue-500/10 text-blue-600 hover:bg-blue-500/20"),onClick:()=>d==null?void 0:d(P.url),children:I},`${C}-${R}`);return P.title||P.context?o.jsxs(Ft,{children:[o.jsx(Ut,{asChild:!0,children:T}),o.jsx(zt,{side:"top",className:"max-w-xs",children:o.jsx("p",{className:"text-xs line-clamp-3",children:P.context||P.title})})]},`${C}-${R}`):T}}if(h.has(E)){const P=p(I),O=e&&(E===e.toLowerCase()||n.some(z=>z.toLowerCase()===E)),L=r.find(z=>z.name.toLowerCase()===P.toLowerCase()),T=s===P,D=a===P,F=[];L&&(L.rankPosition&&F.push(`Rank #${L.rankPosition}`),L.sentimentLabel&&F.push(L.sentimentLabel),L.isRecommended&&F.push("Recommended")),O&&F.unshift("Your brand");const q=F.length>0?F.join(" • "):null,B=o.jsxs("span",{"data-highlight-competitor":P,className:ne("px-1 rounded cursor-pointer transition-all duration-200",D&&"bg-primary text-primary-foreground ring-2 ring-primary ring-offset-1",T&&!D&&"bg-primary/30",!T&&!D&&"bg-primary/10"),onClick:()=>u==null?void 0:u(P),children:[I,O&&o.jsx("span",{className:"ml-0.5 text-[10px] opacity-70",children:"★"})]},`${C}-${R}`);return q?o.jsxs(Ft,{children:[o.jsx(Ut,{asChild:!0,children:B}),o.jsx(zt,{side:"top",className:"max-w-xs",children:o.jsx("p",{className:"text-xs",children:q})})]},`${C}-${R}`):B}return o.jsx("span",{children:I},`${C}-${R}`)})})},[f,i,m,l,c,d,h,p,e,n,r,s,a,u]),y=b.useCallback(w=>typeof w=="string"?x(w):Array.isArray(w)?w.map((v,N)=>o.jsx("span",{children:y(v)},N)):w,[x]),g=b.useCallback(({content:w})=>o.jsx(WT,{components:{p:({children:v})=>o.jsx("p",{className:"mb-4 last:mb-0",children:y(v)}),li:({children:v})=>o.jsx("li",{className:"mb-1",children:y(v)}),strong:({children:v})=>o.jsx("strong",{className:"font-semibold",children:y(v)}),em:({children:v})=>o.jsx("em",{className:"italic",children:y(v)})},children:w}),[y]);return{highlightText:x,highlightChildren:y,HighlightedMarkdown:g,getPrimaryName:p,findSource:m}}const fbt=[{name:"Gucci",website:"gucci.com"},{name:"Prada",website:"prada.com"},{name:"Louis Vuitton",website:"louisvuitton.com"},{name:"Chanel",website:"chanel.com"},{name:"Hermès",website:"hermes.com"},{name:"Burberry",website:"burberry.com"},{name:"Dior",website:"dior.com"},{name:"Versace",website:"versace.com"},{name:"Balenciaga",website:"balenciaga.com"},{name:"Fendi",website:"fendi.com"},{name:"Valentino",website:"valentino.com"},{name:"Givenchy",website:"givenchy.com"},{name:"Bottega Veneta",website:"bottegaveneta.com"},{name:"Celine",website:"celine.com"}],hbt=["What are the best luxury handbag brands in 2026?","Which designer brands offer the best quality leather goods?","Best luxury brands for sustainable fashion","Which luxury brand has the best resale value?","Best designer sneakers brands in 2026","Which luxury brand offers the best customer experience?"],pbt=`Here are the top luxury handbag brands in 2026, based on craftsmanship, heritage, and market value:
4897
4898**Top Luxury Handbag Brands:**
4899
49001. **Hermès** - The gold standard in luxury handbags. The Birkin and Kelly bags remain the most coveted pieces, with exceptional resale value and waitlists spanning years.
4901   https://www.hermes.com
4902
49032. **Chanel** - The Classic Flap and 2.55 bags continue to be timeless investment pieces. Chanel's consistent price increases have made their bags excellent stores of value.
4904   https://www.chanel.com
4905
49063. **Louis Vuitton** - Known for durability and iconic monogram canvas. The Neverfull, Speedy, and newer Capucines line offer various price points.
4907   https://www.louisvuitton.com
4908
49094. **Dior** - The Lady Dior and Saddle bags have seen renewed popularity. Excellent craftsmanship with strong brand recognition.
4910   https://www.dior.com
4911
49125. **Gucci** - Under creative direction, Gucci has modernized while maintaining heritage appeal. The Jackie and Dionysus bags are particularly sought after.
4913   https://www.gucci.com
4914
49156. **Bottega Veneta** - Famous for the intrecciato weave. The Pouch and Cassette bags have become modern classics.
4916   https://www.bottegaveneta.com
4917
49187. **Prada** - The Re-Edition bags and classic nylon pieces offer both heritage and modern appeal.
4919   https://www.prada.com
4920
49218. **Celine** - Under Hedi Slimane, the brand maintains minimalist elegance. The Triomphe and Belt bags are highly regarded.
4922   https://www.celine.com
4923
4924**Sources:** Vogue, Business of Fashion, WWD`,mbt=[{id:"chatgpt",name:"gpt",displayName:"ChatGPT",logoUrl:"/images/logos/openai.svg"},{id:"google",name:"google-ai-mode",displayName:"Google AI",logoUrl:"/images/logos/google.svg"},{id:"perplexity",name:"perplexity",displayName:"Perplexity",logoUrl:"/images/logos/perplexity.svg"}];function Hj(t,e){return Math.floor(Math.random()*(e-t+1))+t}function gbt(t){const e=["Hermès","Chanel","Louis Vuitton","Dior","Gucci","Bottega Veneta","Prada","Celine"],n=[{url:"https://www.vogue.com",title:"Vogue"},{url:"https://www.businessoffashion.com",title:"Business of Fashion"},{url:"https://wwd.com",title:"WWD"}];return mbt.map((r,i)=>{const s=e.some(c=>
4924c.toLowerCase()===t.toLowerCase())||Math.random()>.3,a=e.findIndex(c=>c.toLowerCase()===t.toLowerCase()),l=a!==-1?a+1:s?Hj(1,8):null;return{id:`mock-run-${r.id}-${i}`,llmProvider:{id:r.id,name:r.name,displayName:r.displayName,logoUrl:r.logoUrl},isMentioned:s,rankPosition:l,sentimentScore:Hj(50,85),rawResponse:pbt,competitorsMentioned:e.map((c,u)=>{const d=fbt.find(f=>f.name===c);return{name:c,rankPosition:u+1,sentimentScore:Hj(55,85),faviconUrl:d?`https://www.google.com/s2/favicons?domain=${d.website}&sz=64`:null,website:d?`https://${d.website}`:null}}),sources:n.map(c=>({url:c.url,title:c.title,context:"Fashion industry analysis"})),createdAt:new Date(Date.now()-Hj(1,30)*60*1e3).toISOString()}})}function Xpe(){const[t]=b.useState({id:"mock",name:"Gucci",brandName:"Gucci",website:"gucci.com",logoUrl:null}),[e]=b.useState(()=>gbt("Gucci")),[n]=b.useState(hbt[0]),[r,i]=b.useState(null),[s,a]=b.useState(null),[l,c]=b.useState(null),[u,d]=b.useState(null),[f,h]=b.useState(null),[p,m]=b.useState(!1),x=b.useRef(null),y=b.useRef(null),g=b.useRef(null);b.useEffect(()=>{e.length>0&&!r&&i(e[0])},[e,r]);const w=(t==null?void 0:t.brandName)||(t==null?void 0:t.name)||"Gucci",N=`https://www.google.com/s2/favicons?domain=${(t==null?void 0:t.website)||"gucci.com"}&sz=64`,S=b.useMemo(()=>r?{llmProvider:r.llmProvider,isMentioned:r.isMentioned,rankPosition:r.rankPosition,sentimentScore:r.sentimentScore,rawResponse:r.rawResponse,competitorsMentioned:r.competitorsMentioned,sources:r.sources,createdAt:r.createdAt}:null,[r]),_=b.useCallback((E,P)=>{if(!x.current)return;const O=E==="competitor"?`[data-highlight-competitor="${P}"]`:`[data-highlight-source="${P}"]`,L=x.current.querySelector(O);if(L){const T=x.current,D=L.getBoundingClientRect(),F=T.getBoundingClientRect(),q=T.scrollTop+(D.top-F.top)-F.height/2+D.height/2;T.scrollTo({top:q,behavior:"smooth"})}},[]),j=b.useCallback((E,P)=>{const O=E==="competitor"?y:g;if(!O.current)return;const L=E==="competitor"?`[data-sidebar-competitor="${P}"]`:`[data-sidebar-source="${P}"]`,T=O.current.querySelector(L);if(T){const D=O.current,F=T.getBoundingClientRect(),q=D.getBoundingClientRect(),B=D.scrollTop+(F.top-q.top)-q.height/2+F.height/2;D.scrollTo({top:B,behavior:"smooth"})}},[]),A=E=>{const P=u===E?null:E;d(P),h(null),P&&(p&&m(!1),setTimeout(()=>_("competitor",E),100))},C=E=>{const P=f===E?null:E;h(P),d(null),P&&(p&&m(!1),setTimeout(()=>_("source",E),100))},k=E=>{const P=u===E?null:E;d(P),h(null),P&&setTimeout(()=>j("competitor",E),50)},M=E=>{const P=f===E?null:E;h(P),d(null),P&&setTimeout(()=>j("source",E),50)},I=E=>{const P=new Date(E),L=new Date().getTime()-P.getTime(),T=Math.floor(L/(1e3*60));if(T<1)return"Just now";if(T<60)return`${T}m ago`;const D=Math.floor(T/60);return D<24?`${D}h ago`:`${Math.floor(D/24)}d ago`},{highlightText:R}=dbt({brandName:w,brandAliases:[],competitors:(S==null?void 0:S.competitorsMentioned.map(E=>({name:E.name,rankPosition:E.rankPosition,sentimentScore:E.sentimentScore,website:E.website,faviconUrl:E.faviconUrl})))||[],sources:(S==null?void 0:S.sources)||[],hoveredCompetitor:s,focusedCompetitor:u,hoveredSource:l,focusedSource:f,onCompetitorClick:k,onSourceClick:M});return S?o.jsx(on,{delayDuration:200,children:o.jsxs("div",{className:"bg-background flex h-[500px]",children:[o.jsxs("div",{className:ne("flex-1 flex flex-col min-w-0",p?"hidden md:flex md:border-r":"flex border-r md:border-r"),children:[o.jsx("div",{className:"border-b bg-background/95 px-4 shrink-0",children:o.jsxs("div",{className:"flex items-center h-[40px]",children:[o.jsxs("div",{className:"flex items-center gap-2 h-full",children:[o.jsx("h1",{className:"text-sm font-semibold hidden md:block",children:"Studio View"}),o.jsxs("div",{className:"md:hidden flex items-center gap-2",children:[o.jsx(Mo,{className:"h-4 w-4 text-primary"}),o.jsx("span",{className:"text-sm font-semibold",children:"Chat"})]})]}),o.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[S.llmProvider.logoUrl&&o.jsx(Hn,{src:S.llmProvider.logoUrl,alt:"",className:"h-5 w-5 rounded object-contain"}),o.jsxs("button",{onClick:()=>m(!0),className:"md:hidden flex items-center gap-1.5 px-2 py-1 rounded bg-muted hover:bg-muted/80 transition-colors text-xs font-medium",children:[o.jsx("span",{children:"Runs"}),o.jsx(kTe,{className:"h-3.5 w-3.5 text-muted-foreground"})]})]})]})}),o.jsx("div",{ref:x,className:ne("flex-1 overflow-y-auto transition-opacity duration-200",p?"hidden md:block":"block"),children:o.jsxs("div",{className:"max-w-2xl mx-auto py-4 px-4 space-y-4",children:[o.jsxs("div",{className:"flex gap-3",children:[o.jsx("div",{className:"shrink-0",children:o.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-muted border overflow-hidden",children:o.jsx("img",{src:N,alt:w,className:"h-5 w-5 object-contain"})})}),o.jsxs("div",{className:"flex-1 space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"font-medium text-sm",children:w}),o.jsx("span",{className:"text-[10px] text-muted-foreground",children:"You"})]}),o.jsx("div",{className:"rounded-xl rounded-tl-none bg-muted p-3",children:o.jsx("p",{className:"text-xs",children:n})})]})]}),o.jsxs("div",{className:"flex gap-3",children:[o.jsx("div",{className:"shrink-0",children:o.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-primary/10 border overflow-hidden",children:S.llmProvider.logoUrl?o.jsx(Hn,{src:S.llmProvider.logoUrl,alt:"",className:"h-5 w-5 object-contain"}):o.jsx(ga,{className:"h-4 w-4 text-primary"})})}),o.jsxs("div",{className:"flex-1 space-y-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"font-medium text-sm",children:S.llmProvider.displayName}),o.jsx("span",{className:"text-[10px] text-muted-foreground",children:"AI"}),S.isMentioned&&o.jsx(Ge,{variant:"default",className:"text-[9px] h-4",children:"Mentioned"}),S.rankPosition!==null&&o.jsxs(Ge,{variant:"outline",className:"text-[9px] h-4",children:["Rank #",S.rankPosition]})]}),o.jsx("div",{className:"rounded-xl rounded-tl-none bg-card border p-3",children:o.jsx("div",{className:"text-xs whitespace-pre-wrap leading-relaxed",children:R(S.rawResponse)})}),o.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground",children:[o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx(vT,{className:"h-3 w-3"}),I(S.createdAt)]}),o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx(uc,{className:"h-3 w-3"}),S.competitorsMentioned.length," competitors"]}),o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx(iu,{className:"h-3 w-3"}),S.sources.length," sources"]})]})]})]})]})})]}),o.jsxs("div",{className:ne("w-48 bg-muted/30 flex flex-col h-full shrink-0 transition-all duration-200",p?"flex w-full md:w-48":"hidden md:flex"),children:[o.jsx("div",{className:"md:hidden border-b bg-background/95 px-4 shrink-0",children:o.jsxs("div",{className:"flex items-center h-[40px]",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(H1,{className:"h-4 w-4 text-primary"}),o.jsx("span",{className:"text-sm font-semibold",children:"Runs & Details"})]}),o.jsx("div",{className:"ml-auto",children:o.jsxs("button",{onClick:()=>m(!1),className:"flex items-center gap-1.5 px-2 py-1 rounded bg-muted hover:bg-muted/80 transition-colors text-xs font-medium",children:[o.jsx("span",{children:"Chat"}),o.jsx(CTe,{className:"h-3.5 w-3.5 text-muted-foreground"})]})})]})}),o.jsxs("div",{className:"flex flex-col border-b overflow-hidden shrink-0",children:[o.jsxs("h3",{className:"h-[41px] shrink-0 font-medium px-3 py-0 flex items-center gap-2 border-b text-xs",children:[o.jsx(H1,{className:"h-3 w-3"}),"Runs",o.jsx(Ge,{variant:"outline",className:"text-[9px] h-4 ml-auto",children:e.length})]}),o.jsx("div",{className:"overflow-y-auto max-h-[120px]",children:o.jsx("div",{className:"space-y-0.5 p-1.5",children:e.map((E,P)=>{const O=(r==null?void 0:r.id)===E.id,L=P>0;return o.jsxs("button",{onClick:()=>!L&&i(E),disabled:L,className:ne("w-full flex items-center gap-1.5 rounded px-2 py-1.5 text-xs transition-all text-left",L&&"opacity-50 cursor-not-allowed",O?"bg-primary text-primary-foreground":!L&&"hover:bg-accent"),children:[o.jsx("div",{className:"h-5 w-5 shrink-0 rounded bg-background border overflow-hidden",children:E.llmProvider.logoUrl&&o.jsx(Hn,{src:E.llmProvider.logoUrl,alt:"",className:"h-full w-full object-contain p-0.5"})}),o.jsx("div",{className:"flex-1 min-w-0",children:o.jsx("p",{className:"truncate text-[11px] font-medium",children:E.llmProvider.displayName})}),L?o.jsx(Zk,{className:"h-3 w-3 text-muted-foreground"}):E.isMentioned&&o.jsx(Ge,{variant:O?"secondary":"default",className:"text-[8px] h-3.5 px-1",children:"✓"})]},E.id)})})})]}),o.jsxs("div",{className:"flex-1 flex flex-col border-b overflow-hidden",children:[o.jsxs("h3",{className:"h-[41px] shrink-0 font-medium px-3 py-0 flex items-center gap-2 border-b text-xs",children:[o.jsx(uc,{className:"h-3 w-3"}),"Competitors",o.jsx(Ge,{variant:"outline",className:"text-[9px] h-4 ml-auto",children:S.competitorsMentioned.length})]}),o.jsx("div",{ref:y,className:"flex-1 overflow-y-auto",children:o.jsx("div",{className:"space-y-0.5 p-1.5",children:S.competitorsMentioned.slice(0,8).map(E=>{const P=s===E.name,O=u===E.name;return o.jsxs("div",{"data-sidebar-competitor":E.name,onMouseEnter:()=>a(E.name),onMouseLeave:()=>a(null),onClick:()=>A(E.name),className:ne("flex items-center gap-1.5 rounded px-2 py-1.5 text-xs transition-all cursor-pointer",O&&"bg-primary text-primary-foreground ring-2 ring-primary ring-offset-1 ring-offset-background",P&&!O&&"bg-primary/20",!P&&!O&&"hover:bg-accent"),children:[o.jsx("div",{className:"h-5 w-5 shrink-0 rounded bg-muted border overflow-hidden",children:E.faviconUrl&&o.jsx("img",{src:E.faviconUrl,alt:"",className:"h-full w-full object-contain"})}),o.jsx("span",{className:"flex-1 truncate text-[11px]",children:E.name}),E.rankPosition&&o.jsxs(Ge,{variant:O?"secondary":"outline",className:"text-[9px] h-4 px-1",children:["#",E.rankPosition]})]},E.name)})})})]}),o.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[o.jsxs("h3",{className:"h-[41px] shrink-0 font-medium px-3 py-0 flex items-center gap-2 border-b text-xs",children:[o.jsx(iu,{className:"h-3 w-3"}),"Sources",o.jsx(Ge,{variant:"outline",className:"text-[9px] h-4 ml-auto",children:S.sources.length})]}),o.jsx("div",{ref:g,className:"flex-1 overflow-y-auto",children:o.jsx("div",{className:"space-y-0.5 p-1.5",children:S.sources.map((E,P)=>{let O="";try{O=new URL(E.url).hostname.replace("www.","")}catch{O=E.url}const L=l===E.url,T=f===E.url;return o.jsxs("div",{"data-sidebar-source":E.url,onMouseEnter:()=>c(E.url),onMouseLeave:()=>c(null),onClick:()=>C(E.url),className:ne("flex items-center gap-1.5 rounded px-2 py-1.5 text-xs transition-all cursor-pointer",T&&"bg-blue-500 text-white ring-2 ring-blue-500 ring-offset-1 ring-offset-background",L&&!T&&"bg-blue-500/20",!L&&!T&&"hover:bg-accent"),children:[o.jsx("div",{className:"h-5 w-5 shrink-0 rounded bg-muted border overflow-hidden",children:o.jsx("img",{src:`https://www.google.com/s2/favicons?domain=${O}
4924&sz=32`,alt:"",className:"h-full w-full object-contain"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:ne("truncate text-[11px] font-medium",T&&"text-white"),children:E.title}),o.jsx("p",{className:ne("truncate text-[9px]",T?"text-white/70":"text-muted-foreground"),children:O})]}),o.jsx("a",{href:E.url,target:"_blank",rel:"noopener noreferrer",onClick:D=>D.stopPropagation(),className:ne("p-1 rounded hover:bg-background/20 transition-colors shrink-0",T?"text-white":"text-muted-foreground"),children:o.jsx(Wr,{className:"h-3 w-3"})})]},P)})})})]})]})]})}):o.jsx("div",{className:"bg-background flex h-[500px] items-center justify-center",children:o.jsx("p",{className:"text-muted-foreground",children:"No data available"})})}const xbt=[{id:"chatgpt",name:"gpt",displayName:"ChatGPT",modelId:"gpt",logoUrl:"/images/logos/openai.svg"},{id:"perplexity",name:"perplexity",displayName:"Perplexity",modelId:"perplexity",logoUrl:"/images/logos/perplexity.svg"},{id:"google",name:"google-ai-mode",displayName:"Google AI",modelId:"google-ai-mode",logoUrl:"/images/logos/google.svg"}],XX=[{name:"Gucci",website:"gucci.com"},{name:"Prada",website:"prada.com"},{name:"Louis Vuitton",website:"louisvuitton.com"},{name:"Chanel",website:"chanel.com"},{name:"Hermès",website:"hermes.com"},{name:"Burberry",website:"burberry.com"},{name:"Dior",website:"dior.com"},{name:"Versace",website:"versace.com"},{name:"Balenciaga",website:"balenciaga.com"},{name:"Fendi",website:"fendi.com"},{name:"Valentino",website:"valentino.com"},{name:"Givenchy",website:"givenchy.com"},{name:"Saint Laurent",website:"ysl.com"},{name:"Bottega Veneta",website:"bottegaveneta.com"},{name:"Celine",website:"celine.com"},{name:"Loewe",website:"loewe.com"}],ybt=["What are the best luxury handbag brands in 2026?","Which designer brands offer the best quality leather goods?","What is the most prestigious fashion house for men's suits?","Best luxury brands for sustainable fashion","Top Italian fashion houses for accessories","Which luxury brand has the best resale value?","Best designer brands for evening wear","Most innovative luxury fashion brands","Which fashion brands are leading in digital fashion?","Top luxury brands for wedding dresses","Best designer sneakers brands in 2026","Which luxury brand offers the best customer experience?","Most popular luxury brands among millennials","Best luxury brands for investment pieces","Top fashion brands for ready-to-wear collections"],vbt=[{url:"https://www.vogue.com",title:"Vogue"},{url:"https://www.elle.com",title:"Elle"},{url:"https://www.harpersbazaar.com",title:"Harper's Bazaar"},{url:"https://www.gq.com",title:"GQ"},{url:"https://www.businessoffashion.com",title:"Business of Fashion"},{url:"https://www.highsnobiety.com",title:"Highsnobiety"},{url:"https://www.forbes.com",title:"Forbes"},{url:"https://www.nytimes.com/fashion",title:"NY Times Fashion"},{url:"https://wwd.com",title:"WWD"},{url:"https://www.fashionista.com",title:"Fashionista"}];function Ms(t,e){return Math.floor(Math.random()*(e-t+1))+t}function wE(t,e,n=1){const r=Math.random()*(e-t)+t;return Number(r.toFixed(n))}function Wj(t){const e=[...t];for(let n=e.length-1;n>0;n--){const r=Math.floor(Math.random()*(n+1));[e[n],e[r]]=[e[r],e[n]]}return e}function YI(t,e,n,r="up"){const i=[];let s=e;for(let a=0;a<t;a++){const l=(Math.random()-.5)*n*2,c=r==="up"?.5:r==="down"?-.5:0;s=s+l+c*(a/t),s=Math.max(0,Math.min(100,s)),i.push({value:Math.round(s)})}return i}function bbt(t,e){const n=[];let r=e+Ms(1,3);for(let i=0;i<t;i++){const s=Math.random()>.4?-wE(0,.3):wE(0,.2);r=Math.max(1,Math.min(10,r+s)),n.push({value:Number(r.toFixed(1))})}return n}function wbt(){const t=Ms(0,3),e=XX[t],n=XX.filter((p,m)=>m!==t),r=Wj(n).slice(0,Ms(8,12)),i=Ms(62,88),s=wE(1.5,4.5),a=Ms(45,85),l=r.length,c={sentiment:YI(30,i-15,6,"up"),rank:bbt(30,s),competitors:YI(30,l-4,1.5,"up"),mentionRate:YI(30,a-20,8,"up")},u=p=>{const m=p.filter(w=>w.value!==null);if(m.length<4)return null;const x=Math.floor(m.length/2),y=m.slice(0,x).reduce((w,v)=>w+(v.value||0),0)/x,g=m.slice(x).reduce((w,v)=>w+(v.value||0),0)/(m.length-x);return Math.round((g-y)/y*100)},d={sentiment:u(c.sentiment),rank:u(c.rank),competitors:u(c.competitors),mentionRate:u(c.mentionRate)},h=Wj(ybt).slice(0,6).map((p,m)=>{const x=xbt.map(A=>{const C=Math.random()>.25;return{id:`ranking-${m}-${A.id}`,llmProvider:A,isMentioned:C,rankPosition:C?Ms(1,8):null,sentimentScore:C?Ms(55,95):null}}),y=x.filter(A=>A.isMentioned),g=y.length>0?y.reduce((A,C)=>A+(C.rankPosition||0),0)/y.length:null,w=Math.round(y.length/x.length*100),v=y.length>0?Math.round(y.reduce((A,C)=>A+(C.sentimentScore||0),0)/y.length):null,N=Wj(r).slice(0,Ms(3,6)).map(A=>({name:A.name,website:`https://${A.website}`,faviconUrl:`https://www.google.com/s2/favicons?domain=${A.website}&sz=64`})),S=Wj(vbt).slice(0,Ms(2,5)).map(A=>({...A,count:Ms(1,4)})),_=Ms(1,28)+m*2,j=new Date(Date.now()-_*60*1e3).toISOString();return{id:`query-${m}`,promptText:p,isActive:!0,lastRunAt:j,status:"idle",rankings:x,stats:{avgRank:g?Number(g.toFixed(1)):null,avgRankChange:Math.random()>.3?Ms(-2,2):null,mentionRate:w,mentionRateChange:Math.random()>.3?Ms(-15,20):null,avgSentiment:v,topCompetitors:N,topSources:S}}});return h.sort((p,m)=>new Date(m.lastRunAt).getTime()-new Date(p.lastRunAt).getTime()),{companyName:e.n
4924ame,companyWebsite:e.website,avgSentiment:i,avgRank:s,totalCompetitors:l,mentionRate:a,sparklines:c,trends:d,queries:h}}function _bt({onQueryClick:t}){const[e,n]=b.useState(()=>wbt()),r=b.useRef(null),i=b.useCallback(()=>{const a=Math.random()>.2,l=a?wE(1,7):null,c=a?Ms(58,95):null,u=Ms(25,100);return{avgRank:l,avgRankChange:Math.random()>.3?Ms(-3,3):null,mentionRate:u,mentionRateChange:Math.random()>.3?Ms(-20,25):null,avgSentiment:c}},[]),s=b.useCallback(()=>{n(a=>{const l=a.queries.map(y=>y.stats.avgSentiment).filter(y=>y!==null),c=l.length>0?Math.round(l.reduce((y,g)=>y+g,0)/l.length):a.avgSentiment,u=a.queries.map(y=>y.stats.avgRank).filter(y=>y!==null),d=u.length>0?Number((u.reduce((y,g)=>y+g,0)/u.length).toFixed(1)):a.avgRank,f=a.queries.map(y=>y.stats.mentionRate).filter(y=>y!==null),h=f.length>0?Math.round(f.reduce((y,g)=>y+g,0)/f.length):a.mentionRate,p=(y,g)=>[...y,{value:g}].slice(-30),m=y=>{const g=y.filter(S=>S.value!==null);if(g.length<4)return null;const w=Math.floor(g.length/2),v=g.slice(0,w).reduce((S,_)=>S+(_.value||0),0)/w,N=g.slice(w).reduce((S,_)=>S+(_.value||0),0)/(g.length-w);return Math.round((N-v)/v*100)},x={sentiment:p(a.sparklines.sentiment,c),rank:p(a.sparklines.rank,d),competitors:p(a.sparklines.competitors,a.totalCompetitors),mentionRate:p(a.sparklines.mentionRate,h)};return{...a,avgSentiment:c,avgRank:d,mentionRate:h,sparklines:x,trends:{sentiment:m(x.sentiment),rank:m(x.rank),competitors:m(x.competitors),mentionRate:m(x.mentionRate)}}})},[]);return b.useEffect(()=>{let a=!0;const l=()=>{a&&n(d=>{if(d.queries.length<3)return d;const f=d.queries[2].id,h=d.queries.map(p=>p.id===f?{...p,status:"running"}:p);return c(f),{...d,queries:h}})},c=d=>{r.current=setTimeout(()=>{a&&(n(f=>({...f,queries:f.queries.map(h=>h.id===d?{...h,status:"completed"}:h)})),r.current=setTimeout(()=>{if(!a)return;const f=i();n(h=>{const p=h.queries.map(m=>m.id===d?{...m,status:"completed",lastRunAt:new Date().toISOString(),stats:{...m.stats,...f}}:m);return p.sort((m,x)=>new Date(x.lastRunAt).getTime()-new Date(m.lastRunAt).getTime()),{...h,queries:p}}),s(),r.current=setTimeout(()=>{a&&(n(h=>({...h,queries:h.queries.map(p=>p.id===d?{...p,status:"idle"}:p)})),r.current=setTimeout(()=>{a&&l()},7e3))},1500)},1e3))},5e3)},u=setTimeout(()=>{a&&l()},4e3);return()=>{a=!1,clearTimeout(u),r.current&&clearTimeout(r.current)}},[i,s]),o.jsxs("div",{className:"space-y-4 p-4 md:p-6 bg-background",children:[o.jsx("div",{className:"flex items-center justify-between",children:o.jsxs("h2",{className:"text-xl md:text-2xl font-bold",children:["Welcome, ",e.companyName]})}),o.jsxs("div",{className:"grid gap-3 md:gap-4 grid-cols-2 lg:grid-cols-4",children:[o.jsxs(Dt,{className:"relative overflow-hidden",children:[o.jsxs(Zt,{className:"flex flex-row items-center justify-between pb-2 px-3 md:px-6 pt-3 md:pt-6",children:[o.jsx(tn,{className:"text-xs md:text-sm font-medium text-muted-foreground",children:"Brand Sentiment"}),o.jsx(Mo,{className:"h-3 w-3 md:h-4 md:w-4 text-muted-foreground"})]}),o.jsxs(Vt,{className:"pb-10 md:pb-12 px-3 md:px-6",children:[o.jsxs("div",{className:"flex items-baseline gap-2",children:[o.jsx("div",{className:"text-xl md:text-2xl font-bold",children:e.avgSentiment}),e.trends.sentiment!==null&&o.jsx(Gj,{value:e.trends.sentiment,inverted:!1})]}),o.jsx("p",{className:"text-[10px] md:text-xs text-muted-foreground",children:"Your brand's sentiment score"})]}),o.jsx(qj,{type:"bar",data:e.sparklines.sentiment})]}),o.jsxs(Dt,{className:"relative overflow-hidden",children:[o.jsxs(Zt,{className:"flex flex-row items-center justify-between pb-2 px-3 md:px-6 pt-3 md:pt-6",children:[o.jsx(tn,{className:"text-xs md:text-sm font-medium text-muted-foreground",children:"Average Rank"}),o.jsx(wz,{className:"h-3 w-3 md:h-4 md:w-4 text-muted-foreground"})]}),o.jsxs(Vt,{className:"pb-10 md:pb-12 px-3 md:px-6",children:[o.jsxs("div",{className:"flex items-baseline gap-2",children:[o.jsxs("div",{className:"text-xl md:text-2xl font-bold",children:["#",e.avgRank]}),e.trends.rank!==null&&o.jsx(Gj,{value:e.trends.rank,inverted:!0})]}),o.jsx("p",{className:"text-[10px] md:text-xs text-muted-foreground",children:"When brand is mentioned"})]}),o.jsx(qj,{type:"line",data:e.sparklines.rank})]}),o.jsxs(Dt,{className:"relative overflow-hidden",children:[o.jsxs(Zt,{className:"flex flex-row items-center justify-between pb-2 px-3 md:px-6 pt-3 md:pt-6",children:[o.jsx(tn,{className:"text-xs md:text-sm font-medium text-muted-foreground",children:"Competitors"}),o.jsx(uc,{className:"h-3 w-3 md:h-4 md:w-4 text-muted-foreground"})]}),o.jsxs(Vt,{className:"pb-10 md:pb-12 px-3 md:px-6",children:[o.jsxs("div",{className:"flex items-baseline gap-2",children:[o.jsx("div",{className:"text-xl md:text-2xl font-bold",children:e.totalCompetitors}),e.trends.competitors!==null&&o.jsx(Gj,{value:e.trends.competitors,inverted:!1})]}),o.jsx("p",{className:"text-[10px] md:text-xs text-muted-foreground",children:"Tracked competitors"})]}),o.jsx(qj,{type:"bar",data:e.sparklines.competitors})]}),o.jsxs(Dt,{className:"relative overflow-hidden",children:[o.jsxs(Zt,{className:"flex flex-row items-center justify-between pb-2 px-3 md:px-6 pt-3 md:pt-6",children:[o.jsx(tn,{className:"text-xs md:text-sm font-medium text-muted-foreground",children:"Mention Rate"}),o.jsx(Ud,{className:"h-3 w-3 md:h-4 md:w-4 text-muted-foreground"})]}),o.jsxs(Vt,{className:"pb-10 md:pb-12 px-3 md:px-6",children:[o.jsxs("div",{className:"flex items-baseline gap-2",children:[o.jsxs("div",{className:"text-xl md:text-2xl font-bold",children:[e.mentionRate,"%"]}),e.trends.mentionRate!==null&&o.jsx(Gj,{value:e.trends.mentionRate,inverted:!1})]}),o.jsx("p",{className:"text-[10px] md:text-xs text-muted-foreground",children:"Brand mentioned in responses"})]}),o.jsx(qj,{type:"line",data:e.sparklines.mentionRate})]})]}),o.jsxs(Dt,{children:[o.jsxs(Zt,{className:"flex flex-row items-center justify-between px-3 md:px-6 py-3 md:py-4",children:[o.jsx(tn,{className:"text-base md:text-lg mb-0",children:"Recent Prompts"}),o.jsxs(le,{variant:"outline",size:"sm",className:"text-xs md:text-sm h-7 md:h-8",disabled:!0,children:["View all",o.jsx(Wr,{className:"ml-1 md:ml-2 h-3 w-3 md:h-4 md:w-4"})]})]}),o.jsx(Vt,{className:"px-0 pb-0",children:o.jsx(Sbt,{queries:e.queries,onQueryClick:t})})]})]})}function Gj({value:t,inverted:e}){const n=e?t<0:t>0,r=e?t>0:t<0;return o.jsxs("span",{className:ne("text-[10px] md:text-xs font-medium flex items-center gap-0.5",n&&"text-emerald-500",r&&"text-red-500",!n&&!r&&"text-muted-foreground"),children:[n?o.jsx(Ud,{className:"h-2.5 w-2.5 md:h-3 md:w-3"}):r?o.jsx(Xse,{className:"h-2.5 w-2.5 md:h-3 md:w-3"}):o.jsx(kz,{className:"h-2.5 w-2.5 md:h-3 md:w-3"}),t>0?"+":"",t,"%"]})}function qj({type:t,data:e}){const n=e.filter(r=>r.value!==null);return n.length===0?null:o.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-8 md:h-10",children:o.jsx(Qi,{width:"100%",height:"100%",children:t==="bar"?o.jsxs(Lh,{data:e,children:[o.jsx(Bn,{cursor:!1,content:({active:r,payload:i})=>r&&i&&i.length?o.jsx("div",{className:"rounded-lg border bg-background px-2 py-1 shadow-sm",children:o.jsx("span",{className:"text-xs font-medium",children:i[0].value})}):null}),o.jsx(qa,{dataKey:"value",fill:"var(--primary)",radius:[2,2,0,0]})]}):o.jsxs(Dh,{data:n,children:[o.jsx(Bn,{cursor:!1,content:({active:r,payload:i})=>r&&i&&i.length?o.jsx("div",{className:"rounded-lg border bg-background px-2 py-1 shadow-sm",children:o.jsx("span",{className:"text-xs font-medium",children:i[0].value})}):null}),o.jsx(Po,{type:"monotone",dataKey:"value",stroke:"var(--primary)",strokeWidth:1.5,dot:!1})]})})})}function Sbt({queries:t,onQueryClick:e}){const[,n]=b.useState(0);b.useEffect(()=>{const i=setInterval(()=>n(s=>s+1),1e3);return()=>clearInterval(i)},[]);const r=i=>{const s=new Date(i),l=new Date().getTime()-s.getTime(),c=Math.floor(l/1e3),u=Math.floor(l/(1e3*60)),d=Math.floor(l/(1e3*60*60));return c<10?"Just now":c<60?`${c}s ago`:u<60?`${u}
4924m ago`:d<24?`${d}h ago`:`${Math.floor(d/24)}d ago`};return o.jsxs("div",{className:"overflow-x-auto",children:[o.jsxs("table",{className:"w-full text-sm",children:[o.jsx("thead",{className:"bg-muted/50 border-y",children:o.jsxs("tr",{children:[o.jsx("th",{className:"px-3 md:px-4 py-2 md:py-3 text-left text-[10px] md:text-xs font-medium text-muted-foreground tracking-wider",children:"Prompt"}),o.jsx("th",{className:"px-2 md:px-3 py-2 md:py-3 text-left text-[10px] md:text-xs font-medium text-muted-foreground tracking-wider hidden md:table-cell",children:"LLMs"}),o.jsx("th",{className:"px-2 md:px-3 py-2 md:py-3 text-center text-[10px] md:text-xs font-medium text-muted-foreground tracking-wider",children:"Rank"}),o.jsx("th",{className:"px-2 md:px-3 py-2 md:py-3 text-center text-[10px] md:text-xs font-medium text-muted-foreground tracking-wider hidden sm:table-cell",children:"Sentiment"}),o.jsx("th",{className:"px-2 md:px-3 py-2 md:py-3 text-center text-[10px] md:text-xs font-medium text-muted-foreground tracking-wider",children:"SoV"}),o.jsx("th",{className:"px-2 md:px-3 py-2 md:py-3 text-left text-[10px] md:text-xs font-medium text-muted-foreground tracking-wider hidden lg:table-cell",children:"Brands"}),o.jsx("th",{className:"px-2 md:px-3 py-2 md:py-3 text-center text-[10px] md:text-xs font-medium text-muted-foreground tracking-wider hidden md:table-cell",children:"Updated"}),o.jsx("th",{className:"px-2 md:px-3 py-2 md:py-3 text-center text-[10px] md:text-xs font-medium text-muted-foreground tracking-wider w-[60px]",children:"Studio"})]})}),o.jsx("tbody",{className:"divide-y divide-border",children:t.slice(0,3).map(i=>{const s=i.status==="running",a=i.status==="completed";return o.jsxs("tr",{onClick:()=>!s&&(e==null?void 0:e()),className:ne("transition-colors h-[57px]",s&&"bg-primary/5",a&&"bg-emerald-500/10",!s&&!a&&"hover:bg-accent/30 cursor-pointer"),children:[o.jsx("td",{className:"px-3 md:px-4 py-2 md:py-3",children:o.jsxs("div",{className:"flex items-center gap-2",children:[s&&o.jsx(Me,{className:"h-3 w-3 md:h-4 md:w-4 animate-spin text-primary shrink-0"}),o.jsx("span",{className:ne("font-medium text-xs md:text-sm line-clamp-1 max-w-[150px] md:max-w-[280px]",s&&"text-muted-foreground"),children:i.promptText}),a&&o.jsx(Ge,{variant:"default",className:"text-[10px] md:text-xs shrink-0 bg-emerald-500 h-5",children:"Done"})]})}),o.jsx("td",{className:"px-2 md:px-3 py-2 md:py-3 hidden md:table-cell",children:o.jsx("div",{className:ne("flex items-center gap-1",s&&"opacity-50"),children:i.rankings.slice(0,4).map(l=>o.jsx("div",{title:l.llmProvider.displayName,children:o.jsx(Hn,{src:l.llmProvider.logoUrl,alt:l.llmProvider.displayName,className:"h-4 w-4 md:h-5 md:w-5 rounded object-contain"})},l.id))})}),o.jsx("td",{className:"px-2 md:px-3 py-2 md:py-3 text-center",children:s?o.jsx("span",{className:"text-muted-foreground text-xs",children:"..."}):i.stats.avgRank!==null?o.jsx(nr,{value:Math.round(i.stats.avgRank),size:"responsive",variant:"rank",className:"mx-auto"}):o.jsx("span",{className:"text-muted-foreground",children:"—"})}),o.jsx("td",{className:"px-2 md:px-3 py-2 md:py-3 text-center hidden sm:table-cell",children:s?o.jsx("span",{className:"text-muted-foreground text-xs",children:"..."}):i.stats.avgSentiment!==null?o.jsx(nr,{value:Math.round(i.stats.avgSentiment),size:"responsive",variant:"percentage",className:"mx-auto"}):o.jsx("span",{className:"text-muted-foreground",children:"—"})}),o.jsx("td",{className:"px-2 md:px-3 py-2 md:py-3 text-center",children:s?o.jsx("span",{className:"text-muted-foreground text-xs",children:"..."}):i.stats.mentionRate!==null?o.jsx(nr,{value:Math.round(i.stats.mentionRate*.75),size:"responsive",variant:"percentage",className:"mx-auto"}):o.jsx("span",{className:"text-muted-foreground",children:"—"})}),o.jsx("td",{className:"px-2 md:px-3 py-2 md:py-3 hidden lg:table-cell",children:o.jsxs("div",{className:ne("flex items-center gap-1",s&&"opacity-50"),children:[i.stats.topCompetitors.slice(0,3).map((l,c)=>o.jsx("div",{className:"flex h-5 w-5 md:h-6 md:w-6 items-center justify-center rounded bg-muted overflow-hidden",title:l.name,children:o.jsx("img",{src:l.faviconUrl||"",alt:l.name,className:"h-3 w-3 md:h-4 md:w-4 object-contain"})},c)),i.stats.topCompetitors.length>3&&o.jsxs("span",{className:"text-[10px] md:text-xs text-muted-foreground",children:["+",i.stats.topCompetitors.length-3]})]})}),o.jsx("td",{className:"px-2 md:px-3 py-2 md:py-3 text-center text-[10px] md:text-xs hidden md:table-cell",children:s?o.jsx("span",{className:"text-primary font-medium",children:"Running..."}):o.jsx("span",{className:"text-muted-foreground",children:r(i.lastRunAt)})}),o.jsx("td",{className:"px-2 md:px-3 py-2 md:py-3 text-center",children:o.jsxs("button",{onClick:l=>{l.stopPropagation(),s||e==null||e()}
4924,disabled:s,className:ne("inline-flex items-center gap-1 px-2 py-1 rounded text-[10px] md:text-xs font-medium transition-colors",s?"bg-muted text-muted-foreground cursor-not-allowed":"bg-primary/10 text-primary hover:bg-primary/20"),children:[o.jsx(H1,{className:"h-3 w-3"}),o.jsx("span",{className:"hidden sm:inline",children:"Studio"}),o.jsx(Ga,{className:"h-3 w-3 hidden sm:inline"})]})})]},i.id)})})]}),o.jsxs("div",{className:"px-3 md:px-4 py-2 md:py-3 text-[10px] md:text-xs text-muted-foreground border-t",children:["Showing 3 of ",t.length," prompts"]})]})}function Nbt(){const[t,e]=b.useState("dashboard"),[n,r]=b.useState(!0),i=b.useCallback(()=>{e("studio"),r(!1)},[]);return o.jsxs("div",{className:"relative rounded-xl shadow-xl z-1 border",children:[o.jsxs("div",{className:"border-b border-border",children:[o.jsxs("div",{className:"flex items-center gap-6 px-3 pt-2 pb-0 bg-background rounded-t-xl overflow-visible",children:[o.jsxs("div",{className:"flex gap-2",children:[o.jsx("div",{className:"w-3 h-3 rounded-full bg-[#FE5F57]"}),o.jsx("div",{className:"w-3 h-3 rounded-full bg-[#FEBD2E]"}),o.jsx("div",{className:"w-3 h-3 rounded-full bg-[#28C840]"})]}),o.jsxs("div",{className:"flex gap-1 text-sm flex-1",children:[o.jsxs("button",{onClick:()=>
4924e("dashboard"),className:ne("flex items-center gap-2 px-4 py-2 transition-colors cursor-pointer rounded-t-xl",t==="dashboard"?"bg-border text-foreground":"hover:bg-border/50"),children:[o.jsx("div",{className:ne("w-4 h-4 rounded-md p-0.5 flex items-center justify-center"),children:o.jsx("img",{src:"/images/logo/logo-icon-current-color.svg",alt:"Hjaelp",className:"w-full h-full"})}),o.jsxs("span",{className:ne("text-xs font-medium","text-foreground"),children:[o.jsx("span",{className:"sm:hidden",children:"Dashboard"}),o.jsx("span",{className:"hidden sm:inline",children:"Dashboard | Hjaelp.ai"})]})]}),o.jsxs("div",{className:"relative overflow-visible",children:[o.jsxs("button",{onClick:()=>{e("studio"),r(!1)},className:ne("flex items-center gap-2 px-4 py-2 transition-colors cursor-pointer rounded-t-xl",t==="studio"?"bg-border text-foreground":"hover:bg-border/50"),children:[o.jsx("div",{className:ne("w-4 h-4 rounded-md p-0.5 flex items-center justify-center"),children:o.jsx("img",{src:"/images/logo/logo-icon-current-color.svg",alt:"Hjaelp",className:"w-full h-full"})}),o.jsxs("span",{className:ne("text-xs font-medium","text-foreground"),children:[o.jsx("span",{className:"sm:hidden",children:"Studio"}),o.jsx("span",{className:"hidden sm:inline",children:"Studio | Hjaelp.ai"})]})]}),n&&t!=="studio"&&o.jsxs("div",{className:"absolute -top-1 -right-1 z-20",children:[o.jsxs("div",{className:"absolute bottom-full mb-1 left-1/2 -translate-x-1/2 whitespace-nowrap bg-foreground text-background text-[10px] px-2 py-1 rounded shadow-lg animate-bounce",children:[o.jsx("div",{className:"flex items-center gap-1",children:"Look at me"}),o.jsx("div",{className:"absolute top-full left-1/2 -translate-x-1/2 w-0 h-0 border-l-4 border-r-4 border-t-4 border-l-transparent border-r-transparent border-t-foreground"})]}),o.jsxs("button",{onClick:s=>{s.stopPropagation(),e("studio"),r(!1)},className:"relative flex h-2 w-2 cursor-pointer",children:[o.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),o.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]})]})]}),o.jsx("div",{className:"absolute right-3.5 top-14 bg-background",children:o.jsxs(Ge,{variant:"outline",className:"text-[10px] h-5 self-center border-chart-2 ring-offset-background bg-chart-2/10 ring-1 ring-chart-2/25 ring-offset-2",children:[o.jsx("div",{className:"animate-pulse w-2 h-2 bg-chart-2 rounded-full mr-1"}),"Simplified demo"]})})]})]}),o.jsxs("div",{className:"flex items-center gap-3 bg-border px-2 py-3",children:[o.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})}),o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})]}),o.jsxs("div",{className:"flex-1 flex items-center gap-2 bg-background rounded-full px-4 py-1.5 border border-border",children:[o.jsx("svg",{className:"w-3.5 h-3.5 text-muted-foreground",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{fillRule:"evenodd",d:"M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z",clipRule:"evenodd"})}),o.jsx("span",{className:"text-muted-foreground text-xs",children:t==="dashboard"?"hjaelp.ai/dashboard":"hjaelp.ai/studio"})]})]})]}),o.jsxs("div",{className:"relative",children:[t==="dashboard"?o.jsx(_bt,{onQueryClick:i}):o.jsx(Xpe,{}),o.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-50 bg-gradient-to-t from-background via-background/50 to-transparent pointer-events-none"})]})]})}function jbt(){const[t,e]=b.useState([]),[n,r]=b.useState([]),[i,s]=b.useState([]),[a,l]=b.useState([]),[c,u]=b.useState(!0),d=b.useRef(null);b.useEffect(()=>{f()},[]);const f=async()=>{try{const[x,y,g,w]=await Promise.all([Ce.get("/public/customers"),Ce.get("/public/llm-models"),Ce.get("/public/platform-defaults"),Ce.get("/public/packages")]);e(x),r(y),s(g),l(w.packages.sort((v,N)=>v.priceCents-N.priceCents))}catch(x){console.error("Failed to fetch public data:",x)}finally{u(!1)}},h=()=>o.jsxs(Dt,{className:"relative flex flex-col animate-pulse",children:[o.jsxs(Zt,{className:"text-left md:text-center p-4 md:p-6",children:[o.jsx("div",{className:"h-6 bg-muted rounded w-24 mx-auto mb-2"}),o.jsx("div",{className:"h-4 bg-muted rounded w-32 mx-auto"})]}),o.jsxs(Vt,{className:"flex-1 p-4 md:p-6",children:[o.jsx("div",{className:"text-left md:text-center mb-6",children:o.jsx("div",{className:"h-9 bg-muted rounded w-20 mx-auto"})}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("div",{className:"h-4 bg-muted rounded w-full"}),o.jsx("div",{className:"h-4 bg-muted rounded w-full"}),o.jsx("div",{className:"h-4 bg-muted rounded w-3/4"})]})]}),o.jsx(qv,{className:"p-4 md:p-6",children:o.jsx("div",{className:"h-10 bg-muted rounded w-full"})})]}),p=Array.from(new Map(n.filter(x=>x.logoUrl).map(x=>[x.logoUrl,x])).values()),m=(x,y)=>new Intl.NumberFormat("da-DK",{style:"currency",currency:y.toUpperCase(),minimumFractionDigits:0}).format(x/100);return o.jsxs(o.Fragment,{children:[o.jsx(ot,{description:"Monitor and improve your brand visibility across AI-powered search engines like ChatGPT, Google AI, Perplexity, Gemini, Claude and more."}),o.jsx("section",{className:"py-12 md:py-15 lg:py-18",children:o.jsxs("div",{className:"mx-auto max-w-6xl px-4",children:[o.jsxs("div",{className:"mx-auto text-center",children:[o.jsxs(Ge,{variant:"secondary",className:"mb-6",children:[o.jsx(pr,{className:"mr-1.5 h-3.5 w-3.5"}),"AI brand monitoring platform"]}),o.jsx("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold tracking-tight",children:"Track your brand in any AI model"}),o.jsxs("p",{className:"mx-auto mt-6 max-w-2xl text-lg text-muted-foreground md:text-xl text-center",children:["Monitor how"," ",o.jsxs("span",{className:"inline-flex items-center gap-1 align-middle whitespace-nowrap",children:[o.jsx("img",{src:"/images/logos/openai.svg",alt:"ChatGPT",className:"h-5 w-5 md:h-6 md:w-6 rounded-full inline-block bg-muted p-1"}),o.jsx("span",{children:"ChatGPT"})]}),","," ",o.jsxs("span",{className:"inline-flex items-center gap-1 align-middle whitespace-nowrap",children:[o.jsx("img",{src:"/images/logos/google.svg",alt:"Google AI Mode",className:"h-5 w-5 md:h-6 md:w-6 rounded-full inline-block bg-muted p-1"}),o.jsx("span",{children:"Google AI"})]})," ","and"," ",o.jsxs("span",{className:"inline-flex items-center gap-1 align-middle whitespace-nowrap",children:[o.jsx("img",{src:"/images/logos/perplexity.svg",alt:"Perplexity",className:"h-5 w-5 md:h-6 md:w-6 rounded-full inline-block bg-muted p-1"}),o.jsx("span",{children:"Perplexity"})]})," ","mention your brand. Visualize competitor mentions, sources and gain insights to improve your brand visibility."]}),o.jsxs("p",{className:"text-sm text-muted-foreground mt-4 flex gap-1 items-center max-auto w-full justify-center",children:["Made with ",o.jsx(yTe,{className:"h-4 w-4 text-red-500"})," in Denmark"]}),o.jsxs("div",{className:"mt-10 flex flex-col sm:flex-row items-center justify-center gap-2 md:gap-4",children:[o.jsx(le,{size:"lg",variant:"outline",asChild:!0,className:"w-full sm:w-auto",children:o.jsx(Mt,{to:"/features",children:"Explore features"})}),o.jsx(le,{size:"lg",asChild:!0,className:"w-full sm:w-auto",children:o.jsxs(Mt,{to:"/sign-up",children:["Get started",o.jsx(Ai,{className:"ml-2 h-5 w-5"})]})})]})]}),o.jsxs("div",{className:"mx-auto mt-16 max-w-5xl",children:[o.jsx(Nbt,{}),t.length>0&&o.jsxs("div",{className:"mx-auto bg-background border rounded-2xl shadow-xl w-60 sm:w-70 md:w-90 p-2 md:p-4 px-3 md:px-6 -mt-10 relative z-10",children:[o.jsx("p",{className:"text-center text-xs text-muted-foreground mb-3",children:"Customers track leading brands"}),o.jsx("div",{className:"grid grid-cols-8 gap-2",children:t.slice(0,8).map(x=>o.jsx("div",{className:"flex items-center justify-center w-full border",children:o.jsx("span",{className:"h-full w-full object-contain rounded-lg flex items-center justify-center",children:x.logoUrl&&o.jsx("img",{src:x.logoUrl??"",alt:x.name,className:"h-full w-full object-contain object-center"})})},x.id))})]})]})]})}),(c||a.length>0)&&o.jsx("section",{className:"py-12 md:py-15 !pt-0",children:o.jsxs("div",{className:"mx-auto max-w-6xl px-4",children:[o.jsxs("div",{className:"mx-auto text-center mb-12",children:[o.jsx("h3",{className:"text-2xl font-bold mb-3",children:"Simple, transparent pricing"}),o.jsx("p",{className:"text-muted-foreground",children:"Choose the plan that fits your needs. Start with the intro plan and scale as you grow."})]}),c?o.jsx("div",{className:"mx-auto grid gap-6 max-w-6xl grid-cols-1 sm:grid-cols-2 lg:grid-cols-4",children:[1,2,3,4].map(x=>o.jsx(h,{},x))}):o.jsx("div",{className:ne("mx-auto grid gap-6",a.length===4&&"max-w-6xl grid-cols-1 sm:grid-cols-2 lg:grid-cols-4",a.length===3&&"max-w-5xl md:grid-cols-3",a.length<=2&&"max-w-3xl md:grid-cols-2"),children:a.map(x=>o.jsxs(Dt,{className:ne("relative flex flex-col",x.isFeatured&&"border-primary ring-1 ring-primary/20 ring-offset-background ring-offset-3 shadow-lg lg:scale-105 z-10"),children:[x.isFeatured&&o.jsx(Ge,{className:"absolute -top-3 left-1/2 -translate-x-1/2",children:"Most popular"}),o.jsxs(Zt,{className:"text-left md:text-center p-4 md:p-6",children:[o.jsx(tn,{className:"text-xl",children:x.name}),o.jsx(Kn,{className:"text-sm",children:x.description})]}),o.jsxs(Vt,{className:"flex-1 p-4 md:p-6",children:[o.jsxs("div",{className:"text-left md:text-center mb-6",children:[o.jsx("span",{className:"text-3xl font-bold",children:x.priceCents===0?"Free":m(x.priceCents,x.currency)}),x.priceCents>0&&o.jsxs("span",{className:"text-muted-foreground text-sm",children:[" / ",x.interval]})]}),o.jsxs("ul",{className:"space-y-2 text-sm",children:[o.jsxs("li",{className:"flex items-center gap-2",children:[o.jsx(Sn,{className:"h-4 w-4 text-primary shrink-0"}),o.jsxs("span",{children:[o.jsx("strong",{children:x.promptsPerMonth})," prompts per day"]})]}),o.jsxs("li",{className:"flex items-center gap-2",children:[o.jsx(Sn,{className:"h-4 w-4 text-primary shrink-0"}),o.jsxs("span",{children:[o.jsx("strong",{children:(x.promptsPerMonth*30*3).toLocaleStr
4924ing()})," runs/month"]})]}),o.jsxs("li",{className:"flex items-center gap-2",children:[o.jsx(Sn,{className:"h-4 w-4 text-primary shrink-0"}),o.jsxs("span",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"flex items-center -space-x-1",children:i.slice(0,3).map(y=>y.logoUrl?o.jsx(Hn,{src:y.logoUrl,alt:y.displayName,className:"h-6 w-6 object-contain rounded-full bg-background ring-1 ring-border p-1"},y.id):o.jsx("div",{className:"h-4 w-4 rounded-full bg-muted ring-1 ring-background"},y.id))}),o.jsx("span",{children:"AI models"})]})]}),o.jsxs("li",{className:"flex items-center gap-2",children:[x.tokensPerMonth>0?o.jsx(Sn,{className:"h-4 w-4 text-primary shrink-0"}):o.jsx(mr,{className:"h-4 w-4 text-muted-foreground shrink-0"}),o.jsx("span",{className:ne(!x.tokensPerMonth&&"text-muted-foreground"),children:x.tokensPerMonth>0?o.jsxs("span",{className:"inline-flex items-center gap-1",children:[o.jsx("strong",{children:x.tokensPerMonth})," run tokens",o.jsxs(Ft,{children:[o.jsx(Ut,{asChild:!0,children:o.jsx(xr,{className:"h-3.5 w-3.5 text-muted-foreground cursor-help"})}),o.jsx(zt,{className:"max-w-70 text-center",children:"Allows you to manually start runs, combine found competitors and more using AI"})]})]}):"No tokens"})]})]})]}),o.jsx(qv,{className:"p-4 md:p-6",children:o.jsx(le,{className:"w-full",variant:x.isFeatured?"default":"outline",asChild:!0,children:o.jsxs(Mt,{to:"/sign-up",children:["Get started",o.jsx(Ai,{className:"ml-2 h-4 w-4"})]})})})]},x.id))}),o.jsx("div",{className:"mt-10 text-center",children:o.jsx(le,{variant:"outline",size:"lg",asChild:!0,children:o.jsxs(Mt,{to:"/pricing",children:["Compare all plans",o.jsx(Ai,{className:"ml-2 h-4 w-4"})]})})})]})}),p.length>0&&o.jsx("section",{className:"pb-18 overflow-hidden",children:o.jsx("div",{className:"mx-auto max-w-6xl px-4",children:o.jsxs("div",{className:"relative overflow-hidden pointer-events-none",children:[o.jsx("div",{className:"absolute bg-gradient-to-r from-background via-background/75 to-transparent z-10 pointer-events-none w-30 h-full left-0"}),o.jsx("div",{className:"absolute bg-gradient-to-l from-background via-background/75 to-transparent z-10 pointer-events-none w-30 h-full right-0"}),o.jsx("div",{ref:d,className:"flex gap-4 whitespace-nowrap",style:{animation:"scroll 30s linear infinite"},children:[...p,...p,...p].map((x,y)=>o.jsx("div",{className:"flex-shrink-0 flex items-center justify-center bg-accent rounded p-2 px-4",children:x.logoUrl&&o.jsx(Hn,{src:x.logoUrl,alt:x.displayName,className:"h-8 w-auto object-contain opacity-60"})},`${x.id}-${y}`))})]})})}),o.jsx("style",{children:`
4925        @keyframes scroll {
4926          0% {
4927            transform: translateX(0);
4928          }
4929          100% {
4930            transform: translateX(-33.333%);
4931          }
4932        }
4933      `})]})}function Cbt(){const[t,e]=b.useState([]),[n,r]=b.useState([]),[i,s]=b.useState([]),[a,l]=b.useState(!0);b.useEffect(()=>{c()},[]);const c=async()=>{try{const[p,m]=await Promise.all([Ce.get("/public/packages"),Ce.get("/public/platform-defaults")]);e(p.packages.sort((x,y)=>x.priceCents-y.priceCents)),r(p.features),s(m)}catch(p){console.error("Failed to fetch pricing:",p)}finally{l(!1)}},u=(p,m)=>new Intl.NumberFormat("da-DK",{style:"currency",currency:m.toUpperCase(),minimumFractionDigits:0}).format(p/100),d=(p,m)=>{const x=p.features[m];return x?x.value:null},f=p=>p==null?o.jsx(mr,{className:"h-5 w-5 text-muted-foreground mx-auto"}):typeof p=="boolean"?p?o.jsx(Sn,{className:"h-5 w-5 text-primary mx-auto"}):o.jsx(mr,{className:"h-5 w-5 text-muted-foreground mx-auto"}):o.jsx("span",{className:"text-sm font-medium",children:p}),h=()=>o.jsxs(Dt,{className:"relative flex flex-col animate-pulse",children:[o.jsxs(Zt,{className:"text-left md:text-center p-4 md:p-6",children:[o.jsx("div",{className:"h-6 bg-muted rounded w-24 mx-auto mb-2"}),o.jsx("div",{className:"h-4 bg-muted rounded w-32 mx-auto"})]}),o.jsxs(Vt,{className:"flex-1 p-4 md:p-6",children:[o.jsx("div",{className:"text-left md:text-center mb-3 md:mb-6",children:o.jsx("div",{className:"h-9 bg-muted rounded w-20 mx-auto"})}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("div",{className:"h-4 bg-muted rounded w-full"}),o.jsx("div",{className:"h-4 bg-muted rounded w-full"}),o.jsx("div",{className:"h-4 bg-muted rounded w-3/4"})]})]}),o.jsx(qv,{className:"p-4 md:p-6",children:o.jsx("div",{className:"h-10 bg-muted rounded w-full"})})]});return o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Pricing",description:"Transparent pricing for AI brand monitoring. Choose from Free, Starter, or Growth plans to track y
4933our visibility."}),o.jsx("section",{className:"py-12 md:py-15 lg:py-18",children:o.jsx("div",{className:"mx-auto max-w-6xl px-4",children:o.jsxs("div",{className:"mx-auto text-center",children:[o.jsxs(Ge,{variant:"secondary",className:"mb-6",children:[o.jsx(Ise,{className:"mr-1.5 h-3.5 w-3.5"})," Pay for what you need"]}),o.jsx("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold tracking-tight",children:"Simple, transparent pricing"}),o.jsx("p",{className:"mt-6 text-lg text-muted-foreground",children:"Start with the intro and scale as your needs grow. No hidden fees, no surprises."})]})})}),o.jsx("section",{className:"pb-20",children:o.jsx("div",{className:"mx-auto max-w-6xl px-4",children:a?o.jsx("div",{className:"mx-auto grid gap-6 max-w-6xl grid-cols-1 sm:grid-cols-2 lg:grid-cols-4",children:[1,2,3,4].map(p=>o.jsx(h,{},p))}):o.jsx("div",{className:ne("mx-auto grid gap-6",t.length===4&&"max-w-6xl grid-cols-1 sm:grid-cols-2 lg:grid-cols-4",t.length===3&&"max-w-5xl md:grid-cols-3",t.length<=2&&"max-w-3xl md:grid-cols-2"),children:t.map(p=>o.jsxs(Dt,{className:ne("relative flex flex-col",p.isFeatured&&"border-primary ring-1 ring-primary/20 ring-offset-3 ring-offset-background shadow-lg lg:scale-105 z-10"),children:[p.isFeatured&&o.jsx(Ge,{className:"absolute -top-3 left-1/2 -translate-x-1/2",children:"Most Popular"}),o.jsxs(Zt,{className:"text-left md:text-center p-4 md:p-6",children:[o.jsx("h3",{className:"text-xl font-semibold",children:p.name}),o.jsx("p",{className:"text-sm text-muted-foreground",children:p.description})]}),o.jsxs(Vt,{className:"flex-1 p-4 md:p-6",children:[o.jsxs("div",{className:"text-left md:text-center mb-3 md:mb-6",children:[o.jsx("span",{className:"text-3xl font-bold",children:p.priceCents===0?"Free":u(p.priceCents,p.currency)}),p.priceCents>0&&o.jsxs("span",{className:"text-muted-foreground text-sm",children:[" / ",p.interval]})]}),o.jsxs("ul",{className:"space-y-2 text-sm",children:[o.jsxs("li",{className:"flex items-center gap-2",children:[o.jsx(Sn,{className:"h-4 w-4 text-primary shrink-0"}),o.jsxs("span",{children:[o.jsx("strong",{children:p.promptsPerMonth})," prompts per day"]})]}),o.jsxs("li",{className:"flex items-center gap-2",children:[o.jsx(Sn,{className:"h-4 w-4 text-primary shrink-0"}),o.jsxs("span",{children:[o.jsx("strong",{children:(p.promptsPerMonth*30*3).toLocaleString()})," runs/month"]})]}),o.jsxs("li",{className:"flex items-center gap-2",children:[o.jsx(Sn,{className:"h-4 w-4 text-primary shrink-0"}),o.jsxs("span",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"flex items-center -space-x-1",children:i.slice(0,3).map(m=>m.logoUrl?o.jsx(Hn,{src:m.logoUrl,alt:m.displayName,className:"h-6 w-6 object-contain rounded-full bg-background ring-1 ring-border p-1"},m.id):o.jsx("div",{className:"h-4 w-4 rounded-full bg-muted flex items-center justify-center ring-1 ring-background",children:o.jsx(ga,{className:"h-2.5 w-2.5 text-muted-foreground"})},m.id))}),o.jsx("span",{children:"AI models"})]})]}),o.jsxs("li",{className:"flex items-center gap-2",children:[p.tokensPerMonth>0?o.jsx(Sn,{className:"h-4 w-4 text-primary shrink-0"}):o.jsx(mr,{className:"h-4 w-4 text-muted-foreground shrink-0"}),o.jsx("span",{className:ne(!p.tokensPerMonth&&"text-muted-foreground"),children:p.tokensPerMonth>0?o.jsxs("span",{className:"inline-flex items-center gap-1",children:[o.jsx("strong",{children:p.tokensPerMonth})," run tokens",o.jsxs(Ft,{children:[o.jsx(Ut,{asChild:!0,children:o.jsx(xr,{className:"h-3.5 w-3.5 text-muted-foreground cursor-help"})}),o.jsx(zt,{className:"max-w-70 text-center",children:"Allows you to manually start runs, combine found competitors and more using AI"})]})]}):o.jsx("span",{children:"No tokens"})})]})]})]}),o.jsx(qv,{className:"p-4 md:p-6",children:o.jsx(le,{className:"w-full",variant:p.isFeatured?"default":"outline",asChild:!0,children:o.jsxs(Mt,{to:"/sign-up",children:["Get started",o.jsx(Ai,{className:"ml-2 h-4 w-4"})]})})})]},p.id))})})}),(a||n.length>0)&&o.jsx("section",{className:"py-12 !pt-0",children:o.jsxs("div",{className:"mx-auto max-w-fit px-4",children:[o.jsxs("div",{className:"mx-auto text-center mb-12",children:[o.jsx("h3",{className:"text-2xl font-bold mb-3",children:"Compare plans"}),o.jsx("p",{className:"text-muted-foreground",children:"See all features side by side"})]}),a?o.jsx("div",{className:"flex items-center justify-center py-12",children:o.jsx(Me,{className:"h-8 w-8 animate-spin text-primary"})}):o.jsx("div",{className:"mx-auto max-w-6xl overflow-x-auto border rounded-lg",children:o.jsxs("div",{className:"flex flex-col min-w-max",children:[o.jsxs("div",{className:"flex bg-background border-b",children:[o.jsx("div",{className:"sticky left-0 z-30 min-w-[160px] w-[160px] md:min-w-[200px] md:w-[200px] flex-shrink-0 py-4 px-4 font-medium text-muted-foreground border-r bg-background",children:"Feature"}),t.map((p,m)=>o.jsx("div",{className:ne("min-w-[120px] w-[120px] md:min-w-[140px] md:w-[140px] flex-shrink-0 text-center py-4 px-3 font-semibold bg-background",m<t.length-1&&"border-r"),children:p.name},p.id))]}),o.jsxs("div",{className:"flex border-b",children:[o.jsx("div",{className:"sticky left-0 z-10 min-w-[160px] w-[160px] md:min-w-[200px] md:w-[200px] flex-shrink-0 py-4 px-4 text-sm border-r bg-background",children:"Prompts per day"}),t.map((p,m)=>o.jsx("div",{className:ne("min-w-[120px] w-[120px] md:min-w-[140px] md:w-[140px] flex-shrink-0 py-4 px-3 text-center text-sm font-medium",m<t.length-1&&"border-r"),children:p.promptsPerMonth},p.id))]}),o.jsxs("div",{className:"flex border-b",children:[o.jsx("div",{className:"sticky left-0 z-10 min-w-[160px] w-[160px] md:min-w-[200px] md:w-[200px] flex-shrink-0 py-4 px-4 text-sm border-r bg-background",children:"Total runs/month"}),t.map((p,m)=>o.jsx("div",{className:ne("min-w-[120px] w-[120px] md:min-w-[140px] md:w-[140px] flex-shrink-0 py-4 px-3 text-center text-sm font-medium",m<t.length-1&&"border-r"),children:(p.promptsPerMonth*30*3).toLocaleStr
4933ing()},p.id))]}),o.jsxs("div",{className:"flex border-b",children:[o.jsx("div",{className:"sticky left-0 z-10 min-w-[160px] w-[160px] md:min-w-[200px] md:w-[200px] flex-shrink-0 py-4 px-4 text-sm border-r bg-background",children:"AI Models"}),t.map((p,m)=>o.jsx("div",{className:ne("min-w-[120px] w-[120px] md:min-w-[140px] md:w-[140px] flex-shrink-0 py-4 px-3 text-center",m<t.length-1&&"border-r"),children:o.jsx("div",{className:"flex items-center justify-center gap-2",children:i.slice(0,3).map(x=>x.logoUrl?o.jsx(Hn,{src:x.logoUrl,alt:x.displayName,className:"h-6 w-6 object-contain rounded-full bg-background ring-1 ring-border p-1"},x.id):o.jsx("div",{className:"h-5 w-5 rounded-full bg-muted flex items-center justify-center",children:o.jsx(ga,{className:"h-3 w-3 text-muted-foreground"})},x.id))})},p.id))]}),o.jsxs("div",{className:"flex border-b",children:[o.jsx("div",{className:"sticky left-0 z-10 min-w-[160px] w-[160px] md:min-w-[200px] md:w-[200px] flex-shrink-0 py-4 px-4 text-sm border-r bg-background",children:"Run Tokens"}),t.map((p,m)=>o.jsx("div",{className:ne("min-w-[120px] w-[120px] md:min-w-[140px] md:w-[140px] flex-shrink-0 py-4 px-3 text-center text-sm font-medium",m<t.length-1&&"border-r"),children:p.tokensPerMonth>0?p.tokensPerMonth:o.jsx(mr,{className:"h-5 w-5 text-muted-foreground mx-auto"})},p.id))]}),n.map((p,m)=>o.jsxs("div",{className:ne("flex",m<n.length-1&&"border-b"),children:[o.jsx("div",{className:"sticky left-0 z-10 min-w-[160px] w-[160px] md:min-w-[200px] md:w-[200px] flex-shrink-0 py-4 px-4 border-r bg-background",children:o.jsxs(Mt,{to:`/features#${p.key}`,className:"hover:text-primary transition-colors block",children:[o.jsx("span",{className:"text-sm font-medium",children:p.name}),p.description&&o.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-2",children:p.description})]})}),t.map((x,y)=>o.jsx("div",{className:ne("min-w-[120px] w-[120px] md:min-w-[140px] md:w-[140px] flex-shrink-0 py-4 px-3 text-center flex items-center justify-center",y<t.length-1&&"border-r"),children:f(d(x,p.key))},x.id))]}
4933,p.id))]})})]})})]})}function kbt(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),i=Ya();b.useEffect(()=>{s()},[]),b.useEffect(()=>{if(!n&&t.length>0&&i.hash){const l=i.hash.slice(1),c=document.getElementById(l);c&&setTimeout(()=>{c.scrollIntoView({behavior:"smooth",block:"start"})},100)}},[n,t,i.hash]);const s=async()=>{try{const l=await Ce.get("/public/features");e(l)}catch(l){console.error("Failed to fetch features:",l)}finally{r(!1)}},a=({isEven:l})=>o.jsxs("div",{className:"grid gap-8 md:gap-12 items-center grid-cols-1 md:grid-cols-2 animate-pulse",children:[o.jsx("div",{className:ne("order-1",!l&&"md:order-2"),children:o.jsx("div",{className:"aspect-[16/10] rounded-xl bg-muted"})}),o.jsxs("div",{className:ne("order-2",!l&&"md:order-1"),children:[o.jsx("div",{className:"h-8 bg-muted rounded w-3/4 mb-4"}),o.jsx("div",{className:"h-5 bg-muted rounded w-full mb-2"}),o.jsx("div",{className:"h-5 bg-muted rounded w-5/6 mb-6"}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("div",{className:"h-4 bg-muted rounded w-full"}),o.jsx("div",{className:"h-4 bg-muted rounded w-full"}),o.jsx("div",{className:"h-4 bg-muted rounded w-3/4"})]})]})]});return o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Features",description:"Discover powerful features for tracking your brand visibility in AI search. Multi-model monitoring, rank tracking, sentiment analysis, and more."}),o.jsx("section",{className:"py-12 md:py-15 lg:py-18",children:o.jsx("div",{className:"mx-auto max-w-6xl px-4",children:o.jsxs("div",{className:"mx-auto text-center",children:[o.jsxs(Ge,{variant:"secondary",className:"mb-6",children:[o.jsx(dTe,{className:"mr-1.5 h-3.5 w-3.5"})," Understand your AI presence"]}),o.jsx("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold tracking-tight",children:"Brand awareness through AI intelligence"}),o.jsx("p",{className:"mt-6 text-lg text-muted-foreground",children:"Monitor, analyze, and improve how AI assistants talk about your brand."})]})})}),o.jsx("section",{className:"pb-20",children:o.jsx("div",{className:"mx-auto max-w-6xl px-4",children:n?o.jsx("div",{className:"space-y-20",children:[0,1,2].map(l=>o.jsx(a,{isEven:l%2===0},l))}):t.length>0?o.jsx("div",{className:"space-y-20",children:t.map((l,c)=>{const u=c%2===0;return o.jsx("div",{id:l.key,className:"scroll-mt-24",children:o.jsxs("div",{className:ne("grid gap-8 md:gap-12","grid-cols-1 md:grid-cols-2"),children:[o.jsx("div",{className:ne("order-1",!u&&"md:order-2"),children:o.jsx("div",{className:"aspect-[16/10] rounded-xl border bg-muted overflow-hidden",children:l.publicImageUrl?o.jsx("img",{src:l.publicImageUrl,alt:l.name,className:"w-full h-full object-cover"}):o.jsx("div",{className:"w-full h-full flex items-center justify-center",children:o.jsx(pr,{className:"h-16 w-16 text-primary"})})})}),o.jsxs("div",{className:ne("order-2",!u&&"md:order-1"),children:[o.jsx("h2",{className:"text-3xl font-bold mb-4",children:l.name}),l.description&&o.jsx("p",{className:"text-lg text-muted-foreground mb-6",children:l.description}),l.descriptionLong&&o.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none",dangerouslySetInnerHTML:{__html:l.descriptionLong}})]})]})},l.id)})}):o.jsx("p",{className:"text-center text-muted-foreground",children:"No features available yet."})})})]})}function Ebt(){const[t,e]=b.useState([]),[n,r]=b.useState(!0);b.useEffect(()=>{i()},[]);const i=async()=>{try{const a=await Ce.get("/public/platform-defaults");e(a)}catch(a){console.error("Failed to fetch data:",a)}finally{r(!1)}},s=()=>o.jsxs("div",{className:"bg-muted/20 border rounded-full py-2 px-3 flex items-center gap-2 animate-pulse",children:[o.jsx("div",{className:"h-6 w-6 shrink-0 rounded-full bg-muted"}),o.jsx("div",{className:"h-4 w-16 bg-muted rounded"})]});return o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Models",description:"Monitor your brand across all major AI models including ChatGPT, Claude, Gemini, Perplexity, and more."}),o.jsx("section",{className:"py-12 md:py-15 lg:py-18",children:o.jsx("div",{className:"mx-auto max-w-6xl px-4",children:o.jsxs("div",{className:"mx-auto text-center",children:[o.jsxs(Ge,{variant:"secondary",className:"mb-6",children:[o.jsx(ga,{className:"mr-1.5 h-3.5 w-3.5"})," All major AI models in one platform"]}),o.jsx("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold tracking-tight",children:"Analyze your brand across the most popular AI models"}),o.jsx("p",{className:"mt-6 text-lg text-muted-foreground max-w-2xl mx-auto",children:"Track how the biggest AI models mention and recommend your brand with our comprehensive monitoring platform."}),n?o.jsx("div",{className:"flex flex-wrap justify-center gap-2 sm:gap-4 mt-8",children:[1,2,3].map(a=>o.jsx(s,{},a))}):t.length>0?o.jsx("div",{className:"flex flex-wrap justify-center gap-2 sm:gap-4 mt-8",children:t.map(a=>o.jsxs("div",{className:"bg-muted/20 border rounded-full py-1.5 px-2.5 sm:py-2 sm:px-3 flex items-center gap-1.5 sm:gap-2",children:[o.jsx("div",{className:"flex h-5 w-5 sm:h-6 sm:w-6 shrink-0 items-center justify-center rounded-full bg-muted overflow-hidden",children:a.logoUrl?o.jsx(Hn,{src:a.logoUrl,alt:a.displayName,className:"h-3 w-3 sm:h-4 sm:w-4 object-contain"}):o.jsx(ga,{className:"h-3 w-3 sm:h-4 sm:w-4 text-muted-foreground"})}),o.jsx("p",{className:"text-xs sm:text-sm",children:a.displayName})]},a.id))}):null]})})}),o.jsx("section",{className:"pb-20",children:o.jsx("div",{className:"mx-auto max-w-6xl px-4",children:o.jsx("div",{className:"rounded-xl border shadow-lg overflow-hidden",children:o.jsx(Xpe,{})})})})]})}function Abt(){return o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Integrations",description:"Connect Hjaelp.ai with your favorite tools like Slack, and more to streamline your AI brand monitoring workflow."}),o.jsx("section",{className:"py-12 md:py-15 lg:py-18",children:o.jsx("div",{className:"mx-auto max-w-6xl px-4",children:o.jsxs("div",{className:"mx-auto max-w-2xl text-center",children:[o.jsxs(Ge,{variant:"secondary",className:"mb-6",children:[o.jsx(iu,{className:"mr-1.5 h-3.5 w-3.5"})," Connect tools you already use"]}),o.jsx("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold tracking-tight sm:text-5xl",children:"Easily integrate with popular CRMs"}),o.jsx("p",{className:"mt-6 text-lg text-muted-foreground",children:"Coming soon."})]})})})]})}function Tbt(){return o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"About",description:"Learn about Hjaelp.ai and our mission to help brands track their visibility in AI-powered search."}),o.jsx("section",{className:"py-12 md:py-15 lg:py-18",children:o.jsx("div",{className:"mx-auto max-w-6xl px-4",children:o.jsxs("div",{className:"mx-auto max-w-2xl text-center",children:[o.jsxs(Ge,{variant:"secondary",className:"mb-6",children:[o.jsx(uc,{className:"mr-1.5 h-3.5 w-3.5"})," Get to know the team"]}),o.jsx("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold tracking-tight sm:text-5xl",children:"About us"}),o.jsx("p",{className:"mt-6 text-lg text-muted-foreground",children:"Coming soon."})]})})})]})}function Mbt(){return o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Terms of Service",description:"Terms of Service for Hjaelp.ai brand monitoring platform."}),o.jsx("div",{className:"py-12 md:py-15 lg:py-18",children:o.jsx("div",{className:"mx-auto max-w-6xl px-4",children:o.jsxs("article",{className:"mx-auto max-w-2xl",children:[o.jsx("h1",{className:"text-4xl font-bold mb-2",children:"Terms of Service"}),o.jsx("p",{className:"text-muted-foreground mb-8",children:"Last updated: January 2026"}),o.jsxs("div",{className:"space-y-8 text-muted-foreground",children:[o.jsxs("section",{children:[o.jsx("h2",{className:"text-xl font-semibold text-foreground mb-3",children:"1. Acceptance of Terms"}),o.jsx("p",{children:'By accessing or using Hjaelp AI ("the Service"), you agree to be bound by these Terms of Service. If you do not agree to these terms, please do not use the Service.'})]}),o.jsxs("section",{children:[o.jsx("h2",{className:"text-xl font-semibold text-foreground mb-3",children:"2. Description of Service"}),o.jsx("p",{children:"Hjaelp AI provides a platform for monitoring brand visibility across AI-powered search engines and language models. The Service includes brand tracking, competitor analysis, and reporting features."})]}),o.jsxs("section",{children:[o.jsx("h2",{className:"text-xl font-semibold text-foreground mb-3",children:"3. User Accounts"}),o.jsx("p",{children:"You are responsible for maintaining the confidentiality of your account credentials and for all activities that occur under your account. You must notify us immediately of any unauthorized use."})]}),o.jsxs("section",{children:[o.jsx("h2",{className:"text-xl font-semibold text-foreground mb-3",children:"4. Acceptable Use"}),o.jsx("p",{className:"mb-2",children:"You agree not to:"}),o.jsxs("ul",{className:"list-disc list-inside space-y-1 ml-2",children:[o.jsx("li",{children:"Use the Service for any unlawful purpose"}),o.jsx("li",{children:"Attempt to gain unauthorized access to any part of the Service"}),o.jsx("li",{children:"Interfere with or disrupt the Service"}),o.jsx("li",{children:"Resell or redistribute the Service without authorization"})]})]}),o.jsxs("section",{children:[o.jsx("h2",{className:"text-xl font-semibold text-foreground mb-3",children:"5. Payment Terms"}
4933),o.jsx("p",{children:"Paid subscriptions are billed in advance on a monthly basis. All fees are non-refundable except as required by law. We reserve the right to change pricing with 30 days notice."})]}),o.jsxs("section",{children:[o.jsx("h2",{className:"text-xl font-semibold text-foreground mb-3",children:"6. Intellectual Property"}),o.jsx("p",{children:"The Service and its original content, features, and functionality are owned by Hjaelp AI and are protected by international copyright, trademark, and other intellectual property laws."})]}),o.jsxs("section",{children:[o.jsx("h2",{className:"text-xl font-semibold text-foreground mb-3",children:"7. Limitation of Liability"}),o.jsx("p",{children:'The Service is provided "as is" without warranties of any kind. We shall not be liable for any indirect, incidental, special, consequential, or punitive damages resulting from your use of the Service.'})]}),o.jsxs("section",{children:[o.jsx("h2",{className:"text-xl font-semibold text-foreground mb-3",children:"8. Termination"}),o.jsx("p",{children:"We may terminate or suspend your account at any time for violations of these Terms. Upon termination, your right to use the Service will immediately cease."})]}),o.jsxs("section",{children:[o.jsx("h2",{className:"text-xl font-semibold text-foreground mb-3",children:"9. Changes to Terms"}),o.jsx("p",{children:"We reserve the right to modify these Terms at any time. We will notify users of significant changes via email or through the Service."})]}),o.jsxs("section",{children:[o.jsx("h2",{className:"text-xl font-semibold text-foreground mb-3",children:"10. Contact"}),o.jsx("p",{children:"For questions about these Terms, please contact us at [email protected]."})]})]})]})})})]})}function Pbt(){return o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Privacy Policy",description:"Privacy Policy for Hjaelp.ai. Learn how we collect, use, and protect your data."}),o.jsx("div",{className:"py-12 md:py-15 lg:py-18",children:o.jsx("div",{className:"mx-auto max-w-6xl px-4",children:o.jsxs("article",{className:"mx-auto max-w-2xl",children:[o.jsx("h1",{className:"text-4xl font-bold mb-2",children:"Privacy Policy"}),o.jsx("p",{className:"text-muted-foreground mb-8",children:"Last updated: January 2026"}),o.jsxs("div",{className:"space-y-8 text-muted-foreground",children:[o.jsxs("section",{children:[o.jsx("h2",{className:"text-xl font-semibold text-foreground mb-3",children:"1. Information We Collect"}),o.jsx("p",{className:"mb-2",children:"We collect information you provide directly to us, including:"}),o.jsxs("ul",{className:"list-disc list-inside space-y-1 ml-2",children:[o.jsx("li",{children:"Account information (name, email, password)"}),o.jsx("li",{children:"Company information (brand name, website)"}),o.jsx("li",{children:"Payment information (processed securely via Stripe)"}),o.jsx("li",{children:"Usage data and preferences"})]})]}),o.jsxs("section",{children:[o.jsx("h2",{className:"text-xl font-semibold text-foreground mb-3",children:"2. How We Use Your Information"}),o.jsx("p",{className:"mb-2",children:"We use the information we collect to:"}),o.jsxs("ul",{className:"list-disc list-inside space-y-1 ml-2",children:[o.jsx("li",{children:"Provide and maintain the Service"}),o.jsx("li",{children:"Process transactions and send related information"}),o.jsx("li",{children:"Send technical notices and support messages"}),o.jsx("li",{children:"Respond to your comments and questions"}),o.jsx("li",{children:"Improve and develop new features"})]})]}),o.jsxs("section",{children:[o.jsx("h2",{className:"text-xl font-semibold text-foreground mb-3",children:"3. Information Sharing"}),o.jsx("p",{className:"mb-2",children:"We do not sell your personal information. We may share information with third parties only in the following circumstances:"}),o.jsxs("ul",{className:"list-disc list-inside space-y-1 ml-2",children:[o.jsx("li",{children:"With your consent"}),o.jsx("li",{children:"To comply with legal obligations"}),o.jsx("li",{children:"With service providers who assist in our operations"})]})]}),o.jsxs("section",{children:[o.jsx("h2",{className:"text-xl font-semibold text-foreground mb-3",children:"4. Data Security"}),o.jsx("p",{children:"We implement appropriate technical and organizational measures to protect your personal information against unauthorized access, alteration, disclosure, or destruction."})]}),o.jsxs("section",{children:[o.jsx("h2",{className:"text-xl font-semibold text-foreground mb-3",children:"5. Data Retention"}),o.jsx("p",{children:"We retain your information for as long as your account is active or as needed to provide services. You may request deleti
4933on of your data at any time."})]}),o.jsxs("section",{children:[o.jsx("h2",{className:"text-xl font-semibold text-foreground mb-3",children:"6. Your Rights"}),o.jsx("p",{className:"mb-2",children:"You have the right to:"}),o.jsxs("ul",{className:"list-disc list-inside space-y-1 ml-2",children:[o.jsx("li",{children:"Access your personal information"}),o.jsx("li",{children:"Correct inaccurate data"}),o.jsx("li",{children:"Request deletion of your data"}),o.jsx("li",{children:"Export your data"}),o.jsx("li",{children:"Withdraw consent at any time"})]})]}),o.jsxs("section",{children:[o.jsx("h2",{className:"text-xl font-semibold text-foreground mb-3",children:"7. International Transfers"}),o.jsx("p",{children:"Your information may be transferred to and processed in countries other than your own. We ensure appropriate safeguards are in place for such transfers."})]}),o.jsxs("section",{children:[o.jsx("h2",{className:"text-xl font-semibold text-foreground mb-3",children:"8. Changes to This Policy"}),o.jsx("p",{children:'We may update this Privacy Policy from time to time. We will notify you of any changes by posting the new policy on this page and updating the "Last updated" date.'})]}),o.jsxs("section",{children:[o.jsx("h2",{className:"text-xl font-semibold text-foreground mb-3",children:"9. Contact Us"}),o.jsx("p",{children:"For questions about this Privacy Policy, please contact us at [email protected]."})]})]})]})})})]})}function Obt(){return o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Cookie Policy",description:"Cookie Policy for Hjaelp.ai. Learn about how we use cookies and similar technologies."}),o.jsx("div",{className:"py-12 md:py-15 lg:py-18",children:o.jsx("div",{className:"mx-auto max-w-6xl px-4",children:o.jsxs("article",{className:"mx-auto max-w-2xl",children:[o.jsx("h1",{className:"text-4xl font-bold mb-2",children:"Cookie Policy"}),o.jsx("p",{className:"text-muted-foreground mb-8",children:"Last updated: January 2026"}),o.jsxs("div",{className:"space-y-8 text-muted-foreground",children:[o.jsxs("section",{children:[o.jsx("h2",{className:"text-xl font-semibold text-foreground mb-3",children:"1. What Are Cookies"}),o.jsx("p",{children:"Cookies are small text files stored on your device when you visit a website. They help websites remember your preferences and improve your browsing experience."})]}),o.jsxs("section",{children:[o.jsx("h2",{className:"text-xl font-semibold text-foreground mb-3",children:"2. How We Use Cookies"}),o.jsx("p",{className:"mb-4",children:"We use cookies for the following purposes:"}),o.jsx("h3",{className:"text-lg font-medium text-foreground mb-2",children:"Essential Cookies"}),o.jsx("p",{className:"mb-4",children:"These cookies are necessary for the website to function properly. They enable core functionality such as security, authentication, and accessibility."}),o.jsx("h3",{className:"text-lg font-medium text-foreground mb-2",children:"Performance Cookies"}),o.jsx("p",{className:"mb-4",children:"These cookies help us understand how visitors interact with our website by collecting anonymous information about page visits and errors."}),o.jsx("h3",{className:"text-lg font-medium text-foreground mb-2",children:"Functional Cookies"}),o.jsx("p",{children:"These cookies remember your preferences and choices to provide a more personalized experience."})]}),o.jsxs("section",{children:[o.jsx("h2",{className:"text-xl font-semibold text-foreground mb-3",children:"3. Third-Party Cookies"}),o.jsx("p",{className:"mb-2",children:"We may use third-party services that set the
4933ir own cookies, including:"}),o.jsxs("ul",{className:"list-disc list-inside space-y-1 ml-2",children:[o.jsx("li",{children:"Analytics services (to understand usage patterns)"}),o.jsx("li",{children:"Payment processors (for secure transactions)"})]})]}),o.jsxs("section",{children:[o.jsx("h2",{className:"text-xl font-semibold text-foreground mb-3",children:"4. Managing Cookies"}),o.jsx("p",{className:"mb-2",children:"Most web browsers allow you to control cookies through their settings. You can:"}),o.jsxs("ul",{className:"list-disc list-inside space-y-1 ml-2",children:[o.jsx("li",{children:"View what cookies are stored on your device"}),o.jsx("li",{children:"Delete all or specific cookies"}),o.jsx("li",{children:"Block cookies from specific or all websites"}),o.jsx("li",{children:"Block third-party cookies"})]}),o.jsx("p",{className:"mt-3",children:"Note that blocking cookies may affect the functionality of our website."})]}),o.jsxs("section",{children:[o.jsx("h2",{className:"text-xl font-semibold text-foreground mb-3",children:"5. Updates to This Policy"}),o.jsx("p",{children:'We may update this Cookie Policy from time to time. Any changes will be posted on this page with an updated "Last updated" date.'})]}),o.jsxs("section",{children:[o.jsx("h2",{className:"text-xl font-semibold text-foreground mb-3",children:"6. Contact Us"}),o.jsx("p",{children:"If you have questions about our use of cookies, please contact us at [email protected]."})]})]})]})})})]})}function Rbt(){return o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"AI Disclaimer",description:"AI Disclaimer for Hjaelp.ai. Important information about our AI-powered monitoring service."}),o.jsx("div",{className:"py-12 md:py-15 lg:py-18",children:o.jsx("div",{className:"mx-auto max-w-6xl px-4",children:o.jsxs("article",{className:"mx-auto max-w-2xl",children:[o.jsx("h1",{className:"text-4xl font-bold mb-2",children:"AI Disclaimer"}),o.jsx("p",{className:"text-muted-foreground mb-8",children:"Last updated: January 2026"}),o.jsxs("div",{className:"space-y-8 text-muted-foreground",children:[o.jsxs("section",{children:[o.jsx("h2",{className:"text-xl font-semibold text-foreground mb-3",children:"1. About Our AI Monitoring"}),o.jsx("p",{children:"Hjaelp AI monitors how various AI language models and assistants respond to queries about your brand. We query these AI systems and analyze their responses to provide insights about your brand visibility."})]}),o.jsxs("section",{children:[o.jsx("h2",{className:"text-xl font-semibold text-foreground mb-3",children:"2. AI Response Variability"}),o.jsx("p",{children:"AI systems can produce different responses to the same query at different times. The responses monitored by our service represent snapshots in time and may not reflect current AI behavior at any given moment."})]}),o.jsxs("section",{children:[o.jsx("h2",{className:"text-xl font-semibold text-foreground mb-3",children:"3. No Control Over AI Responses"}),o.jsx("p",{children:"Hjaelp AI does not control, influence, or modify the responses generated by third-party AI systems. We merely observe and report on these responses. The content of AI responses is determined entirely by the respective AI providers."})]}),o.jsxs("section",{children:[o.jsx("h2",{className:"text-xl font-semibold text-foreground mb-3",children:"4. Accuracy and Interpretation"}),o.jsx("p",{children:"While we strive for accuracy in our analysis and reporting, AI responses can be nuanced and subject to interpretation. Our sentiment analysis, ranking, and other metrics are algorithmic assessments and should be used as guidance rather than absolute measures."})]}),o.jsxs("section",{children:[o.jsx("h2",{className:"text-xl font-semibold text-foreground mb-3",children:"5. Third-Party AI Systems"}),o.jsx("p",{children:"We monitor various third-party AI systems including but not limited to OpenAI's ChatGPT, Anthropic's Claude, Google's Gemini, and others. We are not affiliated with these companies, and their services are subject to their own terms and policies."})]}),o.jsxs("section",{children:[o.jsx("h2",{className:"text-xl font-semibold text-foreground mb-3",children:"6. Data Usage"}),o.jsx("p",{children:"The queries we submit to AI systems are based on the prompts you configure in your account. These queries are sent to third-party AI providers and are subject to those providers' data handling practices."})]}),o.jsxs("section",{children:[o.jsx("h2",{className:"text-xl font-semibold text-foreground mb-3",children:"7. No Guarantee of Results"}),o.jsx("p",{children:"Hjaelp AI is a monitoring and analysis tool. We do not guarantee any specific outcomes regarding your brand's visibility in AI search results. Improving AI visibility requires broader SEO and content strategies beyond the scope of our monitoring service."})]}),o.jsxs("section",{children:[o.jsx("h2",{className:"text-xl font-semibold text-foreground mb-3",children:"8. Continuous Development"}),o.jsx("p",{children:"AI technology is rapidly evolving. We continuously update our monitoring capabilities to keep pace with changes in the AI landscape. Some features may be added, modified, or deprecated as the technology evolves."})]}),o.jsxs("section",{children:[o.jsx("h2",{className:"text-xl font-semibold text-foreground mb-3",children:"9. Questions"}),o.jsx("p",{children:"If you have questions about our AI monitoring practices, please contact us at [email protected]."})]})]})]})})})]})}var aN=t=>t.type==="checkbox",rm=t=>t instanceof Date,Ra=t=>t==null;const Qpe=t=>typeof t=="object";var Oi=t=>!Ra(t)&&!Array.isArray(t)&&Qpe(t)&&!rm(t),Ibt=t=>Oi(t)&&t.target?aN(t.target)?t.target.checked:t.target.value:t,Dbt=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,Lbt=(t,e)=>t.has(Dbt(e)),$bt=t=>{const e=t.constructor&&t.constructor.prototype;return Oi(e)&&e.hasOwnProperty("isPrototypeOf")},n8=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Bi(t){if(t instanceof Date)return new Date(t);const e=typeof FileList<"u"&&t instanceof FileList;if(n8&&(t instanceof Blob||e))return t;const n=Array.isArray(t);if(!n&&!(Oi(t)&&$bt(t)))return t;const r=n?[]:Object.create(Object.getPrototypeOf(t));for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=Bi(t[i]));return r}var tP=t=>/^\w*$/.test(t),ei=t=>t===void 0,r8=t=>Array.isArray(t)?t.filter(Boolean):[],i8=t=>r8(t.replace(/["|']|\]/g,"").split(/\.|\[/)),bt=(t,e,n)=>{if(!e||!Oi(t))return n;const r=(tP(e)?[e]:i8(e)).reduce((i,s)=>Ra(i)?i:i[s],t);return ei(r)||r===t?ei(t[e])?n:t[e]:r},Pc=t=>typeof t=="boolean",Ql=t=>typeof t=="function",gr=(t,e,n)=>{let r=-1;const i=tP(e)?[e]:i8(e),s=i.length,a=s-1;for(;++r<s;){const l=i[r];let c=n;if(r!==a){const u=t[l];c=Oi(u)||Array.isArray(u)?u:isNaN(+i[r+1])?{}:[]}if(l==="__proto__"||l==="constructor"||l==="prototype")return;t[l]=c,t=t[l]}};const QX={BLUR:"blur",FOCUS_OUT:"focusout"},Jl={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Tu={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Fbt=te.createContext(null);
4933Fbt.displayName="HookFormControlContext";var Ubt=(t,e,n,r=!0)=>{const i={defaultValues:e._defaultValues};for(const s in t)Object.defineProperty(i,s,{get:()=>{const a=s;return e._proxyFormState[a]!==Jl.all&&(e._proxyFormState[a]=!r||Jl.all),t[a]}});return i};const zbt=typeof window<"u"?te.useLayoutEffect:te.useEffect;var mo=t=>typeof t=="string",Bbt=(t,e,n,r,i)=>mo(t)?(r&&e.watch.add(t),bt(n,t,i)):Array.isArray(t)?t.map(s=>(r&&e.watch.add(s),bt(n,s))):(r&&(e.watchAll=!0),n),k5=t=>Ra(t)||!Qpe(t);function Tf(t,e,n=new WeakSet){if(k5(t)||k5(e))return Object.is(t,e);if(rm(t)&&rm(e))return Object.is(t.getTime(),e.getTime());const r=Object.keys(t),i=Object.keys(e);if(r.length!==i.length)return!1;if(n.has(t)||n.has(e))return!0;n.add(t),n.add(e);for(const s of r){const a=t[s];if(!i.includes(s))return!1;if(s!=="ref"){const l=e[s];if(rm(a)&&rm(l)||Oi(a)&&Oi(l)||Array.isArray(a)&&Array.isArray(l)?!Tf(a,l,n):!Object.is(a,l))return!1}}return!0}const Vbt=te.createContext(null);Vbt.displayName="HookFormContext";var Jpe=(t,e,n,r,i)=>e?{...n[t],types:{...n[t]&&n[t].types?n[t].types:{},[r]:i||!0}}:{},Kw=t=>Array.isArray(t)?t:[t],JX=()=>{let t=[];return{get observers(){return t},next:i=>{for(const s of t)s.next&&s.next(i)},subscribe:i=>(t.push(i),{unsubscribe:()=>{t=t.filter(s=>s!==i)}}),unsubscribe:()=>{t=[]}}};function Zpe(t,e){const n={};for(const r in t)if(t.hasOwnProperty(r)){const i=t[r],s=e[r];if(i&&Oi(i)&&s){const a=Zpe(i,s);Oi(a)&&(n[r]=a)}else t[r]&&(n[r]=s)}return n}var aa=t=>Oi(t)&&!Object.keys(t).length,s8=t=>t.type==="file",_E=t=>{if(!n8)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},eme=t=>t.type==="select-multiple",a8=t=>t.type==="radio",Hbt=t=>a8(t)||aN(t),XI=t=>_E(t)&&t.isConnected;function Wbt(t,e){const n=e.slice(0,-1).length;let r=0;for(;r<n;)t=ei(t)?r++:t[e[r++]];return t}function Gbt(t){for(const e in t)if(t.hasOwnProperty(e)&&!ei(t[e]))return!1;return!0}function _i(t,e){const n=Array.isArray(e)?e:tP(e)?[e]:i8(e),r=n.length===1?t:Wbt(t,n),i=n.length-1,s=n[i];return r&&delete r[s],i!==0&&(Oi(r)&&aa(r)||Array.isArray(r)&&Gbt(r))&&_i(t,n.slice(0,-1)),t}var qbt=t=>{for(const e in t)if(Ql(t[e]))return!0;return!1};function tme(t){return Array.isArray(t)||Oi(t)&&!qbt(t)}function E5(t,e={}){for(const n in t){const r=t[n];tme(r)?(e[n]=Array.isArray(r)?[]:{},E5(r,e[n])):ei(r)||(e[n]=!0)}return e}function Ux(t,e,n){n||(n=E5(e));for(const r in t){const i=t[r];if(tme(i))ei(e)||k5(n[r])?n[r]=E5(i,Array.isArray(i)?[]:{}):Ux(i,Ra(e)?{}:e[r],n[r]);else{const s=e[r];n[r]=!Tf(i,s)}}return n}const ZX={value:!1,isValid:!1},eQ={value:!0,isValid:!0};var nme=t=>{if(Array.isArray(t)){if(t.length>1){const e=t.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!ei(t[0].attributes.value)?ei(t[0].value)||t[0].value===""?eQ:{value:t[0].value,isValid:!0}:eQ:ZX}return ZX},rme=(t,{valueAsNumber:e,valueAsDate:n,setValueAs:r})=>ei(t)?t:e?t===""?NaN:t&&+t:n&&mo(t)?new Date(t):r?r(t):t;const tQ={isValid:!1,value:null};var ime=t=>Array.isArray(t)?t.reduce((e,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:e,tQ):tQ;function nQ(t){const e=t.ref;return s8(e)?e.files:a8(e)?ime(t.refs).value:eme(e)?[...e.selectedOptions].map(({value:n})=>n):aN(e)?nme(t.refs).value:rme(ei(e.value)?t.ref.value:e.value,t)}var Kbt=(t,e,n,r)=>{const i={};for(const s of t){const a=bt(e,s);a&&gr(i,s,a._f)}return{criteriaMode:n,names:[...t],fields:i,shouldUseNativeValidation:r}},SE=t=>t instanceof RegExp,Ib=t=>ei(t)?t:SE(t)?t.source:Oi(t)?SE(t.value)?t.value.source:t.value:t,rQ=t=>({isOnSubmit:!t||t===Jl.onSubmit,isOnBlur:t===Jl.onBlur,isOnChange:t===Jl.onChange,isOnAll:t===Jl.all,isOnTouch:t===Jl.onTouched});const iQ="AsyncFunction";var Ybt=t=>!!t&&!!t.validate&&!!(Ql(t.validate)&&t.validate.constructor.name===iQ||Oi(t.validate)&&Object.values(t.validate).find(e=>e.constructor.name===iQ)),Xbt=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate),sQ=(t,e,n)=>!n&&(e.watchAll||e.watch.has(t)||[...e.watch].some(r=>t.startsWith(r)&&/^\.\w+/.test(t.slice(r.length))));const Yw=(t,e,n,r)=>{for(const i of n||Object.keys(t)){const s=bt(t,i);if(s){const{_f:a,...l}=s;if(a){if(a.refs&&a.refs[0]&&e(a.refs[0],i)&&!r)return!0;
vendor: 4,151 bytes, line 4933
4933if(a.ref&&e(a.ref,a.name)&&!r)return!0;if(Yw(l,e))break}else if(Oi(l)&&Yw(l,e))break}}};function aQ(t,e,n){const r=bt(t,n);if(r||tP(n))return{error:r,name:n};const i=n.split(".");for(;i.length;){const s=i.join("."),a=bt(e,s),l=bt(t,s);if(a&&!Array.isArray(a)&&n!==s)return{name:n};if(l&&l.type)return{name:s,error:l};if(l&&l.root&&l.root.type)return{name:`${s}.root`,error:l.root};i.pop()}return{name:n}}var Qbt=(t,e,n,r)=>{n(t);const{name:i,...s}=t;return aa(s)||Object.keys(s).length>=Object.keys(e).length||Object.keys(s).find(a=>e[a]===(!r||Jl.all))},Jbt=(t,e,n)=>!t||!e||t===e||Kw(t).some(r=>r&&(n?r===e:r.startsWith(e)||e.startsWith(r))),Zbt=(t,e,n,r,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(e||t):(n?r.isOnBlur:i.isOnBlur)?!t:(n?r.isOnChange:i.isOnChange)?t:!0,ewt=(t,e)=>!r8(bt(t,e)).length&&_i(t,e),twt=(t,e,n)=>{const r=Kw(bt(t,n));return gr(r,"root",e[n]),gr(t,n,r),t};function oQ(t,e,n="validate"){if(mo(t)||Array.isArray(t)&&t.every(mo)||Pc(t)&&!t)return{type:n,message:mo(t)?t:"",ref:e}}var Nx=t=>Oi(t)&&!SE(t)?t:{value:t,message:""},lQ=async(t,e,n,r,i,s)=>{const{ref:a,refs:l,required:c,maxLength:u,minLength:d,min:f,max:h,pattern:p,validate:m,name:x,valueAsNumber:y,mount:g}=t._f,w=bt(n,x);if(!g||e.has(x))return{};const v=l?l[0]:a,N=I=>{i&&v.reportValidity&&(v.setCustomValidity(Pc(I)?"":I||""),v.reportValidity())},S={},_=a8(a),j=aN(a),A=_||j,C=(y||s8(a))&&ei(a.value)&&ei(w)||_E(a)&&a.value===""||w===""||Array.isArray(w)&&!w.length,k=Jpe.bind(null,x,r,S),M=(I,R,E,P=Tu.maxLength,O=Tu.minLength)=>{const L=I?R:E;S[x]={type:I?P:O,message:L,ref:a,...k(I?P:O,L)}};if(s?!Array.isArray(w)||!w.length:c&&(!A&&(C||Ra(w))||Pc(w)&&!w||j&&!nme(l).isValid||_&&!ime(l).isValid)){const{value:I,message:R}=mo(c)?{value:!!c,message:c}:Nx(c);if(I&&(S[x]={type:Tu.required,message:R,ref:v,...k(Tu.required,R)},!r))return N(R),S}if(!C&&(!Ra(f)||!Ra(h))){let I,R;const E=Nx(h),P=Nx(f);if(!Ra(w)&&!isNaN(w)){const O=a.valueAsNumber||w&&+w;Ra(E.value)||(I=O>E.value),Ra(P.value)||(R=O<P.value)}else{const O=a.valueAsDate||new Date(w),L=F=>new Date(new Date().toDateString()+" "+F),T=a.type=="time",D=a.type=="week";mo(E.value)&&w&&(I=T?L(w)>L(E.value):D?w>E.value:O>new Date(E.value)),mo(P.value)&&w&&(R=T?L(w)<L(P.value):D?w<P.value:O<new Date(P.value))}if((I||R)&&(M(!!I,E.message,P.message,Tu.max,Tu.min),!r))return N(S[x].message),S}if((u||d)&&!C&&(mo(w)||s&&Array.isArray(w))){const I=Nx(u),R=Nx(d),E=!Ra(I.value)&&w.length>+I.value,P=!Ra(R.value)&&w.length<+R.value;if((E||P)&&(M(E,I.message,R.message),!r))return N(S[x].message),S}if(p&&!C&&mo(w)){const{value:I,message:R}=Nx(p);if(SE(I)&&!w.match(I)&&(S[x]={type:Tu.pattern,message:R,ref:a,...k(Tu.pattern,R)},!r))return N(R),S}if(m){if(Ql(m)){const I=await m(w,n),R=oQ(I,v);if(R&&(S[x]={...R,...k(Tu.validate,R.message)},!r))return N(R.message),S}else if(Oi(m)){let I={};for(const R in m){if(!aa(I)&&!r)break;const E=oQ(await m[R](w,n),v,R);E&&(I={...E,...k(R,E.message)},N(E.message),r&&(S[x]=I))}if(!aa(I)&&(S[x]={ref:v,...I},!r))return S}}return N(!0),S};const nwt={mode:Jl.onSubmit,reValidateMode:Jl.onChange,shouldFocusError:!0};function rwt(t={}){let e={...nwt,...t},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:Ql(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1},r={},i=Oi(e.defaultValues)||Oi(e.values)?Bi(e.defaultValues||e.values)||{}:{},s=e.shouldUnregister?{}:Bi(i),a={action:!1,mount:!1,watch:!1,keepIsValid:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,u=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={...d};let h={...f};const p={array:JX(),state:JX()},m=e.criteriaMode===Jl.all,x=U=>Q=>{clearTimeout(u),u=setTimeout(U,Q)},y=async U=>{if(!a.keepIsValid&&!e.disabled&&(f.isValid||h.isValid||U)){let Q;e.resolver?(Q=aa((await A()).errors),g()):Q=await k(r,!0),Q!==n.isValid&&p.state.next({isValid:Q})}},g=(U,Q)=>{!e.disabled&&(f.isValidating||f.validatingFields||h.isValidating||h.validatingFields)&&((U||Array.from(l.mount)).forEac
vendor: 7,685 bytes, line 4933
4933h(oe=>{oe&&(Q?gr(n.validatingFields,oe,Q):_i(n.validatingFields,oe))}),p.state.next({validatingFields:n.validatingFields,isValidating:!aa(n.validatingFields)}))},w=(U,Q=[],oe,_e,ye=!0,re=!0)=>{if(_e&&oe&&!e.disabled){if(a.action=!0,re&&Array.isArray(bt(r,U))){const he=oe(bt(r,U),_e.argA,_e.argB);ye&&gr(r,U,he)}if(re&&Array.isArray(bt(n.errors,U))){const he=oe(bt(n.errors,U),_e.argA,_e.argB);ye&&gr(n.errors,U,he),ewt(n.errors,U)}if((f.touchedFields||h.touchedFields)&&re&&Array.isArray(bt(n.touchedFields,U))){const he=oe(bt(n.touchedFields,U),_e.argA,_e.argB);ye&&gr(n.touchedFields,U,he)}(f.dirtyFields||h.dirtyFields)&&(n.dirtyFields=Ux(i,s)),p.state.next({name:U,isDirty:I(U,Q),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else gr(s,U,Q)},v=(U,Q)=>{gr(n.errors,U,Q),p.state.next({errors:n.errors})},N=U=>{n.errors=U,p.state.next({errors:n.errors,isValid:!1})},S=(U,Q,oe,_e)=>{const ye=bt(r,U);if(ye){const re=bt(s,U,ei(oe)?bt(i,U):oe);ei(re)||_e&&_e.defaultChecked||Q?gr(s,U,Q?re:nQ(ye._f)):P(U,re),a.mount&&!a.action&&y()}},_=(U,Q,oe,_e,ye)=>{let re=!1,he=!1;const pe={name:U};if(!e.disabled){if(!oe||_e){(f.isDirty||h.isDirty)&&(he=n.isDirty,n.isDirty=pe.isDirty=I(),re=he!==pe.isDirty);const je=Tf(bt(i,U),Q);he=!!bt(n.dirtyFields,U),je?_i(n.dirtyFields,U):gr(n.dirtyFields,U,!0),pe.dirtyFields=n.dirtyFields,re=re||(f.dirtyFields||h.dirtyFields)&&he!==!je}if(oe){const je=bt(n.touchedFields,U);je||(gr(n.touchedFields,U,oe),pe.touchedFields=n.touchedFields,re=re||(f.touchedFields||h.touchedFields)&&je!==oe)}re&&ye&&p.state.next(pe)}return re?pe:{}},j=(U,Q,oe,_e)=>{const ye=bt(n.errors,U),re=(f.isValid||h.isValid)&&Pc(Q)&&n.isValid!==Q;if(e.delayError&&oe?(c=x(()=>v(U,oe)),c(e.delayError)):(clearTimeout(u),c=null,oe?gr(n.errors,U,oe):_i(n.errors,U)),(oe?!Tf(ye,oe):ye)||!aa(_e)||re){const he={..._e,...re&&Pc(Q)?{isValid:Q}:{},errors:n.errors,name:U};n={...n,...he},p.state.next(he)}},A=async U=>(g(U,!0),await e.resolver(s,e.context,Kbt(U||l.mount,r,e.criteriaMode,e.shouldUseNativeValidation))),C=async U=>{const{errors:Q}=await A(U);if(g(U),U)for(const oe of U){const _e=bt(Q,oe);_e?gr(n.errors,oe,_e):_i(n.errors,oe)}else n.errors=Q;return Q},k=async(U,Q,oe={valid:!0})=>{for(const _e in U){const ye=U[_e];if(ye){const{_f:re,...he}=ye;if(re){const pe=l.array.has(re.name),je=ye._f&&Ybt(ye._f);je&&f.validatingFields&&g([re.name],!0);const ae=await lQ(ye,l.disabled,s,m,e.shouldUseNativeValidation&&!Q,pe);if(je&&f.validatingFields&&g([re.name]),ae[re.name]&&(oe.valid=!1,Q||t.shouldUseNativeValidation))break;!Q&&(bt(ae,re.name)?pe?twt(n.errors,ae,re.name):gr(n.errors,re.name,ae[re.name]):_i(n.errors,re.name))}!aa(he)&&await k(he,Q,oe)}}return oe.valid},M=()=>{for(const U of l.unMount){const Q=bt(r,U);Q&&(Q._f.refs?Q._f.refs.every(oe=>!XI(oe)):!XI(Q._f.ref))&&ee(U)}l.unMount=new Set},I=(U,Q)=>!e.disabled&&(U&&Q&&gr(s,U,Q),!Tf(q(),i)),R=(U,Q,oe)=>Bbt(U,l,{...a.mount?s:ei(Q)?i:mo(U)?{[U]:Q}:Q},oe,Q),E=U=>r8(bt(a.mount?s:i,U,e.shouldUnregister?bt(i,U,[]):[])),P=(U,Q,oe={})=>{const _e=bt(r,U);let ye=Q;if(_e){const re=_e._f;re&&(!re.disabled&&gr(s,U,rme(Q,re)),ye=_E(re.ref)&&Ra(Q)?"":Q,eme(re.ref)?[...re.ref.options].forEach(he=>he.selected=ye.includes(he.value)):re.refs?aN(re.ref)?re.refs.forEach(he=>{(!he.defaultChecked||!he.disabled)&&(Array.isArray(ye)?he.checked=!!ye.find(pe=>pe===he.value):he.checked=ye===he.value||!!ye)}):re.refs.forEach(he=>he.checked=he.value===ye):s8(re.ref)?re.ref.value="":(re.ref.value=ye,re.ref.type||p.state.next({name:U,values:Bi(s)})))}(oe.shouldDirty||oe.shouldTouch)&&_(U,ye,oe.shouldTouch,oe.shouldDirty,!0),oe.shouldValidate&&F(U)},O=(U,Q,oe)=>{for(const _e in Q){if(!Q.hasOwnProperty(_e))return;const ye=Q[_e],re=U+"."+_e,he=bt(r,re);(l.array.has(U)||Oi(ye)||he&&!he._f)&&!rm(ye)?O(re,ye,oe):P(re,ye,oe)}},L=(U,Q,oe={})=>{const _e=bt(r,U),ye=l.array.has(U),re=Bi(Q);gr(s,U,re),ye?(p.array.next({name:U,values:Bi(s)}),(f.isDirty||f.dirtyFields||h.isDirty||h.dirtyFields)&&oe.shouldDirty&&p.state.next({name:U,dirtyFields:Ux(i,s),isDirty:I(U,re)})):_e&&!_e._f&&!Ra(re)?O(U,re,oe):P(U,re,oe),sQ(U,l)?p.state.next({...n,name:U,values:Bi(s)}):p.state.next({name:a.mount?U:void 0,values:Bi(s)})},T=async U=>{a.mount=!0;const Q=U.target;let oe=Q.name,_e=!0;const ye=bt(r,oe),re=je=>{_e=Number.isNaN(je)||rm(je)&&isNaN(je.getTime())||Tf(je,bt(s,oe,je))},he=rQ(e.mode),pe=rQ(e.reValidateMode);if(ye){let je,ae;const we=Q.type?nQ(ye._f):Ibt(U),Ie=U.type===QX.BLUR||U.type===QX.FOCUS_OUT,Ue=!Xbt(ye._f)&&!e.resolver&&!bt(n.errors,oe)&&!ye._f.deps||Zbt(Ie,bt(n.touchedFields,oe),n.isSubmitted,pe,he),Oe=sQ(oe,l,Ie);gr(s,oe,we),Ie?(!Q||!Q.readOnly)&&(ye._f.onBlur&&ye._f.onBlur(U),c&&c(0)):ye._f.onChange&&ye._f.onChange(U);const ie=_(oe,we,Ie),De=!aa(ie)||Oe;if(!Ie&&p.state.next({name:oe,type:U.type,values:Bi(s)}),Ue)return(f.isValid||h.isValid)&&(e.mode==="onBlur"?Ie&&y():Ie||y()),De&&p.state.next({name:oe,...Oe?{}:ie});if(!Ie&&Oe&&p.state.next({...n}),e.resolver){const{errors:Ve}=await A([oe]);if(g([oe]),re(we),_e){const xe=aQ(n.errors,r,oe),$e=aQ(Ve,r,xe.name||oe);je=$e.error,oe=$e.name,ae=aa(Ve)}}else g([oe],!0),je=(await lQ(ye,l.disabled,s,m,e.shouldUseNativeValidation))[oe],g([oe]),re(we),_e&&(je?ae=!1:(f.isValid||h.isValid)&&(ae=await k(r,!0)));_e&&(ye._f.deps&&(!Array.isArray(ye._f.deps)||ye._f.deps.length>0)&&F(ye._f.deps),j(oe,ae,je,ie))}},D=(U,Q)=>{if(bt(n.errors,Q)&&U.focus)return U.focus(),1},F=async(U,Q={})=>{let oe,_e;const ye=Kw(U);if(e.resolver){const re=await C(ei(U)?U:ye);oe=aa(re),_e=U?!ye.some(he=>bt(re,he)):oe}else U?(_e=(await Promise.all(ye.map(async re=>{const he=bt(r,re);return await k(he&&he._f?{[re]:he}:he)}))).every(Boolean),!(!_e&&!n.isValid)&&y()):_e=oe=await k(r);return p.state.next({...!mo(U)||(f.isValid||h.isValid)&&oe!==n.isValid?{}:{name:U},...e.resolver||!U?{isValid:oe}:{},errors:n.errors}),Q.shouldFocus&&!_e&&Yw(r,D,U?ye:l.mount),_e},q=(U,Q)=>{let oe={...a.mount?s:i};return Q&&(oe=Zpe(Q.dirtyFields?n.dirtyFields:n.touchedFields,oe)),ei(U)?oe:mo(U)?bt(oe,U):U.map(_e=>bt(oe,_e))},B=(U,Q)=>({invalid:!!bt((Q||n).errors,U),isDirty:!!bt((Q||n).dirtyFields,U),error:bt((Q||n).errors,U),isValidating:!!bt(n.validatingFields,U),isTouched:!!bt((Q||n).touchedFields,U)}),z=U=>{U&&Kw(U).forEach(Q=>_i(n.errors,Q)),p.state.next({errors:U?n.errors:{}})},H=(U,Q,oe)=>{const _e=(bt(r,U,{_f:{}})._f||{}).ref,ye=bt(n.errors,U)||{},{ref:re,message:he,type:pe,...je}=ye;gr(n.errors,U,{...je,...Q,ref:_e}),p.state.next({name:U,errors:n.errors,isValid:!1}),oe&&oe.shouldFocus&&_e&&_e.focus&&_e.focus()},W=(U,Q)=>Ql(U)?p.state.subscribe({next:oe=>"values"in oe&&U(R(void 0,Q),oe)}):R(U,Q,!0),G=U=>p.state.subscribe({next:Q=>{Jbt(U.name,Q.name,U.exact)&&Qbt(Q,U.formState||f,Te,U.reRenderRoot)&&U.callback({values:{...s},...n,...Q,defaultValues:i})}}).unsubscribe,K=U=>(a.mount=!0,h={...h,...U.formState},G({...U,formState:{...d,...U.formState}})),ee=(U,Q={})=>{for(const oe of U?Kw(U):l.mount)l.mount.delete(oe),l.array.delete(oe),Q.keepValue||(_i(r,oe),_i(s,oe)),!Q.keepError&&_i(n.errors,oe),!Q.keepDirty&&_i(n.dirtyFields,oe),!Q.keepTouched&&_i(n.touchedFields,oe),!Q.keepIsValidating&&_i(n.validatingFields,oe),!e.shouldUnregister&&!Q.keepDefaultValue&&_i(i,oe);p.state.next({values:Bi(s)}),p.state.next({...n,...Q.keepDirty?{isDirty:I()}:{}}),!Q.keepIsValid&&y()},V=({disabled:U,name:Q})=>{if(Pc(U)&&a.mount||U||l.disabled.has(Q)){const ye=l.disabled.has(Q)!==!!U;U?l.disabled.add(Q):l.disabled.delete(Q),ye&&a.mount&&!a.action&&y()}},J=(U,Q={})=>{let oe=bt(r,U);const _e=Pc(Q.disabled)||Pc(e.disabled);return gr(r,U,{...oe||{},_f:{...oe&&oe._f?oe._f:{ref:{name:U}},name:U,mount:!0,...Q}}),l.mount.add(U),oe?V({disabled:Pc(Q.disabled)?Q.disabled:e.disabled,name:U}
vendor: 2,946 bytes, line 4933
4933):S(U,!0,Q.value),{..._e?{disabled:Q.disabled||e.disabled}:{},...e.progressive?{required:!!Q.required,min:Ib(Q.min),max:Ib(Q.max),minLength:Ib(Q.minLength),maxLength:Ib(Q.maxLength),pattern:Ib(Q.pattern)}:{},name:U,onChange:T,onBlur:T,ref:ye=>{if(ye){J(U,Q),oe=bt(r,U);const re=ei(ye.value)&&ye.querySelectorAll&&ye.querySelectorAll("input,select,textarea")[0]||ye,he=Hbt(re),pe=oe._f.refs||[];if(he?pe.find(je=>je===re):re===oe._f.ref)return;gr(r,U,{_f:{...oe._f,...he?{refs:[...pe.filter(XI),re,...Array.isArray(bt(i,U))?[{}]:[]],ref:{type:re.type,name:U}}:{ref:re}}}),S(U,!1,void 0,re)}else oe=bt(r,U,{}),oe._f&&(oe._f.mount=!1),(e.shouldUnregister||Q.shouldUnregister)&&!(Lbt(l.array,U)&&a.action)&&l.unMount.add(U)}}},Y=()=>e.shouldFocusError&&Yw(r,D,l.mount),$=U=>{Pc(U)&&(p.state.next({disabled:U}),Yw(r,(Q,oe)=>{const _e=bt(r,oe);_e&&(Q.disabled=_e._f.disabled||U,Array.isArray(_e._f.refs)&&_e._f.refs.forEach(ye=>{ye.disabled=_e._f.disabled||U}))},0,!1))},fe=(U,Q)=>async oe=>{let _e;oe&&(oe.preventDefault&&oe.preventDefault(),oe.persist&&oe.persist());let ye=Bi(s);if(p.state.next({isSubmitting:!0}),e.resolver){const{errors:re,values:he}=await A();g(),n.errors=re,ye=Bi(he)}else await k(r);if(l.disabled.size)for(const re of l.disabled)_i(ye,re);if(_i(n.errors,"root"),aa(n.errors)){p.state.next({errors:{}});try{await U(ye,oe)}catch(re){_e=re}}else Q&&await Q({...n.errors},oe),Y(),setTimeout(Y);if(p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:aa(n.errors)&&!_e,submitCount:n.submitCount+1,errors:n.errors}),_e)throw _e},ce=(U,Q={})=>{bt(r,U)&&(ei(Q.defaultValue)?L(U,Bi(bt(i,U))):(L(U,Q.defaultValue),gr(i,U,Bi(Q.defaultValue))),Q.keepTouched||_i(n.touchedFields,U),Q.keepDirty||(_i(n.dirtyFields,U),n.isDirty=Q.defaultValue?I(U,Bi(bt(i,U))):I()),Q.keepError||(_i(n.errors,U),f.isValid&&y()),p.state.next({...n}))},ve=(U,Q={})=>{const oe=U?Bi(U):i,_e=Bi(oe),ye=aa(U),re=ye?i:_e;if(Q.keepDefaultValues||(i=oe),!Q.keepValues){if(Q.keepDirtyValues){const he=new Set([...l.mount,...Object.keys(Ux(i,s))]);for(const pe of Array.from(he)){const je=bt(n.dirtyFields,pe),ae=bt(s,pe),we=bt(re,pe);je&&!ei(ae)?gr(re,pe,ae):!je&&!ei(we)&&L(pe,we)}}else{if(n8&&ei(U))for(const he of l.mount){const pe=bt(r,he);if(pe&&pe._f){const je=Array.isArray(pe._f.refs)?pe._f.refs[0]:pe._f.ref;if(_E(je)){const ae=je.closest("form");if(ae){ae.reset();break}}}}if(Q.keepFieldsRef)for(const he of l.mount)L(he,bt(re,he));else r={}}s=e.shouldUnregister?Q.keepDefaultValues?Bi(i):{}:Bi(re),p.array.next({values:{...re}}),p.state.next({values:{...re}})}l={mount:Q.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},a.mount=!f.isValid||!!Q.keepIsValid||!!Q.keepDirtyValues||!e.shouldUnregister&&!aa(re),a.watch=!!e.shouldUnregister,a.keepIsValid=!!Q.keepIsValid,a.action=!1,Q.keepErrors||(n.errors={}),p.state.next({submitCount:Q.keepSubmitCount?n.submitCount:0,isDirty:ye?!1:Q.
4933keepDirty?n.isDirty:!!(Q.keepDefaultValues&&!Tf(U,i)),isSubmitted:Q.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:ye?{}:Q.keepDirtyValues?Q.keepDefaultValues&&s?Ux(i,s):n.dirtyFields:Q.keepDefaultValues&&U?Ux(i,U):Q.keepDirty?n.dirtyFields:{},touchedFields:Q.keepTouched?n.touchedFields:{},errors:Q.keepErrors?n.errors:{},isSubmitSuccessful:Q.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:i})},X=(U,Q)=>ve(Ql(U)?U(s):U,{...e.resetOptions,...Q}),de=(U,Q={})=>{const oe=bt(r,U),_e=oe&&oe._f;if(_e){const ye=_e.refs?_e.refs[0]:_e.ref;ye.focus&&setTimeout(()=>{ye.focus(),Q.shouldSelect&&Ql(ye.select)&&ye.select()})}},Te=U=>{n={...n,...U}},se={control:{register:J,unregister:ee,getFieldState:B,handleSubmit:fe,setError:H,_subscribe:G,_runSchema:A,_updateIsValidating:g,_focusError:Y,_getWatch:R,_getDirty:I,_setValid:y,_setFieldArray:w,_setDisabledField:V,_setErrors:N,_getFieldArray:E,_reset:ve,_resetDefaultValues:()=>Ql(e.defaultValues)&&e.defaultValues().then(U=>{X(U,e.resetOptions),p.state.next({isLoading:!1})}),_removeUnmounted:M,_disableForm:$,_subjects:p,_proxyFormState:f,get _fields(){return r},get _formValues(){return s},get _state(){return a},set _state(U){a=U},get _defaultValues(){return i},get _names(){return l},set _names(U){l=U},get _formState(){return n},get _options(){return e},set _options(U){e={...e,...U}}},subscribe:K,trigger:F,register:J,handleSubmit:fe,watch:W,setValue:L,getValues:q,reset:X,resetField:ce,clearErrors:z,unregister:ee,setError:H,setFocus:de,getFieldState:B};return{...se,formControl:se}}function o8(t={}){const e=te.useRef(void 0),n=te.useRef(void 0),[r,i]=te.useState({isDirty:!1,isValidating:!1,isLoading:Ql(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,isReady:!1,defaultValues:Ql(t.defaultValues)?void 0:t.defaultValues});if(!e.current)if(t.formControl)e.current={...t.formControl,formState:r},t.defaultValues&&!Ql(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions);else{const{formControl:a,...l}=rwt(t);e.current={...l,formState:r}}const s=e.current.control;return s._options=t,zbt(()=>{const a=s._subscribe({formState:s._proxyFormState,callback:()=>i({...s._formState}),reRenderRoot:!0});return i(l=>({...l,isReady:!0})),s._formState.isReady=!0,a},[s]),te.useEffect(()=>s._disableForm(t.disabled),[s,t.disabled]),te.useEffect(()=>{t.mode&&(s._options.mode=t.mode),t.reValidateMode&&(s._options.reValidateMode=t.reValidateMode)},[s,t.mode,t.reValidateMode]),te.useEffect(()=>{t.errors&&(s._setErrors(t.errors),s._focusError())},[s,t.errors]),te.useEffect(()=>{t.shouldUnregister&&s._subjects.state.next({values:s._getWatch()})},[s,t.shouldUnregister]),te.useEffect(()=>{if(s._proxyFormState.isDirty){const a=s._getDirty();a!==r.isDirty&&s._subjects.state.next({isDirty:a})}},[s,r.isDirty]),te.useEffect(()=>{var a;t.values&&!Tf(t.values,n.current)?(s._reset(t.values,{keepFieldsRef:!0,...s._options.resetOptions}),!((a=s._options.resetOptions)===null||a===void 0)&&a.keepIsValid||s._setValid(),n.current=t.values,i(l=>({...l}))):s._resetDefaultValues()},[s,t.values]),te.useEffect(()=>{s._state.mount||(s._setValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),e.current.formState=te.useMemo(()=>Ubt(r,s),[s,r]),e.current}const cQ=(t,e,n)=>{if(t&&"reportValidity"in t){const r=bt(n,e);t.setCustomValidity(r&&r.message||""),t.reportValidity()}},sme=(t,e)=>{for(const n in e.fields){const r=e.fields[n];r&&r.ref&&"reportValidity"in r.ref?cQ(r.ref,n,t):r.refs&&r.refs.forEach(i=>cQ(i,n,t))}},iwt=(t,e)=>{e.shouldUseNativeValidation&&sme(t,e);const n={};for(const r in t){const i=bt(e.fields,r),s=Object.assign(t[r]||{},{ref:i&&i.ref});if(swt(e.names||Object.keys(t),r)){const a=Object.assign({},bt(n,r));gr(a,"root",s),gr(n,r,a)}else gr(n,r,s)}return n},swt=(t,e)=>t.some(n=>n.startsWith(e+"."));var awt=function(t,e){for(var n={};t.length;){var r=t[0],i=r.code,s=r.message,a=r.path.join(".");if(!n[a])if("unionErrors"in r){var l=r.unionErrors[0].errors[0];n[a]={message:l.message,type:l.code}}else n[a]={message:s,type:i};
vendor: 2,506 bytes, line 4933
4933if("unionErrors"in r&&r.unionErrors.forEach(function(d){return d.errors.forEach(function(f){return t.push(f)})}),e){var c=n[a].types,u=c&&c[r.code];n[a]=Jpe(a,e,n,i,u?[].concat(u,r.message):r.message)}t.shift()}return n},l8=function(t,e,n){return n===void 0&&(n={}),function(r,i,s){try{return Promise.resolve(function(a,l){try{var c=Promise.resolve(t[n.mode==="sync"?"parse":"parseAsync"](r,e)).then(function(u){return s.shouldUseNativeValidation&&sme({},s),{errors:{},values:n.raw?r:u}})}catch(u){return l(u)}return c&&c.then?c.then(void 0,l):c}(0,function(a){if(function(l){return Array.isArray(l==null?void 0:l.errors)}(a))return{values:{},errors:iwt(awt(a.errors,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw a}))}catch(a){return Promise.reject(a)}}},Vn;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,t.arrayToEnum=i=>{const s={};for(const a of i)s[a]=a;return s},t.getValidEnumValues=i=>{const s=t.objectKeys(i).filter(l=>typeof i[i[l]]!="number"),a={};for(const l of s)a[l]=i[l];return t.objectValues(a)},t.objectValues=i=>t.objectKeys(i).map(function(s){return i[s]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const s=[];for(const a in i)Object.prototype.hasOwnProperty.call(i,a)&&s.push(a);return s},t.find=(i,s)=>{for(const a of i)if(s(a))return a},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,s=" | "){return i.map(a=>typeof a=="string"?`'${a}'`:a).join(s)}t.joinValues=r,t.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(Vn||(Vn={}));var uQ;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(uQ||(uQ={}));const wt=Vn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),wf=t=>{switch(typeof t){case"undefined":return wt.undefined;case"string":return wt.string;case"number":return Number.isNaN(t)?wt.nan:wt.number;case"boolean":return wt.boolean;case"function":return wt.function;case"bigint":return wt.bigint;case"symbol":return wt.symbol;case"object":return Array.isArray(t)?wt.array:t===null?wt.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?wt.promise:typeof Map<"u"&&t instanceof Map?wt.map:typeof Set<"u"&&t instanceof Set?wt.set:typeof Date<"u"&&t instanceof Date?wt.date:wt.object;default:return wt.unknown}}
vendor: 4,379 bytes, line 4933
4933,nt=Vn.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Od 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 n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(s){return s.message},r={_errors:[]},i=s=>{for(const a of s.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)r._errors.push(n(a));else{let l=r,c=0;for(;c<a.path.length;){const u=a.path[c];c===a.path.length-1?(l[u]=l[u]||{_errors:[]},l[u]._errors.push(n(a))):l[u]=l[u]||{_errors:[]},l=l[u],c++}}};return i(this),r}static assert(e){if(!(e instanceof Od))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Vn.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const i of this.issues)if(i.path.length>0){const s=i.path[0];n[s]=n[s]||[],n[s].push(e(i))}else r.push(e(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Od.create=t=>new Od(t);const A5=(t,e)=>{let n;switch(t.code){case nt.invalid_type:t.received===wt.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case nt.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,Vn.jsonStringifyReplacer)}`;break;case nt.unrecognized_keys:n=`Unrecognized key(s) in object: ${Vn.joinValues(t.keys,", ")}`;break;case nt.invalid_union:n="Invalid input";break;case nt.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Vn.joinValues(t.options)}`;break;case nt.invalid_enum_value:n=`Invalid enum value. Expected ${Vn.joinValues(t.options)}, received '${t.received}'`;break;case nt.invalid_arguments:n="Invalid function arguments";break;case nt.invalid_return_type:n="Invalid function return type";break;case nt.invalid_date:n="Invalid date";break;case nt.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:Vn.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case nt.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case nt.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case nt.custom:n="Invalid input";break;
vendor: 5,147 bytes, line 4933
4933case nt.invalid_intersection_types:n="Intersection results could not be merged";break;case nt.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case nt.not_finite:n="Number must be finite";break;default:n=e.defaultError,Vn.assertNever(t)}return{message:n}};let owt=A5;function lwt(){return owt}const cwt=t=>{const{data:e,path:n,errorMaps:r,issueData:i}=t,s=[...n,...i.path||[]],a={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let l="";const c=r.filter(u=>!!u).slice().reverse();for(const u of c)l=u(a,{data:e,defaultError:l}).message;return{...i,path:s,message:l}};function dt(t,e){const n=lwt(),r=cwt({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===A5?void 0:A5].filter(i=>!!i)});t.common.issues.push(r)}class Oo{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const i of n){if(i.status==="aborted")return ln;i.status==="dirty"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const i of n){const s=await i.key,a=await i.value;r.push({key:s,value:a})}return Oo.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const i of n){const{key:s,value:a}=i;if(s.status==="aborted"||a.status==="aborted")return ln;s.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof a.value<"u"||i.alwaysSet)&&(r[s.value]=a.value)}return{status:e.value,value:r}}}const ln=Object.freeze({status:"aborted"}),xw=t=>({status:"dirty",value:t}),jl=t=>({status:"valid",value:t}),dQ=t=>t.status==="aborted",fQ=t=>t.status==="dirty",Kv=t=>t.status==="valid",NE=t=>typeof Promise<"u"&&t instanceof Promise;var jt;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(jt||(jt={}));class Fh{constructor(e,n,r,i){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=i}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 hQ=(t,e)=>{if(Kv(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Od(t.common.issues);return this._error=n,this._error}}};function jn(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:i}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(a,l)=>{const{message:c}=t;return a.code==="invalid_enum_value"?{message:c??l.defaultError}:typeof l.data>"u"?{message:c??r??l.defaultError}:a.code!=="invalid_type"?{message:l.defaultError}:{message:c??n??l.defaultError}},description:i}}class $n{get description(){return this._def.description}_getType(e){return wf(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:wf(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Oo,ctx:{common:e.parent.common,data:e.data,parsedType:wf(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(NE(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:wf(e)},i=this._parseSync({data:e,path:r.path,parent:r});return hQ(r,i)}"~validate"(e){var r,i;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:wf(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:n});return Kv(s)?{value:s.value}:{issues:n.common.issues}}catch(s){(i=(r=s==null?void 0:s.message)==null?void 0:r.toLowerCase())!=null&&i.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(s=>Kv(s)?{value:s.value}:{issues:n.common.issues})}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:wf(e)},i=this._parse({data:e,path:r.path,parent:r}),s=await(NE(i)?i:Promise.resolve(i));return hQ(r,s)}refine(e,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,s)=>{const a=e(i),l=()=>s.addIssue({code:nt.custom,...r(i)});
vendor: 6,120 bytes, line 4933
4933return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(l(),!1)):a?!0:(l(),!1)})}refinement(e,n){return this._refinement((r,i)=>e(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(e){return new Xv({schema:this,typeName:cn.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:n=>this["~validate"](n)}}optional(){return yh.create(this,this._def)}nullable(){return Qv.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return eu.create(this)}promise(){return EE.create(this,this._def)}or(e){return CE.create([this,e],this._def)}and(e){return kE.create(this,e,this._def)}transform(e){return new Xv({...jn(this._def),schema:this,typeName:cn.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new M5({...jn(this._def),innerType:this,defaultValue:n,typeName:cn.ZodDefault})}brand(){return new Pwt({typeName:cn.ZodBranded,type:this,...jn(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new P5({...jn(this._def),innerType:this,catchValue:n,typeName:cn.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return c8.create(this,e)}readonly(){return O5.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const uwt=/^c[^\s-]{8,}$/i,dwt=/^[0-9a-z]+$/,fwt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,hwt=/^[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,pwt=/^[a-z0-9_-]{21}$/i,mwt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,gwt=/^[-+]?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)?)??$/,xwt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ywt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let QI;const vwt=/^(?:(?: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])$/,bwt=/^(?:(?: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])$/,wwt=/^(([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]))$/,_wt=/^(([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])$/,Swt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Nwt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ame="((\\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])))",jwt=new RegExp(`^${ame}$`);function ome(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function Cwt(t){return new RegExp(`^${ome(t)}$`)}function kwt(t){let e=`${ame}T${ome(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function Ewt(t,e){return!!((e==="v4"||!e)&&vwt.test(t)||(e==="v6"||!e)&&wwt.test(t))}function Awt(t,e){if(!mwt.test(t))return!1;try{const[n]=t.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||"typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function Twt(t,e){return!!((e==="v4"||!e)&&bwt.test(t)||(e==="v6"||!e)&&_wt.test(t))}class Xf extends $n{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==wt.string){const s=this._getOrReturnCtx(e);
vendor: 17,372 bytes, line 4933
4933return dt(s,{code:nt.invalid_type,expected:wt.string,received:s.parsedType}),ln}const r=new Oo;let i;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(i=this._getOrReturnCtx(e,i),dt(i,{code:nt.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")e.data.length>s.value&&(i=this._getOrReturnCtx(e,i),dt(i,{code:nt.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const a=e.data.length>s.value,l=e.data.length<s.value;(a||l)&&(i=this._getOrReturnCtx(e,i),a?dt(i,{code:nt.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):l&&dt(i,{code:nt.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")xwt.test(e.data)||(i=this._getOrReturnCtx(e,i),dt(i,{validation:"email",code:nt.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")QI||(QI=new RegExp(ywt,"u")),QI.test(e.data)||(i=this._getOrReturnCtx(e,i),dt(i,{validation:"emoji",code:nt.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")hwt.test(e.data)||(i=this._getOrReturnCtx(e,i),dt(i,{validation:"uuid",code:nt.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")pwt.test(e.data)||(i=this._getOrReturnCtx(e,i),dt(i,{validation:"nanoid",code:nt.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")uwt.test(e.data)||(i=this._getOrReturnCtx(e,i),dt(i,{validation:"cuid",code:nt.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")dwt.test(e.data)||(i=this._getOrReturnCtx(e,i),dt(i,{validation:"cuid2",code:nt.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")fwt.test(e.data)||(i=this._getOrReturnCtx(e,i),dt(i,{validation:"ulid",code:nt.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),dt(i,{validation:"url",code:nt.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),dt(i,{validation:"regex",code:nt.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(e,i),dt(i,{code:nt.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(i=this._getOrReturnCtx(e,i),dt(i,{code:nt.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(i=this._getOrReturnCtx(e,i),dt(i,{code:nt.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?kwt(s).test(e.data)||(i=this._getOrReturnCtx(e,i),dt(i,{code:nt.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?jwt.test(e.data)||(i=this._getOrReturnCtx(e,i),dt(i,{code:nt.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?Cwt(s).test(e.data)||(i=this._getOrReturnCtx(e,i),dt(i,{code:nt.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?gwt.test(e.data)||(i=this._getOrReturnCtx(e,i),dt(i,{validation:"duration",code:nt.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?Ewt(e.data,s.version)||(i=this._getOrReturnCtx(e,i),dt(i,{validation:"ip",code:nt.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?Awt(e.data,s.alg)||(i=this._getOrReturnCtx(e,i),dt(i,{validation:"jwt",code:nt.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?Twt(e.data,s.version)||(i=this._getOrReturnCtx(e,i),dt(i,{validation:"cidr",code:nt.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?Swt.test(e.data)||(i=this._getOrReturnCtx(e,i),dt(i,{validation:"base64",code:nt.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?Nwt.test(e.data)||(i=this._getOrReturnCtx(e,i),dt(i,{validation:"base64url",code:nt.invalid_string,message:s.message}),r.dirty()):Vn.assertNever(s);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(i=>e.test(i),{validation:n,code:nt.invalid_string,...jt.errToObj(r)})}_addCheck(e){return new Xf({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...jt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...jt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...jt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...jt.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...jt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...jt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...jt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...jt.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...jt.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...jt.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...jt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...jt.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...jt.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,...jt.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,...jt.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...jt.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...jt.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...jt.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...jt.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...jt.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...jt.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...jt.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...jt.errToObj(n)})}nonempty(e){return this.min(1,jt.errToObj(e))}trim(){return new Xf({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Xf({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Xf({...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 n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}Xf.create=t=>new Xf({checks:[],typeName:cn.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...jn(t)});function Mwt(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,i=n>r?n:r,s=Number.parseInt(t.toFixed(i).replace(".","")),a=Number.parseInt(e.toFixed(i).replace(".",""));return s%a/10**i}class I_ extends $n{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)!==wt.number){const s=this._getOrReturnCtx(e);return dt(s,{code:nt.invalid_type,expected:wt.number,received:s.parsedType}),ln}let r;const i=new Oo;for(const s of this._def.checks)s.kind==="int"?Vn.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),dt(r,{code:nt.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),dt(r,{code:nt.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),dt(r,{code:nt.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?Mwt(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),dt(r,{code:nt.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),dt(r,{code:nt.not_finite,message:s.message}),i.dirty()):Vn.assertNever(s);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,jt.toString(n))}gt(e,n){return this.setLimit("min",e,!1,jt.toString(n))}lte(e,n){return this.setLimit("max",e,!0,jt.toString(n))}lt(e,n){return this.setLimit("max",e,!1,jt.toString(n))}setLimit(e,n,r,i){return new I_({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:jt.toString(i)}]})}_addCheck(e){return new I_({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:jt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:jt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:jt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:jt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:jt.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:jt.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:jt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:jt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:jt.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Vn.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}}I_.create=t=>new I_({checks:[],typeName:cn.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...jn(t)});class D_ extends $n{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)!==wt.bigint)return this._getInvalidInput(e);let r;const i=new Oo;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),dt(r,{code:nt.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),dt(r,{code:nt.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),dt(r,{code:nt.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):Vn.assertNever(s);return{status:i.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return dt(n,{code:nt.invalid_type,expected:wt.bigint,received:n.parsedType}),ln}gte(e,n){return this.setLimit("min",e,!0,jt.toString(n))}gt(e,n){return this.setLimit("min",e,!1,jt.toString(n))}lte(e,n){return this.setLimit("max",e,!0,jt.toString(n))}lt(e,n){return this.setLimit("max",e,!1,jt.toString(n))}setLimit(e,n,r,i){return new D_({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:jt.toString(i)}]})}_addCheck(e){return new D_({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:jt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:jt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:jt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:jt.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:jt.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}D_.create=t=>new D_({checks:[],typeName:cn.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...jn(t)});class pQ extends $n{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==wt.boolean){const r=this._getOrReturnCtx(e);return dt(r,{code:nt.invalid_type,expected:wt.boolean,received:r.parsedType}),ln}return jl(e.data)}}pQ.create=t=>new pQ({typeName:cn.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...jn(t)});class jE extends $n{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==wt.date){const s=this._getOrReturnCtx(e);return dt(s,{code:nt.invalid_type,expected:wt.date,received:s.parsedType}),ln}if(Number.isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return dt(s,{code:nt.invalid_date}),ln}const r=new Oo;let i;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(i=this._getOrReturnCtx(e,i),dt(i,{code:nt.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(i=this._getOrReturnCtx(e,i),dt(i,{code:nt.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):Vn.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new jE({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:jt.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:jt.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}jE.create=t=>new jE({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:cn.ZodDate,...jn(t)});class mQ extends $n{_parse(e){if(this._getType(e)!==wt.symbol){const r=this._getOrReturnCtx(e);return dt(r,{code:nt.invalid_type,expected:wt.symbol,received:r.parsedType}),ln}return jl(e.data)}}mQ.create=t=>new mQ({typeName:cn.ZodSymbol,...jn(t)});class gQ extends $n{_parse(e){if(this._getType(e)!==wt.undefined){const r=this._getOrReturnCtx(e);return dt(r,{code:nt.invalid_type,expected:wt.undefined,received:r.parsedType}),ln}return jl(e.data)}}gQ.create=t=>new gQ({typeName:cn.ZodUndefined,...jn(t)});class xQ extends $n{_parse(e){if(this._getType(e)!==wt.null){const r=this._getOrReturnCtx(e);return dt(r,{code:nt.invalid_type,expected:wt.null,received:r.parsedType}),ln}return jl(e.data)}}xQ.create=t=>new xQ({typeName:cn.ZodNull,...jn(t)});class yQ extends $n{constructor(){super(...arguments),this._any=!0}_parse(e){return jl(e.data)}}yQ.create=t=>new yQ({typeName:cn.ZodAny,...jn(t)});class vQ extends $n{constructor(){super(...arguments),this._unknown=!0}_parse(e){return jl(e.data)}}vQ.create=t=>new vQ({typeName:cn.ZodUnknown,...jn(t)});class Uh extends $n{_parse(e){const n=this._getOrReturnCtx(e);return dt(n,{code:nt.invalid_type,expected:wt.never,received:n.parsedType}),ln}}Uh.create=t=>new Uh({typeName:cn.ZodNever,...jn(t)});class bQ extends $n{_parse(e){if(this._getType(e)!==wt.undefined){const r=this._getOrReturnCtx(e);return dt(r,{code:nt.invalid_type,expected:wt.void,received:r.parsedType}),ln}return jl(e.data)}}bQ.create=t=>new bQ({typeName:cn.ZodVoid,...jn(t)});class eu extends $n{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),i=this._def;
vendor: 5,495 bytes, line 4933
4933if(n.parsedType!==wt.array)return dt(n,{code:nt.invalid_type,expected:wt.array,received:n.parsedType}),ln;if(i.exactLength!==null){const a=n.data.length>i.exactLength.value,l=n.data.length<i.exactLength.value;(a||l)&&(dt(n,{code:a?nt.too_big:nt.too_small,minimum:l?i.exactLength.value:void 0,maximum:a?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(dt(n,{code:nt.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(dt(n,{code:nt.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((a,l)=>i.type._parseAsync(new Fh(n,a,n.path,l)))).then(a=>Oo.mergeArray(r,a));const s=[...n.data].map((a,l)=>i.type._parseSync(new Fh(n,a,n.path,l)));return Oo.mergeArray(r,s)}get element(){return this._def.type}min(e,n){return new eu({...this._def,minLength:{value:e,message:jt.toString(n)}})}max(e,n){return new eu({...this._def,maxLength:{value:e,message:jt.toString(n)}})}length(e,n){return new eu({...this._def,exactLength:{value:e,message:jt.toString(n)}})}nonempty(e){return this.min(1,e)}}eu.create=(t,e)=>new eu({type:t,minLength:null,maxLength:null,exactLength:null,typeName:cn.ZodArray,...jn(e)});function zx(t){if(t instanceof Ci){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=yh.create(zx(r))}return new Ci({...t._def,shape:()=>e})}else return t instanceof eu?new eu({...t._def,type:zx(t.element)}):t instanceof yh?yh.create(zx(t.unwrap())):t instanceof Qv?Qv.create(zx(t.unwrap())):t instanceof tg?tg.create(t.items.map(e=>zx(e))):t}class Ci extends $n{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(),n=Vn.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==wt.object){const u=this._getOrReturnCtx(e);return dt(u,{code:nt.invalid_type,expected:wt.object,received:u.parsedType}),ln}const{status:r,ctx:i}=this._processInputParams(e),{shape:s,keys:a}=this._getCached(),l=[];if(!(this._def.catchall instanceof Uh&&this._def.unknownKeys==="strip"))for(const u in i.data)a.includes(u)||l.push(u);const c=[];for(const u of a){const d=s[u],f=i.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new Fh(i,f,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof Uh){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of l)c.push({key:{status:"valid",value:d},value:{status:"valid",value:i.data[d]}});else if(u==="strict")l.length>0&&(dt(i,{code:nt.unrecognized_keys,keys:l}),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 l){const f=i.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new Fh(i,f,i.path,d)),alwaysSet:d in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of c){const f=await d.key,h=await d.value;u.push({key:f,value:h,alwaysSet:d.alwaysSet})}return u}).then(u=>Oo.mergeObjectSync(r,u)):Oo.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(e){return jt.errToObj,new Ci({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var s,a;const i=((a=(s=this._def).errorMap)==null?void 0:a.call(s,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:jt.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new Ci({...this._def,unknownKeys:"strip"})}passthrough(){return new Ci({...this._def,unknownKeys:"passthrough"})}extend(e){return new Ci({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Ci({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:cn.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new Ci({...this._def,catchall:e})}pick(e){const n={};for(const r of Vn.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new Ci({...this._def,shape:()=>n})}omit(e){const n={};for(const r of Vn.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new Ci({...this._def,shape:()=>n})}deepPartial(){return zx(this)}partial(e){const n={};for(const r of Vn.objectKeys(this.shape)){const i=this.shape[r];e&&!e[r]?n[r]=i:n[r]=i.optional()}return new Ci({...this._def,shape:()=>n})}required(e){const n={};for(const r of Vn.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof yh;)s=s._def.innerType;n[r]=s}return new Ci({...this._def,shape:()=>n})}keyof(){return lme(Vn.objectKeys(this.shape))}}Ci.create=(t,e)=>new Ci({shape:()=>t,unknownKeys:"strip",catchall:Uh.create(),typeName:cn.ZodObject,...jn(e)});Ci.strictCreate=(t,e)=>new Ci({shape:()=>t,unknownKeys:"strict",catchall:Uh.create(),typeName:cn.ZodObject,...jn(e)});Ci.lazycreate=(t,e)=>new Ci({shape:t,unknownKeys:"strip",catchall:Uh.create(),typeName:cn.ZodObject,...jn(e)});class CE extends $n{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function i(s){for(const l of s)if(l.result.status==="valid")return l.result;for(const l of s)if(l.result.status==="dirty")return n.common.issues.push(...l.ctx.common.issues),l.result;const a=s.map(l=>new Od(l.ctx.common.issues));
vendor: 3,344 bytes, line 4933
4933return dt(n,{code:nt.invalid_union,unionErrors:a}),ln}if(n.common.async)return Promise.all(r.map(async s=>{const a={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(i);{let s;const a=[];for(const c of r){const u={...n,common:{...n.common,issues:[]},parent:null},d=c._parseSync({data:n.data,path:n.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!s&&(s={result:d,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const l=a.map(c=>new Od(c));return dt(n,{code:nt.invalid_union,unionErrors:l}),ln}}get options(){return this._def.options}}CE.create=(t,e)=>new CE({options:t,typeName:cn.ZodUnion,...jn(e)});function T5(t,e){const n=wf(t),r=wf(e);if(t===e)return{valid:!0,data:t};if(n===wt.object&&r===wt.object){const i=Vn.objectKeys(e),s=Vn.objectKeys(t).filter(l=>i.indexOf(l)!==-1),a={...t,...e};for(const l of s){const c=T5(t[l],e[l]);if(!c.valid)return{valid:!1};a[l]=c.data}return{valid:!0,data:a}}else if(n===wt.array&&r===wt.array){if(t.length!==e.length)return{valid:!1};const i=[];for(let s=0;s<t.length;s++){const a=t[s],l=e[s],c=T5(a,l);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return n===wt.date&&r===wt.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class kE extends $n{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),i=(s,a)=>{if(dQ(s)||dQ(a))return ln;const l=T5(s.value,a.value);return l.valid?((fQ(s)||fQ(a))&&n.dirty(),{status:n.value,value:l.data}):(dt(r,{code:nt.invalid_intersection_types}),ln)};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(([s,a])=>i(s,a)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}kE.create=(t,e,n)=>new kE({left:t,right:e,typeName:cn.ZodIntersection,...jn(n)});class tg extends $n{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==wt.array)return dt(r,{code:nt.invalid_type,expected:wt.array,received:r.parsedType}),ln;if(r.data.length<this._def.items.length)return dt(r,{code:nt.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ln;!this._def.rest&&r.data.length>this._def.items.length&&(dt(r,{code:nt.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((a,l)=>{const c=this._def.items[l]||this._def.rest;return c?c._parse(new Fh(r,a,r.path,l)):null}).filter(a=>!!a);return r.common.async?Promise.all(s).then(a=>Oo.mergeArray(n,a)):Oo.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new tg({...this._def,rest:e})}}tg.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new tg({items:t,typeName:cn.ZodTuple,rest:null,...jn(e)})};class wQ extends $n{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==wt.map)return dt(r,{code:nt.invalid_type,expected:wt.map,received:r.parsedType}),ln;const i=this._def.keyType,s=this._def.valueType,a=[...r.data.entries()].map(([l,c],u)=>
vendor: 4,126 bytes, line 4933
4933({key:i._parse(new Fh(r,l,r.path,[u,"key"])),value:s._parse(new Fh(r,c,r.path,[u,"value"]))}));if(r.common.async){const l=new Map;return Promise.resolve().then(async()=>{for(const c of a){const u=await c.key,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return ln;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),l.set(u.value,d.value)}return{status:n.value,value:l}})}else{const l=new Map;for(const c of a){const u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return ln;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),l.set(u.value,d.value)}return{status:n.value,value:l}}}}wQ.create=(t,e,n)=>new wQ({valueType:e,keyType:t,typeName:cn.ZodMap,...jn(n)});class L_ extends $n{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==wt.set)return dt(r,{code:nt.invalid_type,expected:wt.set,received:r.parsedType}),ln;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(dt(r,{code:nt.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(dt(r,{code:nt.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const s=this._def.valueType;function a(c){const u=new Set;for(const d of c){if(d.status==="aborted")return ln;d.status==="dirty"&&n.dirty(),u.add(d.value)}return{status:n.value,value:u}}const l=[...r.data.values()].map((c,u)=>s._parse(new Fh(r,c,r.path,u)));return r.common.async?Promise.all(l).then(c=>a(c)):a(l)}min(e,n){return new L_({...this._def,minSize:{value:e,message:jt.toString(n)}})}max(e,n){return new L_({...this._def,maxSize:{value:e,message:jt.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}L_.create=(t,e)=>new L_({valueType:t,minSize:null,maxSize:null,typeName:cn.ZodSet,...jn(e)});class _Q extends $n{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}_Q.create=(t,e)=>new _Q({getter:t,typeName:cn.ZodLazy,...jn(e)});class SQ extends $n{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return dt(n,{received:n.data,code:nt.invalid_literal,expected:this._def.value}),ln}return{status:"valid",value:e.data}}get value(){return this._def.value}}SQ.create=(t,e)=>new SQ({value:t,typeName:cn.ZodLiteral,...jn(e)});function lme(t,e){return new Yv({values:t,typeName:cn.ZodEnum,...jn(e)})}class Yv extends $n{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return dt(n,{expected:Vn.joinValues(r),received:n.parsedType,code:nt.invalid_type}),ln}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return dt(n,{received:n.data,code:nt.invalid_enum_value,options:r}),ln}return jl(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return Yv.create(e,{...this._def,...n})}exclude(e,n=this._def){return Yv.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}Yv.create=lme;class NQ extends $n{_parse(e){const n=Vn.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==wt.string&&r.parsedType!==wt.number){const i=Vn.objectValues(n);return dt(r,{expected:Vn.joinValues(i),received:r.parsedType,code:nt.invalid_type}),ln}if(this._cache||(this._cache=new Set(Vn.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const i=Vn.objectValues(n);return dt(r,{received:r.data,code:nt.invalid_enum_value,options:i}),ln}return jl(e.data)}get enum(){return this._def.values}}NQ.create=(t,e)=>new NQ({values:t,typeName:cn.ZodNativeEnum,...jn(e)});class EE extends $n{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==wt.promise&&n.common.async===!1)return dt(n,{code:nt.invali
vendor: 3,983 bytes, line 4933
4933d_type,expected:wt.promise,received:n.parsedType}),ln;const r=n.parsedType===wt.promise?n.data:Promise.resolve(n.data);return jl(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}EE.create=(t,e)=>new EE({type:t,typeName:cn.ZodPromise,...jn(e)});class Xv extends $n{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===cn.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),i=this._def.effect||null,s={addIssue:a=>{dt(r,a),a.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){const a=i.transform(r.data,s);if(r.common.async)return Promise.resolve(a).then(async l=>{if(n.value==="aborted")return ln;const c=await this._def.schema._parseAsync({data:l,path:r.path,parent:r});return c.status==="aborted"?ln:c.status==="dirty"||n.value==="dirty"?xw(c.value):c});{if(n.value==="aborted")return ln;const l=this._def.schema._parseSync({data:a,path:r.path,parent:r});return l.status==="aborted"?ln:l.status==="dirty"||n.value==="dirty"?xw(l.value):l}}if(i.type==="refinement"){const a=l=>{const c=i.refinement(l,s);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l};if(r.common.async===!1){const l=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return l.status==="aborted"?ln:(l.status==="dirty"&&n.dirty(),a(l.value),{status:n.value,value:l.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(l=>l.status==="aborted"?ln:(l.status==="dirty"&&n.dirty(),a(l.value).then(()=>({status:n.value,value:l.value}))))}if(i.type==="transform")if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Kv(a))return ln;const l=i.transform(a.value,s);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:l}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>Kv(a)?Promise.resolve(i.transform(a.value,s)).then(l=>({status:n.value,value:l})):ln);Vn.assertNever(i)}}Xv.create=(t,e,n)=>new Xv({schema:t,typeName:cn.ZodEffects,effect:e,...jn(n)});Xv.createWithPreprocess=(t,e,n)=>new Xv({schema:e,effect:{type:"preprocess",transform:t},typeName:cn.ZodEffects,...jn(n)});class yh extends $n{_parse(e){return this._getType(e)===wt.undefined?jl(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}yh.create=(t,e)=>new yh({innerType:t,typeName:cn.ZodOptional,...jn(e)});class Qv extends $n{_parse(e){return this._getType(e)===wt.null?jl(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Qv.create=(t,e)=>new Qv({innerType:t,typeName:cn.ZodNullable,...jn(e)});class M5 extends $n{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===wt.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}M5.create=(t,e)=>new M5({innerType:t,typeName:cn.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...jn(e)});class P5 extends $n{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return NE(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Od(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Od(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}P5.create=(t,e)=>new P5({innerType:t,typeName:cn.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...jn(e)});
4933class jQ extends $n{_parse(e){if(this._getType(e)!==wt.nan){const r=this._getOrReturnCtx(e);return dt(r,{code:nt.invalid_type,expected:wt.nan,received:r.parsedType}),ln}return{status:"valid",value:e.data}}}jQ.create=t=>new jQ({typeName:cn.ZodNaN,...jn(t)});class Pwt extends $n{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class c8 extends $n{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?ln:s.status==="dirty"?(n.dirty(),xw(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?ln:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,n){return new c8({in:e,out:n,typeName:cn.ZodPipeline})}}class O5 extends $n{_parse(e){const n=this._def.innerType._parse(e),r=i=>(Kv(i)&&(i.value=Object.freeze(i.value)),i);return NE(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}O5.create=(t,e)=>new O5({innerType:t,typeName:cn.ZodReadonly,...jn(e)});var cn;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(cn||(cn={}));const Iy=Xf.create;Uh.create;eu.create;const u8=Ci.create;CE.create;kE.create;tg.create;Yv.create;EE.create;yh.create;Qv.create;const Owt=u8({email:Iy().email("Invalid email address"),password:Iy().min(1,"Password is required")});function Rwt({className:t}){return o.jsxs("svg",{className:t,viewBox:"0 0 24 24",children:[o.jsx("path",{fill:"currentColor",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),o.jsx("path",{fill:"currentColor",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),o.jsx("path",{fill:"currentColor",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),o.jsx("path",{fill:"currentColor",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})]})}function CQ(){const t=Nr(),{login:e,signInWithGoogle:n,isLoading:r}=Rr(),{register:i,handleSubmit:s,formState:{errors:a}}=o8({resolver:l8(Owt)}),l=async u=>{try{await e(u.email,u.password),ge.success("Welcome back!"),t("/dashboard")}catch(d){ge.error(d.message||"Failed to sign in")}},c=async()=>{try{await n()}catch(u){ge.error(u.message||"Failed to sign in with Google")}};return o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Sign In",noIndex:!0}),o.jsxs(Dt,{className:"border-border/50",children:[o.jsxs(Zt,{className:"text-center",children:[o.jsx(tn,{children:"Welcome back"}),o.jsx(Kn,{children:"Sign in to your account to continue"})]}),o.jsxs(Vt,{children:[o.jsxs(le,{variant:"outline",className:"w-full mb-6",onClick:c,disabled:r,children:[o.jsx(Rwt,{className:"h-4 w-4"}),"Continue with Google"]}),o.jsxs("div",{className:"relative mb-6",children:[o.jsx("div",{className:"absolute inset-0 flex items-center",children:o.jsx("span",{className:"w-full border-t"})}),o.jsx("div",{className:"relative flex justify-center text-xs",children:o.jsx("span",{className:"bg-card px-2 text-muted-foreground",children:"Or continue with"})})]}),o.jsxs("form",{onSubmit:s(l),className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{htmlFor:"email",children:"Email"}),o.jsx(gt,{id:"email",type:"email",placeholder:"[email protected]",...i("email")}),a.email&&o.jsx("p",{className:"text-sm text-destructive",children:a.email.message})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(et,{htmlFor:"password",children:"Password"}),o.jsx(Mt,{to:"/forgot-password",className:"text-sm text-primary hover:underline",children:"Forgot password?"})]}),o.jsx(gt,{id:"password",type:"password",...i("password")}),a.password&&o.jsx("p",{className:"text-sm text-destructive",children:a.password.message})]}),o.jsx(le,{type:"submit",className:"w-full",disabled:r,children:r?"Signing in...":"Sign in"})]}),o.jsxs("div",{className:"mt-6 text-center text-sm",children:["Don't have an account?"," ",o.jsx(Mt,{to:"/signup",className:"text-primary hover:underline",children:"Sign up"})]})]})]})]})}const Iwt=u8({fullName:Iy().min(2,"Name must be at least 2 characters"),email:Iy().email("Invalid email address"),password:Iy().min(8,"Password must be at least 8 characters")});function Dwt({className:t}){return o.jsxs("svg",{className:t,viewBox:"0 0 24 24",children:[o.jsx("path",{fill:"currentColor",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),o.jsx("path",{fill:"currentColor",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),o.jsx("path",{fill:"currentColor",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),o.jsx("path",{fill:"currentColor",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})]})}function kQ(){const[t,e]=b.useState(!1),[n,r]=b.useState(""),[i,s]=b.useState(null),[a,l]=b.useState(!0),{signup:c,signInWithGoogle:u,isLoading:d}=Rr(),{register:f,handleSubmit:h,formState:{errors:p}}=o8({resolver:l8(Iwt)});b.useEffect(()=>{(async()=>{try{const g=await Ce.get("/public/settings/registration");s(g.enabled)}catch{s(!0)}finally{l(!1)}})()},[]);const m=async y=>{try{await c(y.email,y.password,y.fullName),r(y.email),e(!0),ge.success("Account created! Please check your email to verify.")}catch(g){ge.error(g.message||"Failed to create account")}},x=async()=>{try{await u()}catch(y){ge.error(y.message||"Failed to sign up with Google")}};return a?o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Sign Up",noIndex:!0}),o.jsx(Dt,{className:"border-border/50",children:o.jsx(Vt,{className:"flex items-center justify-center py-12",children:o.jsx(Me,{className:"h-8 w-8 animate-spin text-primary"})})})]}):i?t?o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Verify Email",noIndex:!0}),o.jsxs(Dt,{className:"border-border/50",children:[o.jsxs(Zt,{className:"text-center",children:[o.jsx(tn,{children:"Almost done"}),o.jsx(Kn,{children:"We've sent a verification link."})]}),o.jsxs(Vt,{className:"space-y-4 text-center",children:[o.jsx("p",{className:"font-medium text-foreground",children:n}),o.jsx("div",{className:"rounded-lg bg-muted/50 p-4",children:o.jsxs("div",{className:"text-sm text-muted-foreground",children:[o.jsx("p",{children:"Click the link in your email to verify your account."}),o.jsx("p",{className:"mt-1",children:"Once verified, you can sign in to your account."})]})}),o.jsx("div",{className:"pt-4",children:o.jsx(Mt,{to:"/login",children:o.jsx(le,{variant:"outline",className:"w-full",children:"Back to Sign in"})})})]})]})]}):o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Sign Up",noIndex:!0}),o.jsxs(Dt,{className:"border-border/50",children:[o.jsxs(Zt,{className:"text-center",children:[o.jsx(tn,{children:"Create an account"}),o.jsx(Kn,{children:"Start tracking your brand across AI assistants"})]}),o.jsxs(Vt,{children:[o.jsxs(le,{variant:"outline",className:"w-full mb-6",onClick:x,disabled:d,children:[o.jsx(Dwt,{className:"h-4 w-4"}),"Continue with Google"]}),o.jsxs("div",{className:"relative mb-6",children:[o.jsx("div",{className:"absolute inset-0 flex items-center",children:o.jsx("span",{className:"w-full border-t"})}),o.jsx("div",{className:"relative flex justify-center text-xs",children:o.jsx("span",{className:"bg-card px-2 text-muted-foreground",children:"Or continue with"})})]}),o.jsxs("form",{onSubmit:h(m),className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{htmlFor:"fullName",children:"Full Name"}),o.jsx(gt,{id:"fullName",placeholder:"John Doe",...f("fullName")}
4933),p.fullName&&o.jsx("p",{className:"text-sm text-destructive",children:p.fullName.message})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{htmlFor:"email",children:"Email"}),o.jsx(gt,{id:"email",type:"email",placeholder:"[email protected]",...f("email")}),p.email&&o.jsx("p",{className:"text-sm text-destructive",children:p.email.message})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{htmlFor:"password",children:"Password"}),o.jsx(gt,{id:"password",type:"password",...f("password")}),p.password&&o.jsx("p",{className:"text-sm text-destructive",children:p.password.message})]}),o.jsx(le,{type:"submit",className:"w-full",disabled:d,children:d?"Creating account...":"Create account"})]}),o.jsxs("div",{className:"mt-6 text-center text-sm",children:["Already have an account?"," ",o.jsx(Mt,{to:"/login",className:"text-primary hover:underline",children:"Sign in"})]})]})]})]}):o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Sign Up",noIndex:!0}),o.jsxs(Dt,{className:"border-border/50",children:[o.jsxs(Zt,{className:"text-center",children:[o.jsx(tn,{children:"Registration Closed"}),o.jsx(Kn,{children:"New account registration is currently disabled."})]}),o.jsxs(Vt,{className:"space-y-4 text-center",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"We're not accepting new sign-ups at this time. Please check back later or contact us for more information."}),o.jsx("div",{className:"pt-4",children:o.jsx(Mt,{to:"/login",children:o.jsx(le,{variant:"outline",className:"w-full",children:"Back to Sign in"})})})]})]})]})}const Lwt=u8({email:Iy().email("Invalid email address")});function $wt(){const[t,e]=b.useState(!1),[n,r]=b.useState(!1),{register:i,handleSubmit:s,formState:{errors:a}}=o8({resolver:l8(Lwt)}),l=async c=>{e(!0);try{const{error:u}=await co.auth.resetPasswordForEmail(c.email,{redirectTo:`${window.location.origin}/reset-password`});if(u)throw u;r(!0)}catch(u){ge.error(u.message||"Failed to send reset email")}finally{e(!1)}};return n?o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Check Your Email",noIndex:!0}),o.jsxs(Dt,{className:"border-border/50",children:[o.jsxs(Zt,{className:"text-center",children:[o.jsx(tn,{children:"Check your email"}),o.jsx(Kn,{children:"We've sent you a password reset link. Click the link in your email to reset your password."})]}),o.jsx(Vt,{children:o.jsx(Mt,{to:"/login",children:o.jsxs(le,{variant:"outline",className:"w-full",children:[o.jsx(Ii,{className:"h-4 w-4"}),"Back to sign in"]})})})]})]}):o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Forgot Password",noIndex:!0}),o.jsxs(Dt,{className:"border-border/50",children:[o.jsxs(Zt,{className:"text-center",children:[o.jsx(tn,{children:"Forgot password?"}),o.jsx(Kn,{children:"Enter your email and we'll send you a reset link"})]}),o.jsxs(Vt,{children:[o.jsxs("form",{onSubmit:s(l),className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{htmlFor:"email",children:"Email"}),o.jsx(gt,{id:"email",type:"email",placeholder:"[email protected]",...i("email")}),a.email&&o.jsx("p",{className:"text-sm text-destructive",children:a.email.message})]}),o.jsx(le,{type:"submit",className:"w-full",disabled:t,children:t?"Sending...":"Send reset link"})]}),o.jsx("div",{className:"mt-6 text-center",children:o.jsxs(Mt,{to:"/login",className:"inline-flex items-center text-sm text-muted-foreground hover:text-foreground",children:[o.jsx(Ii,{className:"h-4 w-4"}),"Back to sign in"]})})]})]})]})}function Fwt(){const t=Nr(),{companies:e,currentCompanyId:n,isLoading:r,hasFetched:i}=Ri(),[s,a]=b.useState(!1);return b.useEffect(()=>{i&&!r&&e.length===0&&t("/onboarding",{replace:!0})},[i,r,e.length,t]),b.useEffect(()=>{n&&e.length>0&&t(`/company/${n}`,{replace:!0})},[n,e,t]),r||!i||e.length===0?o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Dashboard",noIndex:!0}),o.jsx("div",{className:"flex h-64 items-center justify-center",children:o.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-primary border-t-transparent"})})]}):o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Dashboard",noIndex:!0}),o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-3xl font-bold",children:"Your Companies"}),o.jsx("p",{className:"mt-2 text-muted-foreground",children:"Select a company to view its dashboard or add a new one."})]}),o.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[e.map(l=>o.jsxs(Dt,{className:"cursor-pointer transition-colors hover:bg-accent/50",onClick:()=>t(`/company/${l.id}`),children:[o.jsx(Zt,{children:o.jsxs("div",{className:"flex items-center gap-3",children:[l.logoUrl?o.jsx("img",{src:l.logoUrl,alt:"",className:"h-10 w-10 rounded-lg object-cover"}):o.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-primary/10",children:o.jsx(lv,{className:"h-5 w-5 text-primary"})}),o.jsxs("div",{children:[o.jsx(tn,{className:"text-lg",children:l.name}),o.jsx(Kn,{children:l.brandName})]})]})}),o.jsx(Vt,{children:o.jsxs("p",{className:"text-sm text-muted-foreground",children:["Role: ",o.jsx("span",{className:"capitalize",children:l.role})]})})]},l.id)),o.jsx(Dt,{className:"cursor-pointer border-dashed transition-colors hover:bg-accent/50",onClick:()=>a(!0),children:o.jsxs(Vt,{className:"flex h-full min-h-[150px] flex-col items-center justify-center",children:[o.jsx(yi,{className:"mb-2 h-8 w-8 text-muted-foreground"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Add Company"})]})})]}),o.jsx(Foe,{open:s,onOpenChange:a})]})]})}const JI=[{key:"analyzing",label:"Analyzing company",icon:pr},{key:"gathering_info",label:"AI information gathering",icon:To},{key:"fetching_logo",label:"Gathering company logo",icon:NS},{key:"enabling_llms",label:"Enabling AI models",icon:jz},{key:"completed",label:"Setup complete",icon:wg}],Uwt=(t,e)=>new Intl.NumberFormat("en-US",{style:"currency",currency:e.toUpperCase(),minimumFractionDigits:0,maximumFractionDigits:0}).format(t);function zwt(){const t=Nr(),{createCompany:e,fetchCompanies:n,companies:r,hasFetched:i}=Ri(),[s,a]=b.useState(1),[l,c]=b.useState(""),[u,d]=b.useState("Denmark"),[f,h]=b.useState(!1),[p,m]=b.useState(""),[x,y]=b.useState(!1),[g,w]=b.useState(null),[v,N]=b.useState(""),[S,_]=b.useState(""),[j,A]=b.useState([]),[C,k]=b.useState(""),M=b.useRef(null),[I,R]=b.useState(!1),[E,P]=b.useState(null),[O,L]=b.useState("analyzing"),[T,D]=b.useState({}),[F,q]=b.useState([]),[B,z]=b.useState([]),[H,W]=b.useState(!1),[G,K]=b.useState(null),[ee,V]=b.useState(!1),[J,Y]=b.useState([]),[$,fe]=b.useState(!1),[ce,ve]=b.useState(new Set),[X,de]=b.useState(!1),[Te,Pe]=b.useState("pending"),{profile:se,refreshProfile:U}=Rr(),Q=(se==null?void 0:se.promptsLimit)||5,oe=(se==null?void 0:se.promptsUsed)||0,_e=Math.max(0,Q-oe),ye=(se==null?void 0:se.subscriptionStatus)==="active"&&(se==null?void 0:se.subscriptionTier)&&se.subscriptionTier!=="free",{data:re=[]}=AT(),he=b.useMemo(()=>{const ue=p.toLowerCase();return ue?re.filter(Ne=>Ne.name.toLowerCase().includes(ue)):re.slice(0,20)},[p,re]);b.useEffect(()=>{if(!(!i||!se)){if(se.onboardingCompletedAt&&r.length>0&&s===1&&!E){t(`/company/${r[0].id}`,{replace:!0});return}if(!se.onboardingCompletedAt&&r.length>0&&s===1&&!E){const ue=r[0];P(ue.id),a(ye?4:3)}}},[i,r,t,s,E,se,ye]),b.useEffect(()=>{s===3&&F.length===0&&(W(!0),Promise.all([Ce.get("/billing/plans"),Ce.get("/public/platform-defaults")]).then(([ue,Ne])=>{q(ue),z(Ne)}).catch(ue=>ge.error(ue.message||"Failed to load plans")).finally(()=>W(!1)))},[s,F.length]),b.useEffect(()=>{s===4&&E&&J.length===0&&(fe(!0),Ce.get(`/companies/${E}/onboarding/prompt-suggestions`).then(ue=>{Y(ue.suggestions),Pe(ue.status)}).catch(ue=>{ge.error(ue.message||"Failed to load prompt suggestions")}).finally(()=>fe(!1)))},[s,E,J.length]),b.useEffect(()=>{const ue=Um();if(!ue)return;const Ne=Le=>{Le.companyId===E&&Le.count>0&&Ce.get(`/companies/${E}/onboarding/prompt-suggestions`).then(tt=>{Y(tt.suggestions),Pe("ready")}
4933).catch(()=>{})};return ue.on("onboarding:prompts_ready",Ne),()=>{ue.off("onboarding:prompts_ready",Ne)}},[E]),b.useEffect(()=>{const ue=Um();if(!ue)return;const Ne=Le=>{Le.companyId===E&&(L(Le.step),Le.data&&D(tt=>({...tt,...Le.data})),Le.step==="completed"&&setTimeout(()=>{R(!1),a(ye?4:3),n()},1e3))};return ue.on("company:onboarding_progress",Ne),()=>{ue.off("company:onboarding_progress",Ne)}},[E,n,ye]);const pe=async ue=>{if(ue.preventDefault(),!l.trim()){ge.error("Please enter a company name");return}if(!u){ge.error("Please select a country");return}y(!0);try{const Ne=await Ce.post("/companies/preview",{name:l.trim(),country:u});w(Ne),N(Ne.brandName),_(Ne.website||""),A(Ne.alternateNames||[]),a(2)}catch(Ne){ge.error(Ne.message||"Failed to analyze company")}finally{y(!1)}},je=async()=>{R(!0),L("enabling_llms");try{const ue=await e({name:l.trim(),brandName:v.trim(),website:S.trim()||void 0,alternateNames:j.filter(Ne=>Ne.trim()),country:u});P(ue.id),L("completed"),setTimeout(()=>{R(!1),a(ye?4:3),n()},1e3)}catch(ue){ge.error(ue.message||"Failed to create company"),R(!1)}},ae=async ue=>{const Ne=F.find(Le=>Le.id===ue);if(Ne){if(!Ne.stripePriceId||Ne.price===0){a(4);return}K(ue),V(!0);try{const Le=await Ce.post("/billing/create-checkout",{planId:ue,successUrl:`${window.location.origin}/onboarding?paid=true&companyId=${E}`,cancelUrl:`${window.location.origin}/onboarding?companyId=${E}`});Le.checkoutUrl&&(window.location.href=Le.checkoutUrl)}catch(Le){ge.error(Le.message||"Failed to start checkout"),V(!1),K(null)}}},we=ue=>{ve(Ne=>{const Le=new Set(Ne);if(Le.has(ue))Le.delete(ue);else{if(Le.size>=_e)return ge.error(`You can only select up to ${_e} prompts with your current plan`),Ne;Le.add(ue)}return Le})},Ie=async()=>{if(ce.size===0){ge.error("Please select at least one prompt");return}de(!0);try{await Ce.post(`/companies/${E}/onboarding/create-prompts`,{suggestionIds:Array.from(ce)}),await U(),ge.success(`Created ${ce.size} prompts! Starting AI analysis...`),t(`/company/${E}?welcome=true`)}catch(ue){ge.error(ue.message||"Failed to create prompts"),de(!1)}},Ue=async()=>{try{await Ce.post("/users/me/complete-onboarding"),await U(),ge.info("You can add prompts anytime from the Queries page"),t(`/company/${E}`)}catch(ue){ge.error(ue.message||"Failed to complete onboarding")}};b.useEffect(()=>{const ue=new URLSearchParams(window.location.search),Ne=ue.get("paid"),Le=ue.get("companyId"),tt=ue.get("step");if(Ne==="true"&&Le){P(Le),a(4),window.history.replaceState({},"","/onboarding");return}if(Le&&tt){const St=parseInt(tt,10);St>=3&&St<=4&&(P(Le),a(St),window.history.replaceState({},"","/onboarding"))}},[]);const Oe=()=>{var Ne;const ue=C.trim();if(ue){if(j.some(Le=>Le.toLowerCase()===ue.toLowerCase())){ge.error("This name already exists");return}if(ue.toLowerCase()===v.toLowerCase()){ge.error("Cannot add the brand name as an alternate");return}A([...j,ue]),k(""),(Ne=M.current)==null||Ne.focus()}},ie=ue=>{A(j.filter(Ne=>Ne!==ue))},De=ue=>{ue.key==="Enter"?(ue.preventDefault(),Oe()):ue.key==="Backspace"&&!C&&j.length>0&&A(j.slice(0,-1))},Ve=ue=>{const Ne=JI.findIndex(tt=>tt.key===ue),Le=JI.findIndex(tt=>tt.key===O);return Ne<Le?"completed":Ne===Le?"active":"pending"},xe=(()=>{if(!S)return g==null?void 0:g.logoUrl;try{const ue=new URL(S.startsWith("http")?S:`https://${S}`);return ue.hostname.includes(".")?`https://www.google.com/s2/favicons?domain=${ue.hostname}&sz=128`:g==null?void 0:g.logoUrl}catch{return g==null?void 0:g.logoUrl}})(),$e=[{number:1,label:"Company"},{number:2,label:"Details"},{number:3,label:"Plan"},{number:4,label:"Prompts"}];return o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Onboarding",noIndex:!0}),o.jsxs("div",{className:"flex flex-col items-center min-h-[calc(100vh-65px)] py-12 px-4",children:[o.jsx("div",{className:"mb-6 w-full max-w-md",children:o.jsx("div",{className:"flex items-center justify-between",children:$e.map((ue,Ne)=>o.jsxs("div",{className:"flex items-center flex-1 last:flex-none",children:[o.jsxs("div",{className:"flex flex-col items-center",children:[o.jsx("div",{className:ne("flex h-8 w-8 items-center justify-center rounded-lg text-sm font-semibold transition-all duration-200",s===ue.number&&"bg-primary text-primary-foreground ring-4 ring-primary/20",s>ue.number&&"bg-primary text-primary-foreground",s<ue.number&&"bg-muted text-muted-foreground border-1 border-border"),children:s>ue.number?o.jsx(Sn,{className:"h-5 w-5"}):ue.number}),o.jsx("span",{className:ne("mt-2 text-xs font-medium whitespace-nowrap transition-colors",s===ue.number&&"text-primary",s>ue.number&&"text-foreground",s<ue.number&&"text-muted-foreground"),children:ue.label})]}),Ne<$e.length-1&&o.jsx("div",{className:"flex-1 mx-3 mb-6",children:o.jsx("div",{className:ne("h-0.5 w-full rounded-full transition-colors duration-200",s>ue.number?"bg-primary":"bg-border")})})]},ue.number))})}),s===1&&o.jsxs(Dt,{className:"w-full max-w-lg animate-fade-in",children:[o.jsxs(Zt,{children:[o.jsx(tn,{className:"text-2xl",children:"Let's get you started!"}),o.jsx(Kn,{className:"text-base",children:"Tell us about your company and we'll try to gather more information for a quick setup."})]}),o.jsx(Vt,{children:o.jsxs("form",{onSubmit:pe,className:"space-y-4",children:[o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(et,{htmlFor:"companyName",children:"Company Name"}),o.jsx(gt,{id:"companyName",placeholder:"e.g., Acme Corporation",value:l,onCh
4933ange:ue=>c(ue.target.value),autoFocus:!0,className:"h-12 text-lg"})]}),o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(et,{children:"Country"}),o.jsxs(ou,{open:f,onOpenChange:h,children:[o.jsx(lu,{asChild:!0,children:o.jsxs(le,{variant:"outline",role:"combobox","aria-expanded":f,className:"w-full justify-between h-12 font-normal text-base",children:[u||"Select country...",o.jsx(bg,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),o.jsx(pc,{className:"w-full p-0",align:"start",children:o.jsxs(Kh,{children:[o.jsx(Yh,{placeholder:"Search country...",value:p,onValueChange:m}),o.jsx(Xh,{children:"No country found."}),o.jsx(_d,{className:"max-h-64 overflow-y-auto",children:he.map(ue=>o.jsxs(Sd,{value:ue.name,onSelect:Ne=>{d(Ne===u?"":Ne),h(!1),m("")},children:[o.jsx(Sn,{className:ne("mr-2 h-4 w-4",u===ue.name?"opacity-100":"opacity-0")}),ue.name]},ue.code))})]})})]})]}),o.jsx(le,{type:"submit",className:"w-full h-12 text-base mt-6",disabled:x||!l.trim(),children:x?o.jsxs(o.Fragment,{children:[o.jsx(Me,{className:"h-5 w-5 animate-spin"}),"Analyzing..."]}):o.jsxs(o.Fragment,{children:[o.jsx(pr,{className:"h-5 w-5"}),"Continue",o.jsx(Ai,{className:"h-5 w-5"})]})})]})})]}),s===2&&!I&&g&&o.jsxs(Dt,{className:"w-full max-w-lg animate-fade-in",children:[o.jsxs(Zt,{children:[o.jsx(tn,{className:"text-2xl",children:"Confirm your details"}),o.jsx(Kn,{className:"text-base",children:"Add extra details to your company."})]}),o.jsxs(Vt,{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-xl bg-muted/50 border",children:[o.jsx("div",{className:"h-12 w-12 rounded-lg bg-background overflow-hidden border flex items-center justify-center",children:xe?o.jsx("img",{src:xe,alt:"",className:"h-full w-full object-contain"}):o.jsx("span",{className:"text-xl font-bold text-primary",children:v.charAt(0).toUpperCase()})}),o.jsxs("div",{children:[o.jsx("p",{className:"font-semibold text-base",children:v}),o.jsx("p",{className:"text-xs text-muted-foreground",children:l})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{htmlFor:"brandName",children:"Brand Name"}),o.jsx(gt,{id:"brandName",value:v,onChange:ue=>N(ue.target.value),placeholder:"Brand name for tracking",className:"h-11"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"This is the name we'll track in AI responses"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{htmlFor:"website",children:"Website"}),o.jsx(gt,{id:"website",value:S,onChange:ue=>_(ue.target.value),placeholder:"https://example.com",className:"h-11"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Ez,{className:"h-4 w-4 text-muted-foreground"}),o.jsx(et,{children:"Alternate Names"})]}),o.jsxs("div",{className:ne("flex flex-wrap items-center gap-2 p-3 min-h-[48px] rounded-lg border bg-background cursor-text","focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2"),onClick:()=>{var ue;return(ue=M.current)==null?void 0:ue.focus()},children:[j.map(ue=>o.jsxs(Ge,{variant:"outline",className:"gap-1 h-7 text-sm pr-1.5 bg-muted/50",children:[ue,o.jsx("button",{type:"button",onClick:Ne=>{Ne.stopPropagation(),ie(ue)},className:"ml-1 hover:bg-muted-foreground/20 rounded-full p-0.5 transition-colors",children:o.jsx(mr,{className:"h-3 w-3"})})]},ue)),o.jsx("input",{ref:M,type:"text",value:C,onChange:ue=>k(ue.target.value),onKeyDown:De,placeholder:j.length===0?"Add alternate names...":"Add more...",className:"flex-1 min-w-[120px] bg-transparent outline-none text-sm placeholder:text-muted-foreground"})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Other names your company is known by (press Enter to add)"})]}),o.jsxs("div",{className:"flex gap-3 pt-4",children:[o.jsxs(le,{type:"button",variant:"outline",onClick:()=>a(1),className:"flex-1 h-11",children:[o.jsx(Ii,{className:"h-4 w-4"}),"Back"]}),o.jsxs(le,{onClick:je,disabled:!v.trim(),className:"flex-1 h-11",children:["Create Company",o.jsx(Ai,{className:"ml-2 h-4 w-4"})]})]})]})]}),s===2&&I&&o.jsxs(Dt,{className:"w-full max-w-lg animate-fade-in",children:[o.jsxs(Zt,{className:"text-center",children:[o.jsxs(tn,{className:"text-2xl flex items-center justify-center gap-2",children:[o.jsx(pr,{className:"h-6 w-6 text-primary"}),"Setting up your company"]}),o.jsx(Kn,{className:"text-base",children:"Creating your company and enabling models..."})]}),o.jsx(Vt,{children:o.jsx("div",{className:"space-y-3",children:JI.filter(ue=>ue.key==="enabling_llms"||ue.key==="completed").map(ue=>{const Ne=Ve(ue.key),Le=ue.icon;return o.jsxs("div",{className:ne("flex items-center gap-4 p-4 rounded-lg transition-all",Ne==="active"&&"bg-primary/10 border border-primary/20",Ne==="completed"&&"bg-muted/50",Ne==="pending"&&"opacity-50"),children:[o.jsx("div",{className:ne("flex h-10 w-10 items-center justify-center rounded-full",Ne==="active"&&"bg-primary text-primary-foreground",Ne==="completed"&&"bg-primary/20 text-primary",Ne==="pending"&&"bg-muted text-muted-foreground"),children:Ne==="active"?o.jsx(Me,{className:"h-5 w-5 animate-spin"}):Ne==="completed"?o.jsx(Sn,{className:"h-5 w-5"}):o.jsx(Le,{className:"h-5 w-5"})}),o.jsxs("div",{className:"flex-1",children:[o.jsx("p",{className:ne("font-medium",Ne==="active"&&"text-foreground",Ne==="completed"&&"text-muted-foreground",Ne==="pending"&&"text-muted-foreground"),children:ue.label}),Ne==="completed"&&ue.key==="enabling_llms"&&(T==null?void 0:T.llmsEnabled)&&o.jsxs("p",{className:"text-sm text-muted-foreground",children:[T.llmsEnabled," AI models enabled"]})]})]},ue.key)})})})]}),s===3&&o.jsxs("div",{className:"w-full max-w-5xl animate-fade-in",children:[o.jsxs("div",{className:"text-center mb-8",children:[o.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-primary/10",children:o.jsx(bo,{className:"h-8 w-8 text-primary"})}),o.jsx("h2",{className:"text-2xl font-bold mb-2",children:"Choose your plan"}),o.jsx("p",{className:"text-muted-foreground text-lg",children:"Select a plan to start tracking your brand in AI responses"})]}),H?o.jsx("div",{className:"flex justify-center py-12",children:o.jsx(Me,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):o.jsx("div",{className:ne("grid gap-6",F.length===4&&"grid-cols-1 sm:grid-cols-2 lg:grid-cols-4",F.length===3&&"max-w-4xl mx-auto md:grid-cols-3",F.length<=2&&"max-w-2xl mx-auto md:grid-cols-2"),children:F.map(ue=>{const Ne=G===ue.id,Le=ue.stripePriceId&&ue.price>0;return o.jsxs(Dt,{className:ne("relative flex flex-col cursor-pointer transition-all hover:border-primary/50",Ne&&"border-primary ring-2 ring-primary",ue.isFeatured&&"border-primary ring-1 ring-primary/20 shadow-lg lg:scale-105 z-10"),onClick:()=>!ee&&ae(ue.id),children:[ue.isFeatured&&o.jsx(Ge,{className:"absolute -top-3 left-1/2 -translate-x-1/2",children:"Most Popular"}),o.jsxs(Zt,{className:"text-center p-4 md:p-6",children:[o.jsx(tn,{className:"text-xl font-semibold",children:ue.name}),ue.description&&o.jsx("p",{className:"text-sm text-muted-foreground",children:ue.description})]}),o.jsxs(Vt,{className:"flex-1 p-4 md:p-6 pt-0",children:[o.jsxs("div",{className:"text-center mb-4",children:[o.jsx("span",{className:"text-3xl font-bold",children:ue.price===0?"Free":Uwt(ue.price,ue.priceCurrency)}),ue.price>0&&o.jsxs("span",{className:"text-muted-foreground text-sm",children:[" / ",ue.billingInterval]})]}),o.jsxs("ul",{className:"space-y-2 text-sm",children:[o.jsxs("li",{className:"flex items-center gap-2",children:[o.jsx(Sn,{className:"h-4 w-4 text-primary shrink-0"}),o.jsxs("span",{children:[o.jsx("strong",{children:ue.promptLimit})," prompts per day"]})]}),o.jsxs("li",{className:"flex items-center gap-2",children:[o.jsx(Sn,{className:"h-4 w-4 text-primary shrink-0"}),o.jsxs("span",{children:[o.jsx("strong",{children:(ue.promptLimit*30*3).toLocaleStr
4933ing()})," runs/month"]})]}),o.jsxs("li",{className:"flex items-center gap-2",children:[o.jsx(Sn,{className:"h-4 w-4 text-primary shrink-0"}),o.jsxs("span",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"flex items-center -space-x-1",children:B.slice(0,3).map(tt=>tt.logoUrl?o.jsx(Hn,{src:tt.logoUrl,alt:tt.displayName,className:"h-6 w-6 object-contain rounded-full bg-background ring-1 ring-border p-1"},tt.id):o.jsx("div",{className:"h-4 w-4 rounded-full bg-muted flex items-center justify-center ring-1 ring-background",children:o.jsx(ga,{className:"h-2.5 w-2.5 text-muted-foreground"})},tt.id))}),o.jsx("span",{children:"AI models"})]})]}),o.jsxs("li",{className:"flex items-center gap-2",children:[ue.tokensPerMonth>0?o.jsx(Sn,{className:"h-4 w-4 text-primary shrink-0"}):o.jsx(mr,{className:"h-4 w-4 text-muted-foreground shrink-0"}),o.jsx("span",{className:ne(!ue.tokensPerMonth&&"text-muted-foreground"),children:ue.tokensPerMonth>0?o.jsxs("span",{className:"inline-flex items-center gap-1",children:[o.jsx("strong",{children:ue.tokensPerMonth})," run tokens",o.jsxs(Ft,{children:[o.jsx(Ut,{asChild:!0,children:o.jsx(xr,{className:"h-3.5 w-3.5 text-muted-foreground cursor-help"})}),o.jsx(zt,{className:"max-w-70 text-center",children:"Allows you to manually start runs, combine found competitors and more using AI"})]})]}):o.jsx("span",{children:"No tokens"})})]})]})]}),o.jsx(qv,{className:"p-4 md:p-6 pt-0",children:o.jsx(le,{className:"w-full",variant:ue.isFeatured?"default":"outline",disabled:ee,children:ee&&G===ue.id?o.jsx(Me,{className:"h-4 w-4 animate-spin"}):o.jsxs(o.Fragment,{children:[Le?"Select Plan":"Get Started",o.jsx(Ai,{className:"ml-2 h-4 w-4"})]})})})]},ue.id)})})]}),s===4&&o.jsxs("div",{className:"w-full max-w-2xl animate-fade-in",children:[o.jsxs("div",{className:"text-center mb-8",children:[o.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-primary/10",children:o.jsx(wTe,{className:"h-8 w-8 text-primary"})}),o.jsx("h2",{className:"text-2xl font-bold mb-2",children:"Choose prompts to track"}),o.jsxs("p",{className:"text-muted-foreground text-lg",children:["Select up to ",_e," prompts to start tracking."]})]}),o.jsxs(Dt,{children:[o.jsx(Zt,{className:"pb-4",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsxs(tn,{className:"text-lg flex items-center gap-2",children:[o.jsx(Mo,{className:"h-5 w-5"}),"Prompts"]}),o.jsx(Kn,{children:"Prompts suggestions based on your brand."})]}),o.jsxs(Ge,{variant:"outline",className:"h-7",children:[ce.size," / ",_e," selected"]})]})}),o.jsxs(Vt,{children:[$||Te==="pending"&&J.length===0?o.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[o.jsx(Me,{className:"h-8 w-8 animate-spin text-primary mb-4"}),o.jsx("p",{className:"text-muted-foreground text-sm",children:"Generating prompt ideas..."})]}):J.length===0?o.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[o.jsx(Mo,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),o.jsx("p",{className:"text-muted-foreground",children:"No suggestions available yet. You can add prompts manually from the Queries page."})]}):o.jsx("div",{className:"space-y-2",children:J.map(ue=>{const Ne=ce.has(ue.id),Le=!Ne&&ce.size>=_e;return o.jsxs("div",{className:ne("flex items-start gap-3 p-4 rounded-lg border cursor-pointer transition-all",Ne&&"bg-primary/5 border-primary",!Ne&&!Le&&"hover:bg-muted/50",Le&&"opacity-50 cursor-not-allowed"),onClick:()=>!Le&&we(ue.id),children:[o.jsx(Yr,{checked:Ne,disabled:Le,onChange:()=>!Le&&we(ue.id),className:"mt-0.5"}),o.jsx("p",{className:"text-sm flex-1",children:ue.promptText})]},ue.id)})}),o.jsxs("div",{className:"flex gap-3 pt-6 mt-6 border-t",children:[o.jsx(le,{variant:"outline",onClick:Ue,disabled:X,className:"flex-1",children:"Skip for now"}),o.jsx(le,{onClick:Ie,disabled:ce.size===0||X,className:"flex-1",children:X?o.jsxs(o.Fragment,{children:[o.jsx(Me,{className:"h-4 w-4 animate-spin"}),"Creating..."]}):o.jsxs(o.Fragment,{children:["Start Tracking",o.jsx(Ai,{className:"h-4 w-4"})]})})]})]})]})]})]})]})}const Bwt={sm:{barWidth:"w-[3px]",barHeight:"h-4",gap:"gap-0.5",iconSize:"h-3 w-3",iconGap:"gap-1"},md:{barWidth:"w-[4px]",barHeight:"h-5",gap:"gap-[3px]",iconSize:"h-3.5 w-3.5",iconGap:"gap-1.5"},lg:{barWidth:"w-[5px]",barHeight:"h-6",gap:"gap-1",iconSize:"h-4 w-4",iconGap:"gap-2"}};function Vwt(t){return t>=80?"bg-primary":t>=50?"bg-chart-3":t>=25?"bg-chart-4":"bg-foreground"}function xa({value:t,tooltipTitle:e,size:n="md",fullWidth:r=!1,className:i}){const s=Bwt[n];let a=7;r&&(a=14);const l=Math.round(t/100*a),c=Vwt(t),u=o.jsx("div",{className:ne("flex items-center",r?"flex-1 gap-1":s.gap),children:Array.from({length:a},(d,f)=>o.jsx("div",{className:ne("rounded-full",r?"flex-1":s.barWidth,s.barHeight,f<l?c:"bg-foreground
vendor: 10,111 bytes, line 4933
4933/20")},f))});return e?o.jsx(on,{children:o.jsxs(Ft,{children:[o.jsx(Ut,{asChild:!0,children:o.jsxs("div",{className:ne("inline-flex items-center",r&&"flex-1",s.iconGap,i),children:[u,o.jsx(xr,{className:ne(s.iconSize,"text-muted-foreground shrink-0")})]})}),o.jsx(zt,{children:o.jsx("p",{children:e})})]})}):o.jsx("div",{className:ne("inline-flex items-center",r&&"flex-1",i),children:u})}function Hwt(t){if(!(!t||t==="null"||t==="undefined"))return t}const AE=["sitemap_crawl","research_setup","opportunity_generation"];function Wwt(t){const e=Hwt(t);return En({queryKey:["setup-status",e],queryFn:()=>Ce.get(`/companies/${e}/setup-status`),enabled:!!e,staleTime:1e3*10,refetchInterval:n=>{const r=n.state.data;return r!=null&&r.hasPendingTasks?5e3:!1}})}function cme(t){return t!=null&&t.tasks?AE.some(e=>{const n=t.tasks[e];return n&&(n.status==="pending"||n.status==="in_progress")}):!1}function ume(t){if(!(t!=null&&t.tasks))return{total:0,completed:0,inProgress:0,pending:0,failed:0};let e=0,n=0,r=0,i=0;for(const s of AE){const a=t.tasks[s];if(a)switch(a.status){case"completed":e++;break;case"in_progress":n++;break;case"pending":r++;break;case"failed":i++;break}}return{total:AE.length,completed:e,inProgress:n,pending:r,failed:i}}function Gwt(t){if(!cme(t))return null;const e=ume(t),{inProgress:n,pending:r,completed:i,total:s}=e;return n+r===0?null:n>0?`Setting up your company... ${i}/${s} tasks completed`:`${r} setup task${r>1?"s":""} waiting to start`}const qwt={sitemap_crawl:{title:"Website Audit",description:"Scanning your website for optimization opportunities",icon:To},research_setup:{title:"Market Research",description:"Analyzing your market and setting up research",icon:Xa},opportunity_generation:{title:"Finding Opportunities",description:"Identifying ways to improve your AI visibility",icon:bo}};function Kwt({status:t}){switch(t){case"completed":return o.jsx(wg,{className:"h-4 w-4 text-success"});case"in_progress":return o.jsx(Me,{className:"h-4 w-4 animate-spin text-primary"});case"failed":return o.jsx(_z,{className:"h-4 w-4 text-destructive"});case"pending":default:return o.jsx(Sz,{className:"h-4 w-4 text-muted-foreground"})}}function Ywt({taskType:t,status:e}){const n=qwt[t],r=n.icon,i=e==="in_progress",s=e==="completed",a=e==="failed";return o.jsxs("div",{className:ne("flex items-center gap-3 p-3 rounded-lg border transition-all",i&&"bg-primary/5 border-primary/30 shadow-sm",s&&"bg-success/5 border-success/20",a&&"bg-destructive/5 border-destructive/20",!i&&!s&&!a&&"bg-muted/30 border-muted"),children:[o.jsx("div",{className:ne("flex h-9 w-9 shrink-0 items-center justify-center rounded-lg",i&&"bg-primary/10",s&&"bg-success/10",a&&"bg-destructive/10",!i&&!s&&!a&&"bg-muted"),children:o.jsx(r,{className:ne("h-4 w-4",i&&"text-primary",s&&"text-success",a&&"text-destructive",!i&&!s&&!a&&"text-muted-foreground")})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:ne("text-sm font-medium",i&&"text-foreground",s&&"text-success",a&&"text-destructive",!i&&!s&&!a&&"text-muted-foreground"),children:n.title}),o.jsx("p",{className:"text-xs text-muted-foreground truncate",children:a?"Task failed - will retry":n.description})]}),o.jsx(Kwt,{status:e})]})}function Xwt({companyId:t,className:e,variant:n="banner"}){var p,m;const{data:r,isLoading:i}=Wwt(t),s=_S(t),a=s.isSetupRunning&&!s.hasSiteHealthData,l=cme(r)||a;if(i||!l)return null;const c=Gwt(r)||(a?"Auditing your website...":null);if(!c)return null;const u=ume(r),d=a&&((m=(p=r==null?void 0:r.tasks)==null?void 0:p.sitemap_crawl)==null?void 0:m.status)==="completed"?{...u,completed:Math.max(0,u.completed-1),inProgress:u.inProgress+1}:u;if(n==="compact")return o.jsxs("div",{className:ne("inline-flex items-center gap-1.5 px-2 py-1 rounded-full bg-primary/10 text-primary text-xs font-medium",e),children:[o.jsx(Me,{className:"h-3 w-3 animate-spin"}),"Setting up..."]});if(n==="inline")return o.jsxs("div",{className:ne("flex items-center gap-2 p-3 rounded-lg bg-primary/10 border border-primary/20",e),children:[o.jsx(Me,{className:"h-4 w-4 animate-spin text-primary shrink-0"}),o.jsx("p",{className:"text-sm text-primary",children:c})]});const f=r==null?void 0:r.tasks,h=x=>{const y=f==null?void 0:f[x];return y?x==="sitemap_crawl"&&a&&y.status==="completed"?"in_progress":y.status:"pending"};return o.jsxs("div",{className:ne("space-y-4",e),children:[o.jsxs("div",{className:"flex items-center gap-3 p-4 rounded-lg bg-primary/10 border border-primary/20",children:[o.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-primary/20 shrink-0",children:o.jsx(pr,{className:"h-5 w-5 text-primary"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-medium text-sm",children:"Setting up your company"}),o.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:[d.completed,"/",d.total," tasks completed"]})]}),o.jsx(Me,{className:"h-5 w-5 animate-spin text-primary shrink-0"})]}),o.jsx("div",{className:"grid gap-2 sm:grid-cols-3",children:AE.map(x=>(f==null?void 0:f[x])?o.jsx(Ywt,{taskType:x,status:h(x)},x):null)})]})}function Qwt(t,e=[]){let n=[];function r(s,a){const l=b.createContext(a),c=n.length;n=[...n,a];const u=f=>{var g;const{scope:h,children:p,...m}=f,x=((g=h==null?void 0:h[t])==null?void 0:g[c])||l,y=b.useMemo(()=>m,Object.values(m));return o.jsx(x.Provider,{value:y,children:p})};u.displayName=s+"Provider";function d(f,h){var x;const p=((x=h==null?void 0:h[t])==null?void 0:x[c])||l,m=b.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[u,d]}const i=()=>{const s=n.map(a=>b.createContext(a));return function(l){const c=(l==null?void 0:l[t])||s;return b.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return i.scopeName=t,[r,Jwt(i,...e)]}function Jwt(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const a=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...l,...f}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return n.scopeName=e.scopeName,n}function Zwt(t){const e=e1t(t),n=b.forwardRef((r,i)=>{const{children:s,...a}=r,l=b.Children.toArray(s),c=l.find(n1t);if(c){const u=c.props.children,d=l.map(f=>f===c?b.Children.count(u)>1?b.Children.only(null):b.isValidElement(u)?u.props.children:null:f);return o.jsx(e,{...a,ref:i,children:b.isValidElement(u)?b.cloneElement(u,void 0,d):null})}return o.jsx(e,{...a,ref:i,children:s})});return n.displayName=`${t}.Slot`,n}function e1t(t){const e=b.forwardRef((n,r)=>{const{children:i,...s}=n;if(b.isValidElement(i)){const a=i1t(i),l=r1t(s,i.props);return i.type!==b.Fragment&&(l.ref=r?Ir(r,a):a),b.cloneElement(i,l)}return b.Children.count(i)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var t1t=Symbol("radix.slottable");function n1t(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===t1t}function r1t(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...l)=>{const c=s(...l);return i(...l),c}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function i1t(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var s1t=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],a1t=s1t.reduce((t,e)=>{const n=Zwt(`Primitive.${e}`),r=b.forwardRef((i,s)=>{const{asChild:a,...l}=i,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),ZI,nP="HoverCard",[dme]=Qwt(nP,[xu]),rP=xu(),[o1t,iP]=dme(nP),fme=t=>{const{__scopeHoverCard:e,children:n,open:r,defaultOpen:i,onOpenChange:s,openDelay:a=700,closeDelay:l=300}=t,c=rP(e),u=b.useRef(0),d=b.useRef(0),f=b.useRef(!1),h=b.useRef(!1),[p,m]=su({prop:r,defaultProp:i??!1,onChange:s,caller:nP}),x=b.useCallback(()=>{clearTimeout(d.current),u.current=window.setTimeout(()=>m(!0),a)},[a,m]),y=b.useCallback(()=>{clearTimeout(u.current),!f.current&&!h.current&&(d.current=window.setTimeout(()=>m(!1),l))},[l,m]),g=b.useCallback(()=>m(!1),[m]);return b.useEffect(()=>()=>{clearTimeout(u.current),clearTimeout(d.current)},[]),o.jsx(o1t,{scope:e,open:p,onOpenChange:m,onOpen:x,onClose:y,onDismiss:g,hasSelectionRef:f,isPointerDownOnContentRef:h,children:o.jsx(TS,{...c,children:n})})};fme.displayName=nP;var hme="HoverCardTrigger",pme=b.forwardRef((t,e)=>{const{__scopeHoverCard:n,...r}=t,i=iP(hme,n),s=rP(n);return o.jsx(T0,{asChild:!0,...s,children:o.jsx(a1t.a,{"data-state":i.open?"open":"closed",...r,ref:e,onPointerEnter:at(t.onPointerEnter,ME(i.onOpen)),onPointerLeave:at(t.onPointerLeave,ME(i.onClose)),onFocus:at(t.onFocus,i.onOpen),onBlur:at(t.onBlur,i.onClose),onTouchStart:at(t.onTouchStart,a=>a.preventDefault())})})});pme.displayName=hme;var d8="HoverCardPortal",[l1t,c1t]=dme(d8,{forceMount:void 0}),mme=t=>{const{__scopeHoverCard:e,forceMount:n,children:r,container:i}=t,s=iP(d8,e);return o.jsx(l1t,{scope:e,forceMount:n,children:o.jsx(Na,{present:n||s.open,children:o.jsx(Sg,{asChild:!0,container:i,children:r})})})};mme.displayName=d8;var TE="HoverCardContent",gme=b.forwardRef((t,e)=>{const n=c1t(TE,t.__scopeHoverCard),{forceMount:r=n.forceMount,...i}=t,s=iP(TE,t.__scopeHoverCard);return o.jsx(Na,{present:r||s.open,children:o.jsx(u1t,{"data-state":s.open?"open":"closed",...i,onPointerEnter:at(t.onPointerEnter,ME(s.onOpen)),onPointerLeave:at(t.onPointerLeave,ME(s.onClose)),ref:e})})});gme.displayName=TE;var u1t=b.forwardRef((t,e)=>{const{__scopeHoverCard:n,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:a,...l}=t,c=iP(TE,n),u=rP(n),d=b.useRef(null),f=Pn(e,d),[h,p]=b.useState(!1);return b.useEffect(()=>
4933{if(h){const m=document.body;return ZI=m.style.userSelect||m.style.webkitUserSelect,m.style.userSelect="none",m.style.webkitUserSelect="none",()=>{m.style.userSelect=ZI,m.style.webkitUserSelect=ZI}}},[h]),b.useEffect(()=>{if(d.current){const m=()=>{p(!1),c.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var y;((y=document.getSelection())==null?void 0:y.toString())!==""&&(c.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",m),()=>{document.removeEventListener("pointerup",m),c.hasSelectionRef.current=!1,c.isPointerDownOnContentRef.current=!1}}},[c.isPointerDownOnContentRef,c.hasSelectionRef]),b.useEffect(()=>{d.current&&h1t(d.current).forEach(x=>x.setAttribute("tabindex","-1"))}),o.jsx(_g,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:a,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:at(s,m=>{m.preventDefault()}),onDismiss:c.onDismiss,children:o.jsx(MS,{...u,...l,onPointerDown:at(l.onPointerDown,m=>{m.currentTarget.contains(m.target)&&p(!0),c.hasSelectionRef.current=!1,c.isPointerDownOnContentRef.current=!0}),ref:f,style:{...l.style,userSelect:h?"text":void 0,WebkitUserSelect:h?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})}),d1t="HoverCardArrow",f1t=b.forwardRef((t,e)=>{const{__scopeHoverCard:n,...r}=t,i=rP(n);return o.jsx(PS,{...i,...r,ref:e})});f1t.displayName=d1t;function ME(t){return e=>e.pointerType==="touch"?void 0:t()}function h1t(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;n.nextNode();)e.push(n.currentNode);return e}var p1t=fme,m1t=pme,g1t=mme,x1t=gme;function xme({...t}){return o.jsx(p1t,{"data-slot":"hover-card",...t})}function yme({...t}){return o.jsx(m1t,{"data-slot":"hover-card-trigger",...t})}function vme({className:t,align:e="center",sideOffset:n=4,...r}){return o.jsx(g1t,{"data-slot":"hover-card-portal",children:o.jsx(x1t,{"data-slot":"hover-card-content",align:e,sideOffset:n,className:ne("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",t),...r})})}function bme(t){if(t.source==="manual")return!1;const e=t.website||t.logoUrl||t.faviconUrl||t.description;return t.source==="auto_discovered"&&!e}function ul({name:t,logoUrl:e,website:n,size:r="md",isLoading:i,source:s,description:a,className:l}){const[c,u]=b.useState(!1),[d,f]=b.useState(!0),h=i??(s?bme({source:s,website:n,logoUrl:e,description:a}):!1),p={xs:"h-4 w-4 min-w-[16px]",sm:"h-5 w-5 min-w-[20px]",md:"h-6 w-6 min-w-[24px]",lg:"h-8 w-8 min-w-[32px]",xl:"h-10 w-10 min-w-[40px]"},m={xs:"text-[8px]",sm:"text-[10px]",md:"text-xs",lg:"text-sm",xl:"text-base"},x={xs:"h-2 w-2",sm:"h-2.5 w-2.5",md:"h-3 w-3",lg:"h-4 w-4",xl:"h-5 w-5"},y=S=>{if(!S)return null;try{const _=S.startsWith("http")?S:`https://${S}`;return new URL(_).hostname}catch{return null}},w=(()=>{if(e)return e;const S=y(n);return S?`https://www.google.com/s2/favicons?domain=${S}&sz=64`:null})(),v=t.charAt(0).toUpperCase();if(h)return o.jsx("div",{className:ne(p[r],"relative rounded-full bg-muted flex items-center justify-center shrink-0",l),title:`${t} - analyzing...`,children:o.jsx(Me,{className:ne(x[r],"animate-spin text-muted-foreground")})});const N=()=>o.jsx("div",{className:ne(p[r],m[r],"rounded-full flex items-center justify-center shrink-0 font-medium bg-muted border border-border text-muted-foreground",l),title:t,children:v});return!w||c?N():o.jsxs("div",{className:ne(p[r],"relative rounded-full bg-muted overflow-hidden shrink-0",l),title:t,children:[d&&o.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:o.jsx("div",{className:ne(x[r],"rounded-full bg-muted-foreground
4933/20 animate-pulse")})}),o.jsx("img",{src:w,alt:"",className:ne("absolute inset-0 h-full w-full object-contain",d&&"opacity-0"),onLoad:()=>f(!1),onError:()=>{f(!1),u(!0)}})]})}function R5({name:t,originalName:e,website:n,faviconUrl:r,logoUrl:i,count:s,size:a="md",showName:l=!1,className:c,isLoading:u,source:d,description:f}){const h={sm:"text-xs",md:"text-sm",lg:"text-base"},p=a==="lg"?"lg":a==="sm"?"sm":"md",m=e&&e.toLowerCase()!==t.toLowerCase(),x=u??(d?bme({source:d,website:n,logoUrl:i||r,description:f}):!1);return o.jsxs("div",{className:ne("flex items-center gap-1.5",c),title:x?`${t} - analyzing...`:`${t}${s?` (${s} mentions)`:""}`,children:[o.jsx(ul,{name:t,logoUrl:r||i,website:n,size:p,isLoading:x,className:"border"}),l&&o.jsx("span",{className:ne("font-medium",h[a]),children:t}),m&&l&&o.jsx(on,{delayDuration:200,children:o.jsxs(Ft,{children:[o.jsx(Ut,{asChild:!0,children:o.jsx(xr,{className:"h-3.5 w-3.5 text-muted-foreground cursor-help shrink-0"})}),o.jsx(zt,{side:"top",className:"max-w-[280px]",children:o.jsxs("p",{className:"text-xs",children:[o.jsxs("span",{className:"font-medium",children:['"',e,'"']})," was normalized to"," ",o.jsxs("span",{className:"font-medium",children:['"',t,'"']})," for consistency"]})})]})}),s!==void 0&&o.jsxs("span",{className:ne("text-muted-foreground",h[a]),children:["(",s,")"]})]})}function I5({competitors:t,max:e=5,size:n="md",className:r,totalCount:i,companyId:s}){const a=t.slice(0,e),c=(i??t.length)-a.length,u={sm:"-ml-2 first:ml-0",md:"-ml-2.5 first:ml-0",lg:"-ml-3 first:ml-0"},d={sm:"h-5",md:"h-6",lg:"h-8"},f=o.jsxs("div",{className:ne("inline-flex items-center rounded-full",r),children:[a.map((h,p)=>{const{count:m,isLoading:x,source:y,description:g,...w}=h;return o.jsx("div",{className:ne(u[n],"relative"),style:{zIndex:p+1},children:o.jsx(R5,{...w,size:n,isLoading:x,source:y,description:g})},h.name+p)}),c>0&&o.jsxs("div",{className:ne(d[n],"flex items-center justify-center rounded-full bg-muted ml-1 border border-border px-1.5 text-[10px] font-medium text-muted-foreground whitespace-nowrap relative"),style:{zIndex:a.length+1},children:["+",c]})]});return t.length>0?o.jsxs(xme,{openDelay:100,closeDelay:100,children:[o.jsx(yme,{asChild:!0,children:o.jsx("div",{className:"cursor-pointer",children:f})}),o.jsxs(vme,{side:"bottom",align:"start",className:"w-56 p-0",children:[o.jsx("div",{className:"px-3 py-2 border-b",children:o.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Top Brands Mentioned"})}),o.jsx("div",{className:"max-h-64 overflow-y-auto",children:t.map((h,p)=>{const{count:m,isLoading:x,source:y,description:g,...w}=h,v=o.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 hover:bg-muted/50",children:[o.jsx(R5,{...w,size:"sm",isLoading:x,source:y,description:g}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"text-xs font-medium truncate",children:h.name}),m!==void 0&&o.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[m," mention",m!==1?"s":""]})]})]});return s&&h.id?o.jsx(Mt,{to:`/company/${s}/competitors/${h.id}`,className:"block",children:v},h.name+p):o.jsx("div",{children:v},h.name+p)})})]})]}):f}function y1t({url:t,title:e,count:n,size:r="md",showTitle:i=!1,className:s}){const a={sm:"h-5 w-5 min-w-[20px]",md:"h-6 w-6 min-w-[24px]",lg:"h-8 w-8 min-w-[32px]"},l={sm:"text-xs",md:"text-sm",lg:"text-base"},u=(()=>{try{return new URL(t).hostname}catch{return null}})(),d=u?`https://www.google.com/s2/favicons?domain=${u}&sz=64`:null,f=e||u||t;return o.jsxs("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:ne("flex items-center gap-1.5 hover:opacity-80 transition-opacity",s),title:`${f}${n?` (${n} citations)`:""}`,children:[o.jsx("div",{className:ne(a[r],"relative rounded-full bg-muted border border-background overflow-hidden shrink-0"),children:d&&o.jsx("img",{src:d,alt:u||"source",className:"absolute inset-0 h-full w-full object-contain"})}),i&&o.jsx("span",{className:ne("font-medium truncate max-w-[150px]",l[r]),children:f})]})}function v1t({sources:t,max:e=5,size:n="md",className:r,totalCount:i}){const s=t.slice(0,e),l=(i??t.length)-s.length,c={sm:"-ml-2 first:ml-0",md:"-ml-2.5 first:ml-0",lg:"-ml-3 first:ml-0"},u={sm:"h-5",md:"h-6",lg:"h-8"},d=h=>{try{return new URL(h).hostname}catch{return h}}
4933,f=o.jsxs("div",{className:ne("inline-flex items-center rounded-full",r),children:[s.map((h,p)=>o.jsx("div",{className:c[n],children:o.jsx(y1t,{...h,size:n})},h.url+p)),l>0&&o.jsxs("div",{className:ne(c[n],u[n],"flex items-center justify-center rounded-full bg-muted border ml-1 px-1.5 text-[10px] font-medium text-muted-foreground whitespace-nowrap"),children:["+",l]})]});return t.length>0?o.jsxs(xme,{openDelay:100,closeDelay:100,children:[o.jsx(yme,{asChild:!0,children:o.jsx("div",{className:"cursor-pointer",children:f})}),o.jsxs(vme,{side:"bottom",align:"start",className:"w-72 p-0",children:[o.jsx("div",{className:"p-3 border-b",children:o.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wider",children:"Sources"})}),o.jsx("div",{className:"max-h-64 overflow-y-auto",children:t.map((h,p)=>{const m=d(h.url),x=`https://www.google.com/s2/favicons?domain=${m}&sz=64`;return o.jsxs("a",{href:h.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-3 px-3 py-2 hover:bg-muted/50",children:[o.jsx("div",{className:"h-6 w-6 relative rounded-full bg-muted border-1 overflow-hidden shrink-0",children:o.jsx("img",{src:x,alt:m,className:"absolute inset-0 h-full w-full object-contain"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"text-sm font-medium truncate",children:h.title||m}),h.count!==void 0&&o.jsxs("p",{className:"text-xs text-muted-foreground",children:[h.count," citation",h.count!==1?"s":""]})]})]},h.url+p)})})]})]}):f}function Ig(){const[t,e]=b.useState(()=>new Date);return b.useEffect(()=>{const n=setInterval(()=>{e(new Date)},1e3);return()=>clearInterval(n)},[]),t}function bl(t,e){if(!t)return"—";const n=typeof t=="string"?new Date(t):t,r=e.getTime()-n.getTime(),i=Math.floor(r/1e3);if(i<0||i<10)return"just now";if(i<60)return`${i}s ago`;const s=Math.floor(i/60);if(s<60)return`${s}m ago`;const a=Math.floor(s/60);if(a<24)return`${a}h ago`;const l=Math.floor(a/24);if(l<7)return`${l}d ago`;const c=Math.floor(l/7);if(c<4)return`${c}w ago`;const u=Math.floor(l/30);return u<12?`${u}mo ago`:`${Math.floor(l/365)}y ago`}function wme(t,e){if(!t)return"—";const r=(typeof t=="string"?new Date(t):t).getTime()-e.getTime();if(r<=0)return"now";const i=Math.floor(r/1e3);if(i<60)return`in ${i}s`;const s=Math.floor(i/60);if(s<60)return`in ${s}m`;const a=Math.floor(s/60);return a<24?`in ${a}h`:`in ${Math.floor(a/24)}d`}function EQ(t){const e=["bg-blue-500/10 text-blue-600 border-blue-500/20 hover:bg-blue-500/20","bg-green-500/10 text-green-600 border-green-500/20 hover:bg-green-500/20","bg-purple-500/10 text-purple-600 border-purple-500/20 hover:bg-purple-500/20","bg-amber-500/10 text-amber-600 border-amber-500/20 hover:bg-amber-500/20","bg-pink-500/10 text-pink-600 border-pink-500/20 hover:bg-pink-500/20","bg-cyan-500/10 text-cyan-600 border-cyan-500/20 hover:bg-cyan-500/20","bg-orange-500/10 text-orange-600 border-orange-500/20 hover:bg-orange-500/20","bg-indigo-500/10 text-indigo-600 border-indigo-500/20 hover:bg-indigo-500/20"];let n=0;for(let r=0;r<t.length;r++)n=t.charCodeAt(r)+((n<<5)-n);return e[Math.abs(n)%e.length]}function b1t({queryId:t,companyId:e,currentTopicId:n,currentTopicName:r,onTopicChange:i}){const[s,a]=b.useState(!1),[l,c]=b.useState(""),[u,d]=b.useState(!1),f=Sa(),{data:h=[],isLoading:p}=En({queryKey:["research-topics",e],queryFn:async()=>await Ce.get(`/companies/${e}/research/topics`),enabled:s&&!!e}),m=b.useMemo(()=>{if(!l.trim())return h;const _=l.toLowerCase();return h.filter(j=>j.name.toLowerCase().includes(_))},[h,l]),x=b.useMemo(()=>h.some(_=>_.name.toLowerCase()===l.toLowerCase().trim()),[h,l]),y=un({mutationFn:async _=>Ce.patch(`/companies/${e}/queries/${t}`,{topicId:_}),onSuccess:(_,j)=>{const A=h.find(C=>C.id===j);i==null||i(j,(A==null?void 0:A.name)||null),f.invalidateQueries({queryKey:["queries",e]}),a(!1),ge.success(j?"Topic assigned":"Topic removed")},onError:_=>{ge.error(_.message||"Failed to update topic")}}),g=un({mutationFn:async _=>Ce.post(`/companies/${e}/research/topics`,{name:_}),onSuccess:async _=>{f.invalidateQueries({queryKey:["research-topics",e]});try{await Ce.patch(`/companies/${e}/queries/${t}`,{topicId:_.id}),i==null||i(_.id,_.name),f.invalidateQueries({queryKey:["queries",e]}),a(!1),ge.success("Topic created and assigned!")}catch(j){ge.error(j.message||"Failed to assign topic")}c("")},onError:_=>{ge.error(_.message||"Failed to create topic")}}),w=_=>{if(_===n){a(!1);return}y.mutate(_)},v=()=>{n&&y.mutate(null)},N=async()=>{const _=l.trim();if(!(!_||x)){d(!0);try{await g.mutateAsync(_)}finally{d(!1)}}},S=y.isPending||g.isPending||u;return o.jsxs(ou,{open:s,onOpenChange:a,children:[o.jsx(lu,{asChild:!0,children:o.jsx(le,{variant:"secondary",size:"sm",className:ne("h-8 gap-2 text-xs flex justify-between font-normal rounded-full w-30",n&&r&&EQ(r)),children:r?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"max-w-[120px] truncate",children:r}),o.jsx(ms,{className:"h-3 w-3 opacity-50"})]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-muted-foreground",children:"-"}),o.jsx(ms,{className:"h-3 w-3 opacity-50"})]})})}),o.jsxs(pc,{className:"w-64 p-0",align:"start",children:[o.jsx("div",{className:"p-2 border-b",children:o.jsxs("div",{className:"relative",children:[o.jsx(Xa,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(gt,{placeholder:"Search or create topic...",value:l,onCh
4933ange:_=>c(_.target.value),className:"h-8 pl-8 pr-8",autoFocus:!0}),l&&o.jsx("button",{onClick:()=>c(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:o.jsx(mr,{className:"h-3 w-3"})})]})}),o.jsx("div",{className:"max-h-[200px] overflow-y-auto p-2",children:p?o.jsx("div",{className:"flex items-center justify-center py-4",children:o.jsx(Me,{className:"h-4 w-4 animate-spin text-muted-foreground"})}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"flex flex-wrap gap-1.5",children:m.map(_=>o.jsxs("button",{onClick:()=>w(_.id),disabled:S,className:ne("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium border transition-colors",EQ(_.name),_.id===n&&"ring-2 ring-offset-1 ring-primary"),children:[_.id===n&&o.jsx(Sn,{className:"h-3 w-3"}),_.name]},_.id))}),m.length===0&&!l&&o.jsx("p",{className:"text-sm text-muted-foreground text-center py-2",children:"No topics yet"}),m.length===0&&l&&!x&&o.jsxs("p",{className:"text-sm text-muted-foreground text-center py-2",children:['No topics match "',l,'"']})]})}),(n||l.trim()&&!x)&&o.jsxs("div",{className:"border-t p-2 space-y-1",children:[n&&o.jsxs("button",{onClick:v,disabled:S,className:"w-full flex items-center gap-2 px-2 py-1.5 text-sm text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",children:[o.jsx(mr,{className:"h-4 w-4"}),"Clear Topic"]}),l.trim()&&!x&&o.jsxs("button",{onClick:N,disabled:S,className:"w-full flex items-center gap-2 px-2 py-1.5 text-sm text-primary hover:bg-accent rounded transition-colors",children:[u?o.jsx(Me,{className:"h-4 w-4 animate-spin"}):o.jsx(yi,{className:"h-4 w-4"}),'Create New Topic "',l.trim(),'"']})]})]})]})}function w1t({countryCode:t,location:e,companyCountryCode:n,companyCountryName:r,onSave:i,disabled:s=!1}){var I;const[a,l]=b.useState(!1),[c,u]=b.useState(t),[d,f]=b.useState(e),[h,p]=b.useState(!1),[m,x]=b.useState(""),[y,g]=b.useState(""),{data:w=[]}=AT(),{data:v=[],isLoading:N}=YPe(y);b.useEffect(()=>{u(t),f(e)},[t,e]);const S=m?w.filter(R=>R.name.toLowerCase().includes(m.toLowerCase())):w,_=()=>{if(!c)return"Worldwide";if(d)return d.split(",")[0]||d;const R=w.find(E=>E.code===c);return(R==null?void 0:R.name)||c},j=R=>{if(!R)return"🌍";const E=R.toUpperCase().split("").map(P=>127397+P.charCodeAt(0));return String.fromCodePoint(...E)},A=()=>{i(c,d),l(!1)},C=R=>{u(R),f(null),g(""),p(!1),x("")},k=R=>{u(R.countryCode),f(R.canonicalName),g("")},M=()=>{u(null),f(null),g("")};return o.jsxs(ou,{open:a,onOpenChange:l,children:[o.jsx(lu,{asChild:!0,children:o.jsxs(le,{variant:"outline",role:"combobox","aria-expanded":a,disabled:s,className:ne("h-auto py-1 px-2 justify-start font-normal text-sm","hover:bg-muted/50"),children:[o.jsx("span",{children:j(c)}),o.jsx("span",{className:"truncate max-w-[100px]",children:_()})]})}),o.jsx(pc,{className:"w-80 p-0",align:"start",children:o.jsxs("div",{className:"p-4 space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{className:"text-xs uppercase text-muted-foreground font-medium",children:"Target Locations"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Select where you want to monitor this prompt."})]}),o.jsxs("div",{className:ne("flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-colors",c?"hover:bg-muted/50":"bg-primary/5 border-primary"),onClick:M,children:[o.jsx(To,{className:"h-4 w-4 text-muted-foreground"}),o.jsx("div",{className:"flex-1",children:o.jsx("p",{className:"text-sm font-medium",children:"Worldwide"})}),!c&&o.jsx(Sn,{className:"h-4 w-4 text-primary"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{className:"text-xs",children:"Country"}),o.jsxs(ou,{open:h,onOpenChange:p,children:[o.jsx(lu,{asChild:!0,children:o.jsxs(le,{variant:"outline",role:"combobox",className:"w-full justify-between",children:[c?o.jsx(o.Fragment,{children:o.jsxs("p",{className:"flex items-center gap-2",children:[o.jsx("span",{children:j(c)}),((I=w.find(R=>R.code===c))==null?void 0:I.name)||c]})}):"Select location...",o.jsx(bg,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),o.jsx(pc,{className:"w-[250px] p-0",align:"start",children:o.jsxs(Kh,{children:[o.jsx(Yh,{placeholder:"Search...",value:m,onValueChange:x}),o.jsx(Xh,{children:"No country found."}),o.jsx(_d,{className:"max-h-48 overflow-y-auto",children:S.slice(0,50).map(R=>o.jsxs(Sd,{value:R.name,onSelect:()=>C(R.code),children:[o.jsx(Sn,{className:ne("mr-2 h-4 w-4",c===R.code?"opacity-100":"opacity-0")}),o.jsx("span",{className:"mr-2",children:j(R.code)}),R.name]},R.code))})]})})]})]}),c&&o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{className:"text-xs",children:"City (optional)"}),o.jsxs("div",{className:"relative",children:[o.jsx(Xa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(gt,{placeholder:"Search for a city...",value:y,onChange:R=>g(R.target.value),className:"pl-9"})]}),y.length>=2&&o.jsx("div",{className:"border rounded-lg max-h-32 overflow-y-auto",children:N?o.jsx("div",{className:"p-3 text-center text-sm text-muted-foreground",children:"Searching..."}):v.length===0?o.jsx("div",{className:"p-3 text-center text-sm text-muted-foreground",children:"No locations foun
4933d"}):v.map(R=>o.jsxs("div",{className:ne("flex items-center gap-2 p-2 cursor-pointer hover:bg-muted/50 transition-colors",d===R.canonicalName&&"bg-primary/5"),onClick:()=>k(R),children:[o.jsx(dH,{className:"h-3 w-3 text-muted-foreground shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"text-sm font-medium truncate",children:R.name}),o.jsx("p",{className:"text-xs text-muted-foreground truncate",children:R.canonicalName})]}),d===R.canonicalName&&o.jsx(Sn,{className:"h-4 w-4 text-primary shrink-0"})]},R.id))}),d&&o.jsxs("div",{className:"flex items-center gap-2 p-2 bg-muted/50 rounded-lg",children:[o.jsx(dH,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"text-xs flex-1 truncate",children:d}),o.jsx(le,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>{f(null),g("")},children:o.jsx(mr,{className:"h-3 w-3"})})]})]}),o.jsx(le,{className:"w-full",onClick:A,children:"Save"})]})})]})}function _1t({query:t,companyId:e,companyCountryCode:n,companyCountryName:r,competitors:i=[],enableSelect:s=!0,isSelected:a=!1,onSelect:l,onLocationChange:c}){var q;const u=e||t.companyId,d=Nr(),[f,h]=b.useState(!1),[p,m]=b.useState(t.topicId||null),[x,y]=b.useState(((q=t.topic)==null?void 0:q.name)||null),[g,w]=b.useState(t.targetCountryCode||null),[v,N]=b.useState(t.targetLocation||null),S=Ig(),_=Jk(B=>B.isQueryRunning(t.id)),j=Jk(B=>B.getQueryStatus(t.id)),A=new Map,C=new Map,k=new Map,M=B=>B.toLowerCase().replace(/[^\w\s]/g,"").replace(/\s+/g,"").replace(/(inc|llc|ltd|corp|company|co)$/i,"");for(const B of i){const z=B.name.toLowerCase();if(A.set(z,B),k.set(M(B.name),B),B.aliases)for(const H of B.aliases){const W=H.name.toLowerCase();C.set(W,B.name),A.set(W,B),k.set(M(H.name),B)}}const I=B=>{const z=B.toLowerCase();if(C.has(z))return C.get(z);const H=M(B),W=k.get(H);return W?W.name:B},R=B=>{const z=B.toLowerCase(),H=A.get(z);if(H)return H;const W=M(B),G=k.get(W);if(G)return G;for(const[K,ee]of A)if(z.includes(K)||K.includes(z))return ee},P=(()=>{const B=new Map;for(const z of t.rankings)for(const H of z.competitorsMentioned){const W=H.normalizedName||H.name,G=I(W),K=R(W),ee=B.get(G.toLowerCase());ee?ee.count++:B.set(G.toLowerCase(),{name:(K==null?void 0:K.name)||G,count:1,info:K})}return Array.from(B.values()).sort((z,H)=>H.count-z.count)})(),O=(B,z="")=>{if(B===null||B===0)return null;const H=B>0;return o.jsxs("span",{className:ne("flex items-center gap-0.5 text-[8px] border-2 border-background text-background whitespace-nowrap px-1 py-0.5 rounded-full",H&&"bg-primary",!H&&"bg-destructive"),children:[H?o.jsx(Tse,{className:"h-2.5 w-2.5"}):o.jsx(Ase,{className:"h-2.5 w-2.5"}),Math.abs(B),z]})},L=B=>B?bl(B,S):"Never",T=B=>{if(_)return o.jsx("span",{className:"text-primary",children:"Running..."});if(!B)return"Soon";const z=new Date(B),H=new Date(z.getTime()+24*60*60*1e3);return H<=S?"Soon":wme(H,S)},F=(()=>{const B=t.rankings.filter(H=>H.isMentioned&&H.sentimentScore!==null);if(B.length===0)return null;const z=B.reduce((H,W)=>H+(W.sentimentScore||0),0);return Math.round(z/B.length)})();return o.jsxs(o.Fragment,{children:[o.jsxs("tr",{className:ne("border-b transition-colors hover:bg-accent/50",f&&"bg-accent/30"),children:[o.jsx("td",{className:"w-12 max-w-12 whitespace-nowrap",children:t.rankings.length>0&&o.jsx(le,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>h(!f),children:f?o.jsx(ms,{className:"h-4 w-4"}):o.jsx(Ga,{className:"h-4 w-4"})})}),s&&o.jsx("td",{className:"w-10 max-w-10 text-center whitespace-nowrap",children:o.jsx(Yr,{checked:a,onChange:B=>l==null?void 0:l(B.target.checked)})}),o.jsx("td",{className:"px-3 py-3 min-w-[300px]",children:o.jsxs("div",{className:"flex items-center gap-2",children:[_&&o.jsx(Me,{className:"h-4 w-4 animate-spin text-primary shrink-0"}),t.stats.mentionRate!==null&&o.jsx(on,{children:o.jsxs(Ft,{children:[o.jsx(Ut,{asChild:!0,children:o.jsx(nr,{value:t.stats.mentionRate,size:"sm",variant:"percentage",className:"shrink-0"})}),o.jsx(zt,{children:o.jsxs("p",{children:["Mention rate: ",t.stats.mentionRate,"%"]})})]})}),o.jsxs(Mt,{to:`/company/${u}/prompts/${t.id}`,className:"text-sm hover:underline",children:[t.promptText,t.dynamicRuns&&o.jsx(on,{children:o.jsxs(Ft,{children:[o.jsx(Ut,{className:"bg-muted-foreground
4933/10 rounded-full ml-1 p-1 inline-flex items-center",asChild:!0,children:o.jsx(q4,{className:"h-4.5 w-4.5 text-chart-1 shrink-0"})}),o.jsx(zt,{children:o.jsx("p",{children:"Dynamic enabled"})})]})})]}),!t.isActive&&o.jsx(Ge,{variant:"secondary",className:"text-xs shrink-0",children:"Paused"}),j==="completed"&&o.jsx(Ge,{variant:"default",className:"text-xs shrink-0 bg-success",children:"Done"})]})}),o.jsx("td",{className:"px-3 py-3 whitespace-nowrap",children:o.jsx(w1t,{countryCode:g,location:v,companyCountryCode:n,companyCountryName:r,onSave:(B,z)=>{w(B),N(z),c==null||c(t.id,B,z)}})}),o.jsx("td",{className:"px-3 py-3 whitespace-nowrap",children:o.jsxs("div",{className:"flex items-center gap-1 pl-3",children:[t.rankings.slice(0,4).map(B=>o.jsx("div",{title:B.llmProvider.displayName,className:"relative -ml-3 border-1 bg-background rounded-full p-1",children:B.llmProvider.logoUrl?o.jsx(Hn,{src:B.llmProvider.logoUrl,alt:B.llmProvider.displayName,className:"h-4 w-4 min-w-4 rounded object-contain"}):o.jsx("div",{className:"flex h-5 w-5 min-w-[20px] items-center justify-center rounded bg-muted text-xs font-medium",children:B.llmProvider.name.charAt(0)})},B.llmProvider.id)),t.rankings.length>4&&o.jsxs("span",{className:"text-xs text-muted-foreground",children:["+",t.rankings.length-4]})]})}),o.jsx("td",{className:"px-3 py-3 text-center whitespace-nowrap",children:o.jsxs("div",{className:"relative flex items-center justify-center gap-1.5",children:[t.stats.avgRank!==null?o.jsx(nr,{value:t.stats.avgRank,size:"md",variant:"rank"}):o.jsx("span",{className:"text-muted-foreground",children:"—"}),t.stats.avgRankChange!==null&&t.stats.avgRankChange!==0&&o.jsx("span",{className:"absolute -bottom-2",children:O(t.stats.avgRankChange)})]})}),o.jsx("td",{className:"px-3 py-3 text-center whitespace-nowrap",children:F!==null?o.jsx(xa,{value:F,size:"md",className:"justify-center",tooltipTitle:`Avg. sentiment of ${F} based on ${t.rankings.filter(B=>B.isMentioned).length} mention${t.rankings.filter(B=>B.isMentioned).length!==1?"s":""}`}):o.jsx("span",{className:"text-muted-foreground",children:"—"})}),o.jsx("td",{className:"px-3 py-3 whitespace-nowrap",children:P.length>0?o.jsx(I5,{competitors:P.map(B=>{var z,H,W,G,K,ee;return{name:B.name,id:(z=B.info)==null?void 0:z.id,website:((H=B.info)==null?void 0:H.website)||null,faviconUrl:((W=B.info)==null?void 0:W.faviconUrl)||((G=B.info)==null?void 0:G.logoUrl)||null,source:(K=B.info)==null?void 0:K.source,description:(ee=B.info)==null?void 0:ee.description,count:B.count}}),max:4,size:"sm",totalCount:P.length,companyId:u}):o.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),o.jsx("td",{className:"px-3 py-3 text-center text-sm whitespace-nowrap",children:t.isActive?T(t.lastRunAt):o.jsx("span",{className:"text-muted-foreground",children:"—"})}),o.jsx("td",{className:"px-3 py-3 whitespace-nowrap",children:o.jsx(b1t,{queryId:t.id,companyId:u,currentTopicId:p,currentTopicName:x,onTopicChange:(B,z)=>{m(B),y(z)}})}),o.jsx("td",{className:"px-3 py-3 whitespace-nowrap",children:o.jsxs(le,{variant:"studio",size:"xs",onClick:B=>{B.stopPropagation();const z=t.rankings[0],H=z?`/company/${u}/prompts/${t.id}/studio?run=${z.id}`:`/company/${u}/prompts/${t.id}/studio`;d(H)},children:[o.jsx(pr,{className:"mr-1 h-3 w-3"}),"Studio"]})})]}),f&&t.rankings.map(B=>o.jsxs("tr",{className:"border-b bg-accent/20 text-sm",children:[o.jsx("td",{className:"px-2"}),s&&o.jsx("td",{className:"px-2"}),o.jsx("td",{className:"px-3 py-2 pl-8",children:o.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[o.jsx("span",{className:"w-4 h-4 border-l-2 border-b-2 border-muted-foreground/30 rounded-bl shrink-0"}),o.jsx(nr,{value:B.isMentioned?100:0,size:"xs",variant:"percentage",displayText:B.isMentioned?"✓":"—",className:"shrink-0"}),o.jsx("span",{className:"line-clamp-2 max-w-[280px] text-xs",children:B.promptUsed||t.promptText})]})}),o.jsx("td",{className:"px-3 py-2"}),o.jsx("td",{className:"px-3 py-2 whitespace-nowrap",children:o.jsxs("div",{className:"flex items-center gap-2",children:[B.llmProvider.logoUrl?o.jsx(Hn,{src:B.llmProvider.logoUrl,alt:B.llmProvider.displayName,className:"h-4 w-4 min-w-[16px] rounded object-contain"}):o.jsx("div",{className:"flex h-4 w-4 min-w-[16px] items-center justify-center rounded bg-muted text-[10px]",children:B.llmProvider.name.charAt(0)}),o.jsx("span",{className:"text-xs",children:B.llmProvider.displayName})]})}),o.jsx("td",{className:"px-3 py-2 text-center whitespace-nowrap",children:B.isMentioned&&B.rankPosition!==null?o.jsx(nr,{value:B.rankPosition,size:"md",variant:"rank",className:"mx-auto"}):B.isMentioned?o.jsx("span",{className:"text-success",children:"✓"}):o.jsx("span",{className:"text-muted-foreground",children:"—"})}),o.jsx("td",{className:"px-3 py-2 text-center whitespace-nowrap",children:B.isMentioned&&B.sentimentScore!==null?o.jsx(xa,{value:B.sentimentScore,size:"md",className:"justify-center",tooltipTitle:`Sentiment score of ${B.sentimentScore}`}):o.jsx("span",{className:"text-muted-foreground",children:"—"})}),o.jsx("td",{className:"px-3 py-2 whitespace-nowrap",children:B.competitorsMentioned.length>0?o.jsx(I5,{competitors:(()=>{const z=new Set;return B.competitorsMentioned.map(H=>{const W=H.normalizedName||H.name,G=I(W),K=R(W);return{name:(K==null?void 0:K.name)||G,id:K==null?void 0:K.id,website:(K==null?void 0:K.website)||null,faviconUrl:(K==null?void 0:K.faviconUrl)||(K==null?void 0:K.logoUrl)||null,source:K==null?void 0:K.source,description:K==null?void 0:K.description}}).filter(H=>{const W=H.name.toLowerCase();return z.has(W)?!1:(z.add(W),!0)})})(),max:4,size:"sm",totalCount:B.competitorsMentioned.length,companyId:u}):o.jsx("span",{className:"text-muted-foreground",children:"—"})}),o.jsx("td",{className:"px-3 py-2 text-center text-xs text-muted-foreground whitespace-nowrap",children:L(B.createdAt)}),o.jsx("td",{className:"px-3 py-2"}),o.jsx("td",{className:"px-3 py-2 whitespace-nowrap",children:o.jsxs(le,{variant:"studio",size:"xs",onClick:z=>{z.stopPropagation(),d(`/company/${u}/prompts/${t.id}/studio?run=${B.id}`)},children:[o.jsx(pr,{className:"mr-1 h-3 w-3"}),"Studio"]})})]},B.id))]})}function _me({queries:t,companyId:e,companyCountryCode:n,companyCountryName:r,competitors:i=[],isLoading:s=!1,enableSelect:a=!0,enabledLlmCount:l=0,onBulkDelete:c,onBulkToggle:u,onBulkRun:d,onLocationChange:f}){const[h,p]=b.useState(new Set),[m,x]=b.useState("lastRunAt"),[y,g]=b.useState("desc"),[w,v]=b.useState(!1),[N,S]=b.useState(!1),[_,j]=b.useState(1),A=10,C=z=>{p(z?new Set(t.map(H=>H.id)):new Set)},k=(z,H)=>{const W=new Set(h);H?W.add(z):W.delete(z),p(W)},M=z=>{m===z?g(y==="asc"?"desc":"asc"):(x(z),g("desc"))},I=async()=>
4933{if(h.size!==0&&confirm(`Are you sure you want to delete ${h.size} queries?`)){v(!0);try{await(c==null?void 0:c(Array.from(h))),p(new Set)}finally{v(!1)}}},R=async()=>{if(h.size!==0){v(!0);try{await(u==null?void 0:u(Array.from(h),!1)),p(new Set)}finally{v(!1)}}},E=async()=>{if(h.size!==0){v(!0);try{await(u==null?void 0:u(Array.from(h),!0)),p(new Set)}finally{v(!1)}}},P=async()=>{if(h.size!==0){v(!0),S(!1);try{await(d==null?void 0:d(Array.from(h))),p(new Set)}finally{v(!1)}}},O=h.size*l,L=b.useMemo(()=>[...t].sort((z,H)=>{let W=0;switch(m){case"promptText":W=z.promptText.localeCompare(H.promptText);break;case"avgRank":const G=z.stats.avgRank??1/0,K=H.stats.avgRank??1/0;W=G-K;break;case"mentionRate":const ee=z.stats.mentionRate??-1;W=(H.stats.mentionRate??-1)-ee;break;case"avgSentiment":const J=z.stats.avgSentiment??-1;W=(H.stats.avgSentiment??-1)-J;break;case"lastRunAt":const $=z.lastRunAt?new Date(z.lastRunAt).getTime():0;W=(H.lastRunAt?new Date(H.lastRunAt).getTime():0)-$;break}return y==="asc"?W:-W}),[t,m,y]),T=Math.ceil(L.length/A),D=b.useMemo(()=>{const z=(_-1)*A;return L.slice(z,z+A)},[L,_,A]);b.useMemo(()=>{_>T&&T>0&&j(1)},[t.length,T]);const F=t.length>0&&h.size===t.length,q=h.size>0&&h.size<t.length,B=({field:z,children:H,className:W})=>{const G=m===z,K=G&&y==="asc"?Kc:ms;return o.jsx("th",{className:ne("px-3 text-left text-xs font-medium text-muted-foreground tracking-wider cursor-pointer hover:text-foreground transition-colors whitespace-nowrap",W),onClick:()=>M(z),children:o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("span",{className:ne(G&&"text-foreground font-bold"),children:H}),o.jsx(K,{className:ne("h-3 w-3",G?"text-foreground":"text-muted-foreground/50")})]})})};return s?o.jsx("div",{className:"flex h-64 items-center justify-center rounded-lg border",children:o.jsx(Me,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):t.length===0?null:o.jsxs("div",{className:"space-y-4",children:[a&&h.size>0&&o.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted/50 rounded-lg border",children:[o.jsxs("span",{className:"text-sm font-medium",children:[h.size," selected"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[d&&o.jsxs(le,{variant:"default",size:"sm",onClick:()=>S(!0),disabled:w||l===0,children:[w?o.jsx(Me,{className:"h-4 w-4 animate-spin"}):o.jsx(bo,{className:"h-4 w-4"}),"Run Now"]}),o.jsxs(le,{variant:"outline",size:"sm",onClick:E,disabled:w,children:[w?o.jsx(Me,{className:"h-4 w-4 animate-spin"}):o.jsx(H1,{className:"h-4 w-4"}),"Activate"]}),o.jsxs(le,{variant:"outline",size:"sm",onClick:R,disabled:w,children:[w?o.jsx(Me,{className:"h-4 w-4 animate-spin"}):o.jsx(Kse,{className:"h-4 w-4"}),"Pause"]}),o.jsxs(le,{variant:"outline",size:"sm",onClick:I,disabled:w,className:"text-destructive hover:text-destructive",children:[w?o.jsx(Me,{className:"h-4 w-4 animate-spin"}):o.jsx(Yi,{className:"mr-2 h-4 w-4"}),"Delete"]})]}),o.jsx(le,{variant:"ghost",size:"sm",onClick:()=>p(new Set),className:"ml-auto",children:"Clear selection"})]}),o.jsxs("div",{className:"overflow-hidden bg-background",children:[o.jsx("div",{className:"overflow-x-auto",children:o.jsxs("table",{className:"w-full card-table",children:[o.jsx("thead",{className:"h-12 border-b",children:o.jsxs("tr",{children:[o.jsx("th",{className:"w-12 max-w-12"}),a&&o.jsx("th",{className:"w-10 max-w-10 text-center",children:o.jsx(Yr,{checked:F,indeterminate:q,onChange:z=>C(z.target.checked)})}),o.jsx(B,{field:"promptText",className:"min-w-[250px]",children:"Prompt"}),o.jsx("th",{className:"px-3 text-left text-xs font-medium text-muted-foreground tracking-wider whitespace-nowrap",children:"Locations"}),o.jsx("th",{className:"px-3 text-left text-xs font-medium text-muted-foreground tracking-wider whitespace-nowrap",children:"LLMs"}),o.jsx(B,{field:"avgRank",className:"text-center",children:"Rank"}),o.jsx(B,{field:"avgSentiment",className:"text-center",children:"Sentiment"}),o.jsx("th",{className:"px-3 text-left text-xs font-medium text-muted-foreground tracking-wider whitespace-nowrap",children:"Top Brands"}),o.jsx(B,{field:"lastRunAt",className:"text-center",children:"Next"}),o.jsx("th",{className:"px-3 text-left text-xs font-medium text-muted-foreground tracking-wider whitespace-nowrap",children:"Topic"}),o.jsx("th",{className:"px-3 text-center text-xs font-medium text-muted-foreground tracking-wider whitespace-nowrap",children:"Studio"})]})}),o.jsx("tbody",{className:"divide-y divide-border",children:D.map(z=>o.jsx(_1t,{query:z,companyId:e,companyCountryCode:n,companyCountryName:r,competitors:i,enableSelect:a,isSelected:h.has(z.id),onSelect:H=>k(z.id,H),onLocationChange:f},z.id))})]})}),T>1&&o.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-t",children:[o.jsxs("p",{className:"text-sm text-muted-foreground",children:["Showing ",(_-1)*A+1," to ",Math.min(_*A,L.length)," of ",L.length," prompts"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(le,{variant:"outline",size:"sm",onClick:()=>j(z=>Math.max(1,z-1)),disabled:_===1,children:o.jsx(wd,{className:"h-4 w-4"})}),o.jsxs("span",{className:"text-sm",children:["Page ",_," of ",T]}
4933),o.jsx(le,{variant:"outline",size:"sm",onClick:()=>j(z=>Math.min(T,z+1)),disabled:_===T,children:o.jsx(Ga,{className:"h-4 w-4"})})]})]})]}),o.jsx(ur,{open:N,onOpenChange:S,children:o.jsxs(tr,{children:[o.jsxs(dr,{children:[o.jsxs(fr,{className:"flex items-center gap-2",children:[o.jsx(bo,{className:"h-5 w-5 text-primary"}),"Run ",h.size," ",h.size===1?"Query":"Queries"," Manually"]}),o.jsx(hr,{children:"You're about to run these queries outside of the daily schedule."})]}),o.jsxs("div",{className:"py-4 space-y-4",children:[o.jsxs("div",{className:"rounded-lg border bg-muted/50 p-4 max-h-32 overflow-y-auto",children:[o.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Selected queries:"}),o.jsxs("ul",{className:"text-sm space-y-1",children:[Array.from(h).slice(0,5).map(z=>{const H=t.find(W=>W.id===z);return o.jsxs("li",{className:"truncate",children:["• ",H==null?void 0:H.promptText]},z)}),h.size>5&&o.jsxs("li",{className:"text-muted-foreground",children:["...and ",h.size-5," more"]})]})]}),o.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg border",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(SS,{className:"h-6 w-6 text-muted-foreground"}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"Total Cost"}),o.jsxs("p",{className:"text-lg font-semibold",children:[O," tokens"]})]})]}),o.jsxs("div",{className:"text-right",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"Running across"}),o.jsxs("p",{className:"font-medium",children:[l," LLM",l!==1?"s":""]})]})]}),o.jsxs("p",{className:"text-xs text-muted-foreground text-center",children:[h.size," ",h.size===1?"query":"queries"," × ",l," LLMs = ",O," tokens"]})]}),o.jsxs(Pr,{children:[o.jsx(le,{variant:"outline",onClick:()=>S(!1),children:"Cancel"}),o.jsx(le,{onClick:P,disabled:w,children:w?o.jsxs(o.Fragment,{children:[o.jsx(Me,{className:"h-4 w-4 animate-spin"}),"Running..."]}):o.jsxs(o.Fragment,{children:[o.jsx(bo,{className:"h-4 w-4"}),"Run Now (",O," tokens)"]})})]})]})})]})}function S1t(){var w,v,N,S,_,j,A,C,k,M,I,R;const{companyId:t}=Gr(),[e,n]=N0(),{companies:r}=Ri(),{refreshProfile:i}=Rr(),s=r.find(E=>E.id===t),[a,l]=b.useState(null),[c,u]=b.useState(!0),[d,f]=b.useState(null),{lastRankingUpdate:h,lastUpdateTimestamp:p}=V1(),m=b.useRef(!0);b.useEffect(()=>{const E=e.get("welcome"),P=e.get("skipped_plan");E==="true"?(ge.success("Welcome! Your subscription is now active."),(async()=>(await new Promise(L=>setTimeout(L,2e3)),await i()))(),e.delete("welcome"),n(e,{replace:!0})):P==="true"&&(ge.info("You can upgrade anytime from Settings > Billing"),e.delete("skipped_plan"),n(e,{replace:!0}))},[e,n,i]);const x=async(E=!1)=>{if(t)try{E||(u(!0),f(null));const P=await Ce.get(`/companies/${t}/dashboard`);l(P)}catch(P){E||f(P.message||"Failed to load dashboard")}finally{E||u(!1)}};b.useEffect(()=>{x()},[t]),b.useEffect(()=>{if(m.current){m.current=!1;return}(h==null?void 0:h.companyId)===t&&p>0&&x(!0)},[p,t]);const{isLoading:y}=Ri();if(y||!s&&!c)return o.jsx("div",{className:"flex flex-1 h-full items-center justify-center",children:o.jsx(Me,{className:"h-8 w-8 animate-spin text-muted-foreground"})});if(!s)return o.jsx("div",{className:"flex flex-1 h-full items-center justify-center",children:o.jsx("p",{className:"text-muted-foreground",children:"Company not found"})});if(c||!a)return o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Dashboard",noIndex:!0}),o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Me,{className:"h-8 w-8 animate-spin text-primary"})})]});if(d)return o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Dashboard",noIndex:!0}),o.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-4",children:[o.jsx("p",{className:"text-destructive",children:d}),o.jsxs(le,{onClick:()=>x(),variant:"outline",children:[o.jsx(ws,{className:"h-4 w-4"}),"Retry"]})]})]});const g=a;return o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:`${s.name} Dashboard`,noIndex:!0}),o.jsxs("div",{className:"",children:[o.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-b",children:[o.jsxs("h1",{className:"text-lg font-bold",children:["Welcome, ",s.name]}),o.jsxs(le,{onClick:()=>x(),variant:"outline",size:"sm",children:[o.jsx(ws,{className:"h-4 w-4"}),"Refresh"]})]}),o.jsx(Xwt,{companyId:t,variant:"banner"}),o.jsxs("div",{className:"grid md:grid-cols-2 lg:grid-cols-4 border-b",children:[o.jsxs(Ct,{className:"relative overflow-hidden border-b lg:border-b-0 md:border-r",children:[o.jsxs(Lt,{className:"flex flex-row items-center justify-between pb-2",children:[o.jsx($t,{className:"text-sm font-medium text-muted-foreground",children:"Brand Sentiment"}),o.jsx(Mo,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Et,{className:"pb-12",children:[o.jsxs("div",{className:"flex items-baseline gap-2",children:[o.jsx("div",{className:"text-2xl font-bold",children:g.avgSentiment!==null?g.avgSentiment:"—"}),((w=g.trends)==null?void 0:w.sentiment)!==null&&((v=g.trends)==null?void 0:v.sentiment)!==void 0&&o.jsxs("span",{className:ne("text-xs font-medium",g.trends.sentiment>0?"text-success":g.trends.sentiment<0?"text-destructive":"text-muted-foreground"),children:[g.trends.sentiment>0?"+":"",g.trends.sentiment,"%"]})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Your brand's sentiment score"})]}),((N=g.sparklines)==null?void 0:N.sentiment)&&g.sparklines.sentiment.filter(E=>E.value!==null).length>0&&o.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-10",children:o.jsx(Qi,{width:"100%",height:"100%",children:o.jsxs(Lh,{data:g.sparklines.sentiment,children:[o.jsx(Bn,{cursor:!1,content:({active:E,payload:P})=>E&&P&&P.length?o.jsx("div",{className:"rounded-lg border bg-background px-2 py-1 shadow-sm",children:o.jsx("span",{className:"text-xs font-medium",children:P[0].value})}):null}),o.jsx(qa,{dataKey:"value",fill:"var(--primary)",radius:[2,2,0,0]})]})})})]}),o.jsxs(Ct,{className:"relative overflow-hidden border-b lg:border-b-0 lg:border-r",children:[o.jsxs(Lt,{className:"flex flex-row items-center justify-between pb-2",children:[o.jsx($t,{className:"text-sm font-medium text-muted-foreground",children:"Average Rank"}),o.jsx(wz,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Et,{className:"pb-12",children:[o.jsxs("div",{className:"flex items-baseline gap-2",children:[o.jsx("div",{className:"text-2xl font-bold",children:g.avgRank!==null?`#${g.avgRank}`:"—"}),((S=g.trends)==null?void 0:S.rank)!==null&&((_=g.trends)==null?void 0:_.rank)!==void 0&&o.jsxs("span",{className:ne("text-xs font-medium",g.trends.rank<0?"text-success":g.trends.rank>0?"text-destructive":"text-muted-foreground"),children:[g.trends.rank>0?"+":"",g.trends.rank,"%"]})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"When brand is mentioned"})]}),((j=g.sparklines)==null?void 0:j.rank)&&g.sparklines.rank.filter(E=>E.value!==null).length>0&&o.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-10",children:o.jsx(Qi,{width:"100%",height:"100%",children:o.jsxs(Dh,{data:g.sparklines.rank.filter(E=>E.value!==null),children:[o.jsx(Bn,{cursor:!1,content:({active:E,payload:P})=>E&&P&&P.length?o.jsx("div",{className:"rounded-lg border bg-background px-2 py-1 shadow-sm",children:o.jsx("span",{className:"text-xs font-medium",children:P[0].value})}):null}),o.jsx(Po,{type:"monotone",dataKey:"value",stroke:"var(--primary)",strokeWidth:1.5,dot:!1})]})})})]}),o.jsxs(Ct,{className:"relative overflow-hidden border-b md:border-b-0 md:border-r",children:[o.jsxs(Lt,{className:"flex flex-row items-center justify-between pb-2",children:[o.jsx($t,{className:"text-sm font-medium text-muted-foreground",children:"Competitors"}),o.jsx(uc,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Et,{className:"pb-12",children:[o.jsxs("div",{className:"flex items-baseline gap-2",children:[o.jsx("div",{className:"text-2xl font-bold",children:g.totalCompetitors}),((A=g.trends)==null?void 0:A.competitors)!==null&&((C=g.trends)==null?void 0:C.competitors)!==void 0&&o.jsxs("span",{className:ne("text-xs font-medium",g.trends.competitors>0?"text-success":g.trends.competitors<0?"text-destructive":"text-muted-foreground"),children:[g.trends.competitors>0?"+":"",g.trends.competitors,"%"]})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Tracked competitors"})]}),((k=g.sparklines)==null?void 0:k.competitors)&&g.sparklines.competitors.length>0&&o.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-10",children:o.jsx(Qi,{width:"100%",height:"100%",children:o.jsxs(Lh,{data:g.sparklines.competitors,children:[o.jsx(Bn,{cursor:!1,content:({active:E,payload:P})=>E&&P&&P.length?o.jsx("div",{className:"rounded-lg border bg-background px-2 py-1 shadow-sm",children:o.jsx("span",{className:"text-xs font-medium",children:P[0].value})}):null}),o.jsx(qa,{dataKey:"value",fill:"var(--primary)",radius:[2,2,0,0]})]})})})]}),o.jsxs(Ct,{className:"relative overflow-hidden",children:[o.jsxs(Lt,{className:"flex flex-row items-center justify-between pb-2",children:[o.jsx($t,{className:"text-sm font-medium text-muted-foreground",children:"Mention Rate"}),o.jsx(Ud,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Et,{className:"pb-12",children:[o.jsxs("div",{className:"flex items-baseline gap-2",children:[o.jsx("div",{className:"text-2xl font-bold",children:g.mentionRate!==null?`${g.mentionRate}%`:"—"}),((M=g.trends)==null?void 0:M.mentionRate)!==null&&((I=g.trends)==null?void 0:I.mentionRate)!==void 0&&o.jsxs("span",{className:ne("text-xs font-medium",g.trends.mentionRate>0?"text-success":g.trends.mentionRate<0?"text-destructive":"text-muted-foreground"),children:[g.trends.mentionRate>0?"+":"",g.trends.mentionRate,"%"]})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Brand mentioned in responses"})]}),((R=g.sparklines)==null?void 0:R.mentionRate)&&g.sparklines.mentionRate.filter(E=>E.value!==null).length>0&&o.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-10",children:o.jsx(Qi,{width:"100%",height:"100%",children:o.jsxs(Dh,{data:g.sparklines.mentionRate.filter(E=>E.value!==null),children:[o.jsx(Bn,{cursor:!1,content:({active:E,payload:P})=>E&&P&&P.length?o.jsx("div",{className:"rounded-lg border bg-background px-2 py-1 shadow-sm",children:o.jsxs("span",{className:"text-xs font-medium",children:[P[0].value,"%"]})}):null}),o.jsx(Po,{type:"monotone",dataKey:"value",stroke:"var(--primary)",strokeWidth:1.5,dot:!1})]})})})]})]}),o.jsxs("div",{className:"",children:[o.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-b",children:[o.jsx("h2",{className:"text-sm font-medium",children:"Recent Prompts"}),o.jsx(Mt,{to:`/company/${t}/prompts`,children:o.jsx(le,{variant:"outline",size:"sm",children:"View all"})})]}),g.recentResults.length===0?o.jsx("div",{className:"flex h-64 items-center justify-center border-b",children:o.jsxs("div",{className:"text-center",children:[o.jsx("h3",{className:"mt-4 text-lg font-medium",children:"No prompts yet"}),o.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Create your first prompt to start tracking brand mentions"}),o.jsx(Mt,{to:`/company/${t}/prompts`,children:o.jsxs(le,{className:"mt-4",children:[o.jsx(yi,{className:"h-4 w-4"}),"Add Prompt"]})})]})}):o.jsx(_me,{queries:g.recentResults,companyId:t,competitors:g.competitors,enableSelect:!1})]}),g.competitors.length>0&&o.jsxs("div",{className:"",children:[o.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-b",children:[o.jsx("h2",{className:"text-sm font-medium",children:"Top Competitors"}),o.jsx(Mt,{to:`/company/${t}/competitors`,children:o.jsx(le,{variant:"outline",size:"sm",children:"View all"})})]}),o.jsx("div",{className:"grid bg-border gap-[1px] sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:g.competitors.filter(E=>
4933!E.primaryCompetitorId).sort((E,P)=>P.totalMentions-E.totalMentions).slice(0,12).map(E=>{var O;const P=((O=E.stats)==null?void 0:O.avgSentiment)??null;return o.jsxs(Mt,{to:`/company/${t}/competitors/${E.id}`,className:"flex items-center gap-3 px-6 py-3 bg-background hover:bg-accent/50 transition-colors",children:[o.jsx(ul,{name:E.name,logoUrl:E.logoUrl,website:E.website,size:"lg",source:E.source,description:E.description}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-medium truncate",children:E.name}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:[E.totalMentions," mentions"]})]}),P!==null?o.jsx(xa,{value:P,size:"sm",tooltipTitle:`Avg. Sentiment: ${P}`}):o.jsx("span",{className:"text-xs text-muted-foreground",children:"—"})]},E.id)})})]})]})]})}const dl=b.forwardRef(({className:t,...e},n)=>o.jsx("textarea",{className:ne("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-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",t),ref:n,...e}));dl.displayName="Textarea";const N1t=t=>t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/plan$/i," Plan").split(/[\s_-]+/).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ").trim();function j1t(){const{companyId:t}=Gr(),{profile:e}=Rr(),[n,r]=b.useState([]),[i,s]=b.useState([]),[a,l]=b.useState(null),[c,u]=b.useState(0),[d,f]=b.useState(!0),[h,p]=b.useState(!1),[m,x]=b.useState(!1),[y,g]=b.useState(""),[w,v]=b.useState(""),[N,S]=b.useState(!0),[_,j]=b.useState(!0),[A,C]=b.useState(!1),[k,M]=b.useState(!1),[I,R]=b.useState(""),{lastRankingUpdate:E,lastUpdateTimestamp:P}=V1(),O=b.useRef(!0),[L,T]=b.useState([]),D=(e==null?void 0:e.promptsUsed)??0,F=(e==null?void 0:e.promptsLimit)??0,q=D>=F,B=()=>{const fe=(e==null?void 0:e.subscriptionTier)||"free",ce=X=>X.toLowerCase().replace(/[^a-z0-9]/g,""),ve=L.find(X=>ce(X.name)===fe);return ve?ve.name:N1t(fe)};b.useEffect(()=>{t&&z()},[t]),b.useEffect(()=>{Ce.get("/billing/plans").then(T).catch(()=>{})},[]),b.useEffect(()=>{if(O.current){O.current=!1;return}(E==null?void 0:E.companyId)===t&&P>0&&(H(),Ce.get(`/companies/${t}/competitors`).then(s).catch(()=>{}))},[P,t]);const z=async()=>{try{f(!0);const[fe,ce,ve,X]=await Promise.all([Ce.get(`/companies/${t}/queries`),Ce.get(`/companies/${t}/competitors`),Ce.get(`/companies/${t}/llms`),Ce.get(`/companies/${t}`)]);r(fe),s(ce),u(ve.limits.current),l(X)}catch(fe){ge.error(fe.message||"Failed to fetch data")}finally{f(!1)}},H=async()=>{try{const fe=await Ce.get(`/companies/${t}/queries`);r(fe)}catch(fe){ge.error(fe.message||"Failed to fetch queries")}},W=async()=>{if(!y.trim()){ge.error("Please enter a prompt");return}C(!0);try{await Ce.post(`/companies/${t}/queries`,{promptText:y.trim(),isDynamic:N}),await H(),g(""),S(!0),p(!1),ge.success("Query added and queued for execution")}catch(fe){ge.error(fe.message||"Failed to add query")}finally{C(!1)}},G=async()=>{M(!0);try{const fe=await Ce.post(`/companies/${t}/queries/auto-generate`);v(fe.suggestion),j(!0),x(!0)}catch(fe){ge.error(fe.message||"Failed to generate prompt suggestion")}finally{M(!1)}},K=async()=>{if(!w.trim()){ge.error("Please enter or modify the prompt");return}C(!0);try{await Ce.post(`/companies/${t}/queries`,{promptText:w.trim(),isDynamic:_}),await H(),v(""),j(!0),x(!1),ge.success("Query added and queued for execution")}catch(fe){ge.error(fe.message||"Failed to add query")}finally{C(!1)}},ee=async fe=>{try{await Promise.all(fe.map(ce=>Ce.delete(`/companies/${t}/queries/${ce}`))),r(n.filter(ce=>!fe.includes(ce.id))),ge.success(`${fe.length} queries deleted`)}catch(ce){ge.error(ce.message||"Failed to delete queries")}},V=async(fe,ce)=>{try{await Promise.all(fe.map(ve=>Ce.patch(`/companies/${t}/queries/${ve}`,{isActive:ce}))),r(n.map(ve=>fe.includes(ve.id)?{...ve,isActive:ce}:ve)),ge.success(`${fe.length} queries ${ce?"activated":"paused"}`)}catch(ve){ge.error(ve.message||"Failed to update queries")}},J=async fe=>{try{const ce=await Ce.post(`/companies/${t}/queries/bulk-manual-run`,{queryIds:fe});return ge.success(`Running ${ce.queriesRun} queries across ${ce.llmCount} LLMs (${ce.totalCost} tokens used)`),{totalCost:ce.totalCost,queriesRun:ce.queriesRun}}catch(ce){throw ge.error(ce.message||"Failed to run queries"),ce}},Y=async(fe,ce,ve)=>{try{await Ce.patch(`/companies/${t}/queries/${fe}`,{targetCountryCode:ce,targetLocation:ve}),r(n.map(X=>X.id===fe?{...X,targetCountryCode:ce,targetLocation:ve}:X)),ge.success("Location updated")}catch(X){ge.error(X.message||"Failed to update location")}},$=n.filter(fe=>fe.promptText.toLowerCase().includes(I.toLowerCase()));return o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Prompts",noIndex:!0}),o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4 py-3 border-b bg-background px-6 sticky top-0 z-10",children:[o.jsxs("div",{className:"relative flex-1 max-w-md",children:[o.jsx(Xa,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),o.jsx(gt,{placeholder:"Search prompts...",value:I,onChange:fe=>R(fe.target.value),className:"pl-9 h-9"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(Ge,{variant:q?"outline":"secondary",className:`text-sm px-2.5 py-1 font-normal ${q?"border-destructive/50 bg-destructive/10 text-destructive":""}`,children:[D," / ",F]}),q&&o.jsx(le,{variant:"outline",size:"sm",asChild:!0,children:o.jsxs(Mt,{to:"/settings/billing",children:["Upgrade ",o.jsx(lTe,{className:"h-3 w-3"})]})}),o.jsxs(le,{variant:"outline",size:"sm",onClick:G,disabled:k||q,children:[k?o.jsx(Me,{className:"h-3.5 w-3.5 animate-spin"}):o.jsx(pr,{className:"h-3.5 w-3.5"}),"Auto-generate"]}),o.jsxs(le,{size:"sm",onClick:()=>p(!0),disabled:q,children:[o.jsx(yi,{className:"h-3.5 w-3.5"}),"Add prompts"]})]})]}),o.jsxs("div",{className:"flex flex-1 flex-col",children:[q&&o.jsx("div",{className:"border-b p-4",children:o.jsxs("p",{className:"text-sm text-muted-foreground",children:[o.jsx("strong",{className:"text-destructive",children:"Prompt limit reached."})," Your ",B()," allows up to ",F," prompts. Upgrade your plan to add more prompts."]})}),d?o.jsx("div",{className:"flex h-full flex-1 items-center justify-center",children:o.jsx(Me,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):n.length===0?o.jsx("div",{className:"flex h-full flex-1 items-center justify-center",children:o.jsxs("div",{className:"text-center max-w-md",children:[o.jsx("h3",{className:"text-xl font-semibold",children:"No prompts yet"}),o.jsx("p",{className:"mt-2 text-muted-foreground",children:"Create your first prompt to start tracking how AI assistants mention your brand. Each prompt runs daily across all selected LLMs."}),!q&&o.jsxs("div",{className:"mt-6 flex gap-3 justify-center",children:[o.jsxs(le,{variant:"outline",onClick:G,disabled:k,children:[k?o.jsx(Me,{className:"h-4 w-4 animate-spin"}):o.jsx(pr,{className:"h-4 w-4"}),"Auto-generate"]}),o.jsxs(le,{onClick:()=>p(!0),children:[o.jsx(yi,{className:"h-4 w-4"}),"Add prompt"]})]})]})}):o.jsx(_me,{queries:$,companyId:t,companyCountryCode:a==null?void 0:a.countryCode,companyCountryName:a==null?void 0:a.country,competitors:i,enableSelect:!0,enabledLlmCount:c,onBulkDelete:ee,onBulkToggle:V,onBulkRun:J,onLocationChange:Y}),o.jsx(ur,{open:h,onOpenChange:p,children:o.jsxs(tr,{className:"sm:max-w-[500px]",children:[o.jsxs(dr,{children:[o.jsx(fr,{children:"Add New Prompt"}),o.jsx(hr,{children:"Create a prompt that will be sent to LLMs daily to track brand mentions. Write questions that potential customers might ask about your industry."})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{htmlFor:"prompt",children:"Prompt"}),o.jsx(dl,{id:"prompt",placeholder:"e.g., What are the best project management tools for startups?",value:y,onChange:fe=>g(fe.target.value),rows:4,className:"resize-none"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Tip: Ask questions that your target audience would ask when looking for solutions in your industry."})]}),o.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-4",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-md bg-primary/10",children:o.jsx(q4,{className:"h-4 w-4 text-primary"})}),o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(et,{htmlFor:"dynamic-prompt",className:"text-sm font-medium cursor-pointer",children:"Dynamic Prompt"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"AI will rephrase this prompt daily for varied results"})]})]}),o.jsx(Zi,{id:"dynamic-prompt",checked:N,onCheckedChange:S})]})]}),o.jsxs(Pr,{children:[o.jsx(le,{variant:"outline",onClick:()=>p(!1),children:"Cancel"}),o.jsxs(le,{onClick:W,disabled:A||!y.trim(),children:[A&&o.jsx(Me,{className:"h-4 w-4 animate-spin"}),"Add Prompt"]})]})]})}),o.jsx(ur,{open:m,onOpenChange:x,children:o.jsxs(tr,{className:"sm:max-w-[500px]",children:[o.jsxs(dr,{children:[o.jsx(fr,{children:"AI-Generated Prompt"}),o.jsx(hr,{children:"Review and customize this AI-suggested prompt for your brand. Feel free to modify it before saving."})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{htmlFor:"auto-prompt",children:"Suggested Prompt"}),o.jsx(dl,{id:"auto-prompt",value:w,onChange:fe=>v(fe.target.value),rows:4,className:"resize-none"})]}),o.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-4",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-md bg-primary/10",children:o.jsx(q4,{className:"h-4 w-4 text-primary"})}),o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(et,{htmlFor:"auto-dynamic-prompt",className:"text-sm font-medium cursor-pointer",children:"Dynamic Prompt"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"AI will rephrase this prompt daily for varied results"})]})]}),o.jsx(Zi,{id:"auto-dynamic-prompt",checked:_,onCheckedChange:j})]})]}),o.jsxs(Pr,{children:[o.jsx(le,{variant:"outline",onClick:()=>x(!1),children:"Cancel"}),o.jsxs(le,{onClick:K,disabled:A||!w.trim(),children:[A&&o.jsx(Me,{className:"h-4 w-4 animate-spin"}),"Save Prompt"]})]})]})})]})]})]})}var f8=lN(),dn=t=>oN(t,f8),h8=lN();dn.write=t=>oN(t,h8);var sP=lN();dn.onStart=t=>oN(t,sP);var p8=lN();dn.onFrame=t=>oN(t,p8);var m8=lN();dn.onFinish=t=>oN(t,m8);var Dy=[];dn.setTimeout=(t,e)=>{const n=dn.now()+e,r=()=>{const s=Dy.findIndex(a=>a.cancel==r);~s&&Dy.splice(s,1),Jf-=~s?1:0},i={time:n,handler:t,cancel:r};return Dy.splice(Sme(n),0,i),Jf+=1,Nme(),i};var Sme=t=>~(~Dy.findIndex(e=>e.time>t)||~Dy.length);dn.cancel=t=>{sP.delete(t),p8.delete(t),m8.delete(t),f8.delete(t),h8.delete(t)};dn.sync=t=>{D5=!0,dn.batchedUpdates(t),D5=!1};dn.throttle=t=>{let e;function n(){try{t(...e)}finally{e=null}}function r(...i){e=i,dn.onStart(n)}return r.handler=t,r.cancel=()=>{sP.delete(n),e=null},r};var g8=typeof window<"u"?window.requestAnimationFrame:()=>{};dn.use=t=>g8=t;dn.now=typeof performance<"u"?()=>performance.now():Date.now;dn.batchedUpdates=t=>t();dn.catch=console.error;dn.frameLoop="always";dn.advance=()=>{dn.frameLoop!=="demand"?console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"):Cme()};var Qf=-1,Jf=0,D5=!1;function oN(t,e){D5?(e.delete(t),t(0)):(e.add(t),Nme())}function Nme(){Qf<0&&(Qf=0,dn.frameLoop!=="demand"&&g8(jme))}function C1t(){Qf=-1}function jme(){~Qf&&(g8(jme),dn.batchedUpdates(Cme))}function Cme(){const t=Qf;Qf=dn.now();const e=Sme(Qf);if(e&&(kme(Dy.splice(0,e),n=>n.handler()),Jf-=e),!Jf){C1t();return}sP.flush(),f8.flush(t?Math.min(64,Qf-t):16.667),p8.flush(),h8.flush(),m8.flush()}function lN(){let t=new Set,e=t;return{add(n){Jf+=e==t&&!t.has(n)?1:0,t.add(n)},delete(n){return Jf-=e==t&&t.has(n)?1:0,t.delete(n)},flush(n){e.size&&(t=new Set,Jf-=e.size,kme(e,r=>r(n)&&t.add(r)),Jf+=t.size,e=t)}}}function kme(t,e){t.forEach(n=>{try{e(n)}catch(r){dn.catch(r)}})}var k1t=Object.defineProperty,E1t=(t,e)=>{for(var n in e)k1t(t,n,{get:e[n],enumerable:!0})},ya={};E1t(ya,{assign:()=>T1t,colors:()=>vh,createStringInterpolator:()=>y8,skipAnimation:()=>Ame,to:()=>Eme,willAdvance:()=>v8});function L5(){}var A1t=(t,e,n)=>Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0}),We={arr:Array.isArray,obj:t=>!!t&&t.constructor.name==="Object",fun:t=>typeof t=="function",str:t=>typeof t=="string",num:t=>typeof t=="number",und:t=>t===void 0};function Bu(t,e){if(We.arr(t)){if(!We.arr(e)||t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}return t===e}var yt=(t,e)=>t.forEach(e);function Ka(t,e,n){if(We.arr(t)){for(let r=0;r<t.length;r++)e.call(n,t[r],`${r}`);return}for(const r in t)t.hasOwnProperty(r)&&e.call(n,t[r],r)}var Ji=t=>We.und(t)?[]:We.arr(t)?t:[t];function Xw(t,e){if(t.size){const n=Array.from(t);t.clear(),yt(n,e)}}var yw=(t,...e)=>Xw(t,n=>n(...e)),x8=()=>typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),y8,Eme,vh=null,Ame=!1,v8=L5,T1t=t=>{t.to&&(Eme=t.to),t.now&&(dn.now=t.now),t.colors!==void 0&&(vh=t.colors),t.skipAnimation!=null&&(Ame=t.skipAnimation),t.createStringInterpolator&&(y8=t.createStringInterpolator),t.requestAnimationFrame&&dn.use(t.requestAnimationFrame),t.batchedUpdates&&(dn.batchedUpdates=t.batchedUpdates),t.willAdvance&&(v8=t.willAdvance),t.frameLoop&&(dn.frameLoop=t.frameLoop)},Qw=new Set,tl=[],e3=[],PE=0,aP={get idle(){return!Qw.size&&!tl.length},start(t){PE>t.priority?(Qw.add(t),dn.onStart(M1t)):(Tme(t),dn($5))},advance:$5,sort(t){if(PE)dn.onFrame(()=>aP.sort(t));else{const e=tl.indexOf(t);~e&&(tl.splice(e,1),Mme(t))}},clear(){tl=[],Qw.clear()}};function M1t(){Qw.forEach(Tme),Qw.clear(),dn($5)}function Tme(t){tl.includes(t)||Mme(t)}function Mme(t){tl.splice(P1t(tl,e=>e.priority>t.priority),0,t)}function $5(t){const e=e3;for(let n=0;n<tl.length;n++){const r=tl[n];PE=r.priority,r.idle||(v8(r),r.advance(t),r.idle||e.push(r))}return PE=0,e3=tl,e3.length=0,tl=e,tl.length>0}function P1t(t,e){const n=t.findIndex(e);return n<0?t.length:n}var cN={transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,dar
4933kgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199},tc="[-+]?\\d*\\.?\\d+",OE=tc+"%";function oP(...t){return"\\(\\s*("+t.join(")\\s*,\\s*(")+")\\s*\\)"}var O1t=new RegExp("rgb"+oP(tc,tc,tc)),R1t=new RegExp("rgba"+oP(tc,tc,tc,tc)),I1t=new RegExp("hsl"+oP(tc,OE,OE)),D1t=new RegExp("hsla"+oP(tc,OE,OE,tc)),L1t=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,$1t=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,F1t=/^#([0-9a-fA-F]{6})$/,U1t=/^#([0-9a-fA-F]{8})$/;function z1t(t){let e;return typeof t=="number"?t>>>0===t&&t>=0&&t<=4294967295?t:null:(e=F1t.exec(t))?parseInt(e[1]+"ff",16)>>>0:vh&&vh[t]!==void 0?vh[t]:(e=O1t.exec(t))?(jx(e[1])<<24|jx(e[2])<<16|jx(e[3])<<8|255)>>>0:(e=R1t.exec(t))?(jx(e[1])<<24|jx(e[2])<<16|jx(e[3])<<8|MQ(e[4]))>>>0:(e=L1t.exec(t))?parseInt(e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+"ff",16)>>>0:(e=U1t.exec(t))?parseInt(e[1],16)>>>0:(e=$1t.exec(t))?parseInt(e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+e[4]+e[4],16)>>>0:(e=I1t.exec(t))?(AQ(TQ(e[1]),Kj(e[2]),Kj(e[3]))|255)>>>0:(e=D1t.exec(t))?(AQ(TQ(e[1]),Kj(e[2]),Kj(e[3]))|MQ(e[4]))>>>0:null}function t3(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function AQ(t,e,n){const r=n<.5?n*(1+e):n+e-n*e,i=2*n-r,s=t3(i,r,t+1/3),a=t3(i,r,t),l=t3(i,r,t-1/3);return Math.round(s*255)<<24|Math.round(a*255)<<16|Math.round(l*255)<<8}function jx(t){const e=parseInt(t,10);return e<0?0:e>255?255:e}function TQ(t){return(parseFloat(t)%360+360)%360/360}function MQ(t){const e=parseFloat(t);return e<0?0:e>1?255:Math.round(e*255)}function Kj(t){const e=parseFloat(t);return e<0?0:e>100?1:e/100}function PQ(t){let e=z1t(t);if(e===null)return t;e=e||0;const n=(e&4278190080)>>>24,r=(e&16711680)>>>16,i=(e&65280)>>>8,s=(e&255)/255;return`rgba(${n}, ${r}, ${i}, ${s})`}var $_=(t,e,n)=>{if(We.fun(t))return t;if(We.arr(t))return $_({range:t,output:e,extrapolate:n});if(We.str(t.output[0]))return y8(t);const r=t,i=r.output,s=r.range||[0,1],a=r.extrapolateLeft||r.extrapolate||"extend",l=r.extrapolateRight||r.extrapolate||"extend",c=r.easing||(u=>u);return u=>{const d=V1t(u,s);return B1t(u,s[d],s[d+1],i[d],i[d+1],c,a,l,r.map)}};function B1t(t,e,n,r,i,s,a,l,c){let u=c?c(t):t;if(u<e){if(a==="identity")return u;a==="clamp"&&(u=e)}if(u>n){if(l==="identity")return u;l==="clamp"&&(u=n)}return r===i?r:e===n?t<=e?r:i:(e===-1/0?u=-u:n===1/0?u=u-e:u=(u-e)/(n-e),u=s(u),r===-1/0?u=-u:i===1/0?u=u+r:u=u*(i-r)+r,u)}
4933function V1t(t,e){for(var n=1;n<e.length-1&&!(e[n]>=t);++n);return n-1}var H1t={linear:t=>t},F_=Symbol.for("FluidValue.get"),Jv=Symbol.for("FluidValue.observers"),ki=t=>!!(t&&t[F_]),fi=t=>t&&t[F_]?t[F_]():t,OQ=t=>t[Jv]||null;function W1t(t,e){t.eventObserved?t.eventObserved(e):t(e)}function Rd(t,e){const n=t[Jv];n&&n.forEach(r=>{W1t(r,e)})}var Y0=class{constructor(t){if(!t&&!(t=this.get))throw Error("Unknown getter");G1t(this,t)}},G1t=(t,e)=>Pme(t,F_,e);function wu(t,e){if(t[F_]){let n=t[Jv];n||Pme(t,Jv,n=new Set),n.has(e)||(n.add(e),t.observerAdded&&t.observerAdded(n.size,e))}return e}function Id(t,e){const n=t[Jv];if(n&&n.has(e)){const r=n.size-1;r?n.delete(e):t[Jv]=null,t.observerRemoved&&t.observerRemoved(r,e)}}var Pme=(t,e,n)=>Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0}),ik=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q1t=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,RQ=new RegExp(`(${ik.source})(%|[a-z]+)`,"i"),K1t=/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,lP=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/,Ome=t=>{const[e,n]=Y1t(t);if(!e||x8())return t;const r=window.getComputedStyle(document.documentElement).getPropertyValue(e);if(r)return r.trim();if(n&&n.startsWith("--")){const i=window.getComputedStyle(document.documentElement).getPropertyValue(n);return i||t}else{if(n&&lP.test(n))return Ome(n);if(n)return n}return t},Y1t=t=>{const e=lP.exec(t);if(!e)return[,];const[,n,r]=e;return[n,r]},n3,X1t=(t,e,n,r,i)=>`rgba(${Math.round(e)}, ${Math.round(n)}, ${Math.round(r)}, ${i})`,X0=t=>{n3||(n3=vh?new RegExp(`(${Object.keys(vh).join("|")})(?!\\w)`,"g"):/^\b$/);const e=t.output.map(s=>fi(s).replace(lP,Ome).replace(q1t,PQ).replace(n3,PQ)),n=e.map(s=>s.match(ik).map(Number)),i=n[0].map((s,a)=>n.map(l=>{if(!(a in l))throw Error('The arity of each "output" value must be equal');return l[a]})).map(s=>$_({...t,output:s}));return s=>{var c;const a=!RQ.test(e[0])&&((c=e.find(u=>RQ.test(u)))==null?void 0:c.replace(ik,""));let l=0;return e[0].replace(ik,()=>`${i[l++](s)}${a||""}`).replace(K1t,X1t)}},b8="react-spring: ",Rme=t=>{const e=t;let n=!1;if(typeof e!="function")throw new TypeError(`${b8}once requires a function parameter`);return(...r)=>{n||(e(...r),n=!0)}},Q1t=Rme(console.warn);function J1t(){Q1t(`${b8}The "interpolate" function is deprecated in v9 (use "to" instead)`)}var Z1t=Rme(console.warn);function e_t(){Z1t(`${b8}Directly calling start instead of using the api object is deprecated in v9 (use ".start" instead), this will be removed in later 0.X.0 versions`)}function cP(t){return We.str(t)&&(t[0]=="#"||/\d/.test(t)||!x8()&&lP.test(t)||t in(vh||{}))}var im=x8()?b.useEffect:b.useLayoutEffect,t_t=()=>{const t=b.useRef(!1);return im(()=>(t.current=!0,()=>{t.current=!1}),[]),t};function w8(){const t=b.useState()[1],e=t_t();return()=>{e.current&&t(Math.random())}}var _8=t=>b.useEffect(t,n_t),n_t=[];function F5(t){const e=b.useRef(void 0);return b.useEffect(()=>{e.current=t}),e.current}var U_=Symbol.for("Animated:node"),r_t=t=>!!t&&t[U_]===t,Oc=t=>t&&t[U_],S8=(t,e)=>A1t(t,U_,e),uP=t=>t&&t[U_]&&t[U_].getPayload(),Ime=class{constructor(){S8(this,this)}getPayload(){return this.payload||[]}},dP=class Dme extends Ime{constructor(e){super(),this._value=e,this.done=!0,this.durationProgress=0,We.num(this._value)&&(this.lastPosition=this._value)}static create(e){return new Dme(e)}getPayload(){return[this]}getValue(){return this._value}setValue(e,n){return We.num(e)&&(this.lastPosition=e,n&&(e=Math.round(e/n)*n,this.done&&(this.lastPosition=e))),this._value===e?!1:(this._value=e,!0)}reset(){const{done:e}=this;this.done=!1,We.num(this._value)&&(this.elapsedTime=0,this.durationProgress=0,this.lastPosition=this._value,e&&(this.lastVelocity=null),this.v0=null)}},RE=class Lme extends dP{constructor(e){super(0),this._string=null,this._toString=$_({output:[e,e]})}static create(e){return new Lme(e)}getValue(){const e=this._string;return e??(this._string=this._toString(this._value))}setValue(e){if(We.str(e)){if(e==this._string)return!1;this._string=e,this._value=1}else if(super.setValue(e))this._string=null;else return!1;return!0}reset(e){e&&(this._toString=$_({output:[this.getValue(),e]})),this._value=0,super.reset()}},IE={dependencies:null},ip=class extends Ime{constructor(t){super(),this.source=t,this.setValue(t)}getValue(t){const e={};return Ka(this.source,(n,r)=>{r_t(n)?e[r]=n.getValue(t):ki(n)?e[r]=fi(n):t||(e[r]=n)}),e}setValue(t){this.source=t,this.payload=this._makePayload(t)}reset(){this.payload&&yt(this.payload,t=>t.reset())}_makePayload(t){if(t){const e=new Set;return Ka(t,this._addToPayload,e),Array.from(e)}}_addToPayload(t){IE.dependencies&&ki(t)&&IE.dependencies.add(t);const e=uP(t);e&&yt(e,n=>this.add(n))}},i_t=class $me extends ip{constructor(e){super(e)}static create(e){return new $me(e)}getValue(){return this.source.map(e=>e.getValue())}setValue(e){const n=this.getPayload();return e.length==n.length?n.map((r,i)=>r.setValue(e[i])).some(Boolean):(super.setValue(e.map(s_t)),!0)}};function s_t(t){return(cP(t)?RE:dP).create(t)}function U5(t){const e=Oc(t);return e?e.constructor:We.arr(t)?i_t:cP(t)?RE:dP}var IQ=(t,e)=>{const n=!We.fun(t)||t.prototype&&t.prototype.isReactComponent;return b.forwardRef((r,i)=>{const s=b.useRef(null),a=n&&b.useCallback(m=>{s.current=l_t(i,m)},[i]),[l,c]=o_t(r,e),u=w8(),d=()=>{const m=s.current;if(n&&!m)return;(m?e.applyAnimatedValues(m,l.getValue(!0)):!1)===!1&&u()},f=new a_t(d,c),h=b.useRef(void 0);im(()=>(h.current=f,yt(c,m=>wu(m,f)),()=>{h.current&&(yt(h.current.deps,m=>Id(m,h.current)),dn.cancel(h.current.update))})),b.useEffect(d,[]),_8(()=>()=>{const m=h.current;yt(m.deps,x=>Id(x,m))});const p=e.getComponentProps(l.getValue());return b.createElement(t,{...p,ref:a})})},a_t=class{constructor(t,e){this.update=t,this.deps=e}eventObserved(t){t.type=="change"&&dn.write(this.update)}};function o_t(t,e){const n=new Set;return IE.dependencies=n,t.style&&(t={...t,style:e.createAnimatedStyle(t.style)}),t=new ip(t),IE.dependencies=null,[t,n]}function l_t(t,e){return t&&(We.fun(t)?t(e):t.current=e),e}var DQ=Symbol.for("AnimatedComponent"),uN=(t,{applyAnimatedValues:e=()=>!1,createAnimatedStyle:n=i=>new ip(i),getComponentProps:r=i=>i}={})=>{const i={applyAnimatedValues:e,createAnimatedStyle:n,getComponentProps:r},s=a=>{const l=LQ(a)||"Anonymous";return We.str(a)?a=s[a]||(s[a]=IQ(a,i)):a=a[DQ]||(a[DQ]=IQ(a,i)),a.displayName=`Animated(${l})`,a};return Ka(t,(a,l)=>{We.arr(t)&&(l=LQ(a)),s[l]=s(a)}),{animated:s}},LQ=t=>We.str(t)?t:t&&We.str(t.displayName)?t.displayName:We.fun(t)&&t.name||null;function Ia(t,...e){return We.fun(t)?t(...e):t}var Jw=(t,e)=>t===!0||!!(e&&t&&(We.fun(t)?t(e):Ji(t).includes(e))),Fme=(t,e)=>We.obj(t)?e&&t[e]:t,Ume=(t,e)=>t.default===!0?t[e]:t.default?t.default[e]:void 0,c_t=t=>t,fP=(t,e=c_t)=>{let n=u_t;t.default&&t.default!==!0&&(t=t.default,n=Object.keys(t));const r={};for(const i of n){const s=e(t[i],i);We.und(s)||(r[i]=s)}return r},u_t=["config","onProps","onStart","onChange","onPause","onResume","onRest"],d_t={config:1,from:1,to:1,ref:1,loop:1,reset:1,pause:1,cancel:1,reverse:1,immediate:1,default:1,delay:1,onProps:1,onStart:1,onChange:1,onPause:1,onResume:1,onRest:1,onResolve:1,items:1,trail:1,sort:1,expires:1,initial:1,enter:1,update:1,leave:1,children:1,onDestroyed:1,keys:1,callId:1,parentId:1};function f_t(t){const e={};let n=0;if(Ka(t,(r,i)=>{d_t[i]||(e[i]=r,n++)}),n)return e}function N8(t){const e=f_t(t);if(e){const n={to:e};return Ka(t,(r,i)=>i in e||(n[i]=r)),n}return{...t}}function z_(t){return t=fi(t),We.arr(t)?t.map(z_):cP(t)?ya.createStringInterpolator({range:[0,1],output:[t,t]})(1):t}function zme(t){for(const e in t)return!0;return!1}function z5(t){return We.fun(t)||We.arr(t)&&We.obj(t[0])}function B5(t,e){var n;(n=t.ref)==null||n.delete(t),e==null||e.delete(t)}function Bme(t,e){var n;e&&t.ref!==e&&((n=t.ref)==null||n.delete(t),e.add(t),t.ref=e)}var Vme={default:{tension:170,friction:26},gentle:{tension:120,friction:14},wobbly:{tension:180,friction:12},stiff:{tension:210,friction:20},slow:{tension:280,friction:60},molasses:{tension:280,friction:120}},V5={...Vme.default,mass:1,damping:1,easing:H1t.linear,clamp:!1},h_t=class{constructor(){this.velocity=0,Object.assign(this,V5)}};function p_t(t,e,n){n&&(n={...n},$Q(n,e),e={...n,...e}),$Q(t,e),Object.assign(t,e);for(const a in V5)t[a]==null&&(t[a]=V5[a]);let{frequency:r,damping:i}=t;const{mass:s}=t;return We.und(r)||(r<.01&&(r=.01),i<0&&(i=0),t.tension=Math.pow(2*Math.PI/r,2)*s,t.friction=4*Math.PI*i*s/r),t}function $Q(t,e){if(!We.und(e.decay))t.duration=void 0;else{const n=!We.und(e.tension)||!We.und(e.friction);
4933(n||!We.und(e.frequency)||!We.und(e.damping)||!We.und(e.mass))&&(t.duration=void 0,t.decay=void 0),n&&(t.frequency=void 0)}}var FQ=[],m_t=class{constructor(){this.changed=!1,this.values=FQ,this.toValues=null,this.fromValues=FQ,this.config=new h_t,this.immediate=!1}};function Hme(t,{key:e,props:n,defaultProps:r,state:i,actions:s}){return new Promise((a,l)=>{let c,u,d=Jw(n.cancel??(r==null?void 0:r.cancel),e);if(d)p();else{We.und(n.pause)||(i.paused=Jw(n.pause,e));let m=r==null?void 0:r.pause;m!==!0&&(m=i.paused||Jw(m,e)),c=Ia(n.delay||0,e),m?(i.resumeQueue.add(h),s.pause()):(s.resume(),h())}function f(){i.resumeQueue.add(h),i.timeouts.delete(u),u.cancel(),c=u.time-dn.now()}function h(){c>0&&!ya.skipAnimation?(i.delayed=!0,u=dn.setTimeout(p,c),i.pauseQueue.add(f),i.timeouts.add(u)):p()}function p(){i.delayed&&(i.delayed=!1),i.pauseQueue.delete(f),i.timeouts.delete(u),t<=(i.cancelId||0)&&(d=!0);try{s.start({...n,callId:t,cancel:d},a)}catch(m){l(m)}}})}var j8=(t,e)=>e.length==1?e[0]:e.some(n=>n.cancelled)?Ly(t.get()):e.every(n=>n.noop)?Wme(t.get()):Kl(t.get(),e.every(n=>n.finished)),Wme=t=>({value:t,noop:!0,finished:!0,cancelled:!1}),Kl=(t,e,n=!1)=>({value:t,finished:e,cancelled:n}),Ly=t=>({value:t,cancelled:!0,finished:!1});function Gme(t,e,n,r){const{callId:i,parentId:s,onRest:a}=e,{asyncTo:l,promise:c}=n;return!s&&t===l&&!e.reset?c:n.promise=(async()=>{n.asyncId=i,n.asyncTo=t;const u=fP(e,(y,g)=>g==="onRest"?void 0:y);let d,f;const h=new Promise((y,g)=>(d=y,f=g)),p=y=>{const g=i<=(n.cancelId||0)&&Ly(r)||i!==n.asyncId&&Kl(r,!1);if(g)throw y.result=g,f(y),y},m=(y,g)=>{const w=new UQ,v=new zQ;return(async()=>{if(ya.skipAnimation)throw B_(n),v.result=Kl(r,!1),f(v),v;p(w);const N=We.obj(y)?{...y}:{...g,to:y};N.parentId=i,Ka(u,(_,j)=>{We.und(N[j])&&(N[j]=_)});const S=await r.start(N);return p(w),n.paused&&await new Promise(_=>{n.resumeQueue.add(_)}),S})()};let x;if(ya.skipAnimation)return B_(n),Kl(r,!1);try{let y;We.arr(t)?y=(async g=>{for(const w of g)await m(w)})(t):y=Promise.resolve(t(m,r.stop.bind(r))),await Promise.all([y.then(d),h]),x=Kl(r.get(),!0,!1)}catch(y){if(y instanceof UQ)x=y.result;else if(y instanceof zQ)x=y.result;else throw y}finally{i==n.asyncId&&(n.asyncId=s,n.asyncTo=s?l:void 0,n.promise=s?c:void 0)}return We.fun(a)&&dn.batchedUpdates(()=>{a(x,r,r.item)}),x})()}function B_(t,e){Xw(t.timeouts,n=>n.cancel()),t.pauseQueue.clear(),t.resumeQueue.clear(),t.asyncId=t.asyncTo=t.promise=void 0,e&&(t.cancelId=e)}var UQ=class extends Error{constructor(){super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise.")}},zQ=class extends Error{constructor(){super("SkipAnimationSignal")}},H5=t=>t instanceof C8,g_t=1,C8=class extends Y0{constructor(){super(...arguments),this.id=g_t++,this._priority=0}get priority(){return this._priority}set priority(t){this._priority!=t&&(this._priority=t,this._onPriorityChange(t))}get(){const t=Oc(this);return t&&t.getValue()}to(...t){return ya.to(this,t)}interpolate(...t){return J1t(),ya.to(this,t)}toJSON(){return this.get()}observerAdded(t){t==1&&this._attach()}observerRemoved(t){t==0&&this._detach()}_attach(){}_detach(){}_onChange(t,e=!1){Rd(this,{type:"change",parent:this,value:t,idle:e})}_onPriorityChange(t){this.idle||aP.sort(this),Rd(this,{type:"priority",parent:this,priority:t})}},ng=Symbol.for("SpringPhase"),qme=1,W5=2,G5=4,r3=t=>(t[ng]&qme)>0,of=t=>(t[ng]&W5)>0,Db=t=>(t[ng]&G5)>0,BQ=(t,e)=>e?t[ng]|=W5|qme:t[ng]&=~W5,VQ=(t,e)=>e?t[ng]|=G5:t[ng]&=~G5,x_t=class extends C8{constructor(t,e){if(super(),this.animation=new m_t,this.defaultProps={},this._state={paused:!1,delayed:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._pendingCalls=new Set,this._lastCallId=0,this._lastToId=0,this._memoizedDuration=0,!We.und(t)||!We.und(e)){const n=We.obj(t)?{...t}:{...e,from:t};We.und(n.default)&&(n.default=!0),this.start(n)}}get idle(){return!(of(this)||this._state.asyncTo)||Db(this)}get goal(){return fi(this.animation.to)}get velocity(){const t=Oc(this);return t instanceof dP?t.lastVelocity||0:t.getPayload().map(e=>e.lastVelocity||0)}get hasAnimated(){return r3(this)}get isAnimating(){return of(this)}get isPaused(){return Db(this)}get isDelayed(){return this._state.delayed}advance(t){let e=!0,n=!1;const r=this.animation;let{toValues:i}=r;const{config:s}=r,a=uP(r.to);
4933!a&&ki(r.to)&&(i=Ji(fi(r.to))),r.values.forEach((u,d)=>{if(u.done)return;const f=u.constructor==RE?1:a?a[d].lastPosition:i[d];let h=r.immediate,p=f;if(!h){if(p=u.lastPosition,s.tension<=0){u.done=!0;return}let m=u.elapsedTime+=t;const x=r.fromValues[d],y=u.v0!=null?u.v0:u.v0=We.arr(s.velocity)?s.velocity[d]:s.velocity;let g;const w=s.precision||(x==f?.005:Math.min(1,Math.abs(f-x)*.001));if(We.und(s.duration))if(s.decay){const v=s.decay===!0?.998:s.decay,N=Math.exp(-(1-v)*m);p=x+y/(1-v)*(1-N),h=Math.abs(u.lastPosition-p)<=w,g=y*N}else{g=u.lastVelocity==null?y:u.lastVelocity;const v=s.restVelocity||w/10,N=s.clamp?0:s.bounce,S=!We.und(N),_=x==f?u.v0>0:x<f;let j,A=!1;const C=1,k=Math.ceil(t/C);for(let M=0;M<k&&(j=Math.abs(g)>v,!(!j&&(h=Math.abs(f-p)<=w,h)));++M){S&&(A=p==f||p>f==_,A&&(g=-g*N,p=f));const I=-s.tension*1e-6*(p-f),R=-s.friction*.001*g,E=(I+R)/s.mass;g=g+E*C,p=p+g*C}}else{let v=1;s.duration>0&&(this._memoizedDuration!==s.duration&&(this._memoizedDuration=s.duration,u.durationProgress>0&&(u.elapsedTime=s.duration*u.durationProgress,m=u.elapsedTime+=t)),v=(s.progress||0)+m/this._memoizedDuration,v=v>1?1:v<0?0:v,u.durationProgress=v),p=x+s.easing(v)*(f-x),g=(p-u.lastPosition)/t,h=v==1}u.lastVelocity=g,Number.isNaN(p)&&(console.warn("Got NaN while animating:",this),h=!0)}a&&!a[d].done&&(h=!1),h?u.done=!0:e=!1,u.setValue(p,s.round)&&(n=!0)});const l=Oc(this),c=l.getValue();if(e){const u=fi(r.to);(c!==u||n)&&!s.decay?(l.setValue(u),this._onChange(u)):n&&s.decay&&this._onChange(c),this._stop()}else n&&this._onChange(c)}set(t){return dn.batchedUpdates(()=>{this._stop(),this._focus(t),this._set(t)}),this}pause(){this._update({pause:!0})}resume(){this._update({pause:!1})}finish(){if(of(this)){const{to:t,config:e}=this.animation;dn.batchedUpdates(()=>{this._onStart(),e.decay||this._set(t,!1),this._stop()})}return this}update(t){return(this.queue||(this.queue=[])).push(t),this}start(t,e){let n;return We.und(t)?(n=this.queue||[],this.queue=[]):n=[We.obj(t)?t:{...e,to:t}],Promise.all(n.map(r=>this._update(r))).then(r=>j8(this,r))}stop(t){const{to:e}=this.animation;return this._focus(this.get()),B_(this._state,t&&this._lastCallId),dn.batchedUpdates(()=>this._stop(e,t)),this}reset(){this._update({reset:!0})}eventObserved(t){t.type=="change"?this._start():t.type=="priority"&&(this.priority=t.priority+1)}_prepareNode(t){const e=this.key||"";let{to:n,from:r}=t;n=We.obj(n)?n[e]:n,(n==null||z5(n))&&(n=void 0),r=We.obj(r)?r[e]:r,r==null&&(r=void 0);const i={to:n,from:r};return r3(this)||(t.reverse&&([n,r]=[r,n]),r=fi(r),We.und(r)?Oc(this)||this._set(n):this._set(r)),i}_update({...t},e){const{key:n,defaultProps:r}=this;t.default&&Object.assign(r,fP(t,(a,l)=>/^on/.test(l)?Fme(a,n):a)),WQ(this,t,"onProps"),$b(this,"onProps",t,this);const i=this._prepareNode(t);if(Object.isFrozen(this))throw Error("Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?");const s=this._state;return Hme(++this._lastCallId,{key:n,props:t,defaultProps:r,state:s,actions:{pause:()=>{Db(this)||(VQ(this,!0),yw(s.pauseQueue),$b(this,"onPause",Kl(this,Lb(this,this.animation.to)),this))},resume:()=>{Db(this)&&(VQ(this,!1),of(this)&&this._resume(),yw(s.resumeQueue),$b(this,"onResume",Kl(this,Lb(this,this.animation.to)),this))},start:this._merge.bind(this,i)}}).then(a=>{if(t.loop&&a.finished&&!(e&&a.noop)){const l=Kme(t);if(l)return this._update(l,!0)}return a})}_merge(t,e,n){if(e.cancel)return this.stop(!0),n(Ly(this));const r=!We.und(t.to),i=!We.und(t.from);if(r||i)if(e.callId>this._lastToId)this._lastToId=e.callId;else return n(Ly(this));const{key:s,defaultProps:a,animation:l}=this,{to:c,from:u}=l;let{to:d=c,from:f=u}=t;i&&!r&&(!e.default||We.und(d))&&(d=f),e.reverse&&([d,f]=[f,d]);const h=!Bu(f,u);h&&(l.from=f),f=fi(f);const p=!Bu(d,c);p&&this._focus(d);const m=z5(e.to),{config:x}=l,{decay:y,velocity:g}=x;(r||i)&&(x.velocity=0),e.config&&!m&&p_t(x,Ia(e.config,s),e.config!==a.config?Ia(a.config,s):void 0);let w=Oc(this);if(!w||We.und(d))return n(Kl(this,!0));const v=We.und(e.reset)?i&&!e.default:!We.und(f)&&Jw(e.reset,s),N=v?f:this.get(),S=z_(d),_=We.num(S)||We.arr(S)||cP(S),j=!m&&(!_||Jw(a.immediate||e.immediate,s));if(p){const M=U5(d);if(M!==w.constructor)if(j)w=this._set(S);else throw Error(`Cannot animate between ${w.constructor.name} and ${M.name}, as the "to" prop suggests`)}const A=w.constructor;let C=ki(d),k=!1;if(!C){const M=v||!r3(this)&&h;(p||M)&&(k=Bu(z_(N),S),C=!k),(!Bu(l.immediate,j)&&!j||!Bu(x.decay,y)||!Bu(x.velocity,g))&&(C=!0)}if(k&&of(this)&&(l.changed&&!v?C=!0:C||this._stop(c)),!m&&((C||ki(c))&&(l.values=w.getPayload(),l.toValues=ki(d)?null:A==RE?[1]:Ji(S)),l.immediate!=j&&(l.immediate=j,!j&&!v&&this._set(c)),C)){const{onRest:M}=l;yt(v_t,R=>WQ(this,e,R));const I=Kl(this,Lb(this,c));
4933yw(this._pendingCalls,I),this._pendingCalls.add(n),l.changed&&dn.batchedUpdates(()=>{var R;l.changed=!v,M==null||M(I,this),v?Ia(a.onRest,I):(R=l.onStart)==null||R.call(l,I,this)})}v&&this._set(N),m?n(Gme(e.to,e,this._state,this)):C?this._start():of(this)&&!p?this._pendingCalls.add(n):n(Wme(N))}_focus(t){const e=this.animation;t!==e.to&&(OQ(this)&&this._detach(),e.to=t,OQ(this)&&this._attach())}_attach(){let t=0;const{to:e}=this.animation;ki(e)&&(wu(e,this),H5(e)&&(t=e.priority+1)),this.priority=t}_detach(){const{to:t}=this.animation;ki(t)&&Id(t,this)}_set(t,e=!0){const n=fi(t);if(!We.und(n)){const r=Oc(this);if(!r||!Bu(n,r.getValue())){const i=U5(n);!r||r.constructor!=i?S8(this,i.create(n)):r.setValue(n),r&&dn.batchedUpdates(()=>{this._onChange(n,e)})}}return Oc(this)}_onStart(){const t=this.animation;t.changed||(t.changed=!0,$b(this,"onStart",Kl(this,Lb(this,t.to)),this))}_onChange(t,e){e||(this._onStart(),Ia(this.animation.onChange,t,this)),Ia(this.defaultProps.onChange,t,this),super._onChange(t,e)}_start(){const t=this.animation;Oc(this).reset(fi(t.to)),t.immediate||(t.fromValues=t.values.map(e=>e.lastPosition)),of(this)||(BQ(this,!0),Db(this)||this._resume())}_resume(){ya.skipAnimation?this.finish():aP.start(this)}_stop(t,e){if(of(this)){BQ(this,!1);const n=this.animation;yt(n.values,i=>{i.done=!0}),n.toValues&&(n.onChange=n.onPause=n.onResume=void 0),Rd(this,{type:"idle",parent:this});const r=e?Ly(this.get()):Kl(this.get(),Lb(this,t??n.to));yw(this._pendingCalls,r),n.changed&&(n.changed=!1,$b(this,"onRest",r,this))}}};
4933function Lb(t,e){const n=z_(e),r=z_(t.get());return Bu(r,n)}function Kme(t,e=t.loop,n=t.to){const r=Ia(e);if(r){const i=r!==!0&&N8(r),s=(i||t).reverse,a=!i||i.reset;return V_({...t,loop:e,default:!1,pause:void 0,to:!s||z5(n)?n:void 0,from:a?t.from:void 0,reset:a,...i})}}function V_(t){const{to:e,from:n}=t=N8(t),r=new Set;return We.obj(e)&&HQ(e,r),We.obj(n)&&HQ(n,r),t.keys=r.size?Array.from(r):null,t}function y_t(t){const e=V_(t);return We.und(e.default)&&(e.default=fP(e)),e}function HQ(t,e){Ka(t,(n,r)=>n!=null&&e.add(r))}var v_t=["onStart","onRest","onChange","onPause","onResume"];function WQ(t,e,n){t.animation[n]=e[n]!==Ume(e,n)?Fme(e[n],t.key):void 0}function $b(t,e,...n){var r,i,s,a;(i=(r=t.animation)[e])==null||i.call(r,...n),(a=(s=t.defaultProps)[e])==null||a.call(s,...n)}var b_t=["onStart","onChange","onRest"],w_t=1,Yme=class{constructor(t,e){this.id=w_t++,this.springs={},this.queue=[],this._lastAsyncId=0,this._active=new Set,this._changed=new Set,this._started=!1,this._state={paused:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._events={onStart:new Map,onChange:new Map,onRest:new Map},this._onFrame=this._onFrame.bind(this),e&&(this._flush=e),t&&this.start({default:!0,...t})}get idle(){return!this._state.asyncTo&&Object.values(this.springs).every(t=>t.idle&&!t.isDelayed&&!t.isPaused)}get item(){return this._item}set item(t){this._item=t}get(){const t={};return this.each((e,n)=>t[n]=e.get()),t}set(t){for(const e in t){const n=t[e];We.und(n)||this.springs[e].set(n)}}update(t){return t&&this.queue.push(V_(t)),this}start(t){let{queue:e}=this;return t?e=Ji(t).map(V_):this.queue=[],this._flush?this._flush(this,e):(ege(this,e),q5(this,e))}stop(t,e){if(t!==!!t&&(e=t),e){const n=this.springs;yt(Ji(e),r=>n[r].stop(!!t))}else B_(this._state,this._lastAsyncId),this.each(n=>n.stop(!!t));return this}pause(t){if(We.und(t))this.start({pause:!0});else{const e=this.springs;yt(Ji(t),n=>e[n].pause())}return this}resume(t){if(We.und(t))this.start({pause:!1});else{const e=this.springs;yt(Ji(t),n=>e[n].resume())}return this}each(t){Ka(this.springs,t)}_onFrame(){const{onStart:t,onChange:e,onRest:n}=this._events,r=this._active.size>0,i=this._changed.size>0;(r&&!this._started||i&&!this._started)&&(this._started=!0,Xw(t,([l,c])=>{c.value=this.get(),l(c,this,this._item)}));const s=!r&&this._started,a=i||s&&n.size?this.get():null;i&&e.size&&Xw(e,([l,c])=>{c.value=a,l(c,this,this._item)}),s&&(this._started=!1,Xw(n,([l,c])=>{c.value=a,l(c,this,this._item)}))}eventObserved(t){if(t.type=="change")this._changed.add(t.parent),t.idle||this._active.add(t.parent);else if(t.type=="idle")this._active.delete(t.parent);else return;dn.onFrame(this._onFrame)}};function q5(t,e){return Promise.all(e.map(n=>Xme(t,n))).then(n=>j8(t,n))}async function Xme(t,e,n){const{keys:r,to:i,from:s,loop:a,onRest:l,onResolve:c}=e,u=We.obj(e.default)&&e.default;a&&(e.loop=!1),i===!1&&(e.to=null),s===!1&&(e.from=null);const d=We.arr(i)||We.fun(i)?i:void 0;d?(e.to=void 0,e.onRest=void 0,u&&(u.onRest=void 0)):yt(b_t,x=>{const y=e[x];if(We.fun(y)){const g=t._events[x];e[x]=({finished:w,cancelled:v})=>{const N=g.get(y);N?(w||(N.finished=!1),v&&(N.cancelled=!0)):g.set(y,{value:null,finished:w||!1,cancelled:v||!1})},u&&(u[x]=e[x])}});const f=t._state;e.pause===!f.paused?(f.paused=e.pause,yw(e.pause?f.pauseQueue:f.resumeQueue)):f.paused&&(e.pause=!0);const h=(r||Object.keys(t.springs)).map(x=>t.springs[x].start(e)),p=e.cancel===!0||Ume(e,"cancel")===!0;(d||p&&f.asyncId)&&h.push(Hme(++t._lastAsyncId,{props:e,state:f,actions:{pause:L5,resume:L5,start(x,y){p?(B_(f,t._lastAsyncId),y(Ly(t))):(x.onRest=l,y(Gme(d,x,f,t)))}}})),f.paused&&await new Promise(x=>{f.resumeQueue.add(x)});const m=j8(t,await Promise.all(h));if(a&&m.finished&&!(n&&m.noop)){const x=Kme(e,a,i);if(x)return ege(t,[x]),Xme(t,x,!0)}return c&&dn.batchedUpdates(()=>c(m,t,t.item)),m}function K5(t,e){const n={...t.springs};return e&&yt(Ji(e),r=>{We.und(r.keys)&&(r=V_(r)),We.obj(r.to)||(r={...r,to:void 0}),Zme(n,r,i=>Jme(i))}),Qme(t,n),n}function Qme(t,e){Ka(e,(n,r)=>{t.springs[r]||(t.springs[r]=n,wu(n,t))})}function Jme(t,e){const n=new x_t;return n.key=t,e&&wu(n,e),n}
4933function Zme(t,e,n){e.keys&&yt(e.keys,r=>{(t[r]||(t[r]=n(r)))._prepareNode(e)})}function ege(t,e){yt(e,n=>{Zme(t.springs,n,r=>Jme(r,t))})}var tge=b.createContext({pause:!1,immediate:!1}),nge=()=>{const t=[],e=function(r){e_t();const i=[];return yt(t,(s,a)=>{if(We.und(r))i.push(s.start());else{const l=n(r,s,a);l&&i.push(s.start(l))}}),i};e.current=t,e.add=function(r){t.includes(r)||t.push(r)},e.delete=function(r){const i=t.indexOf(r);~i&&t.splice(i,1)},e.pause=function(){return yt(t,r=>r.pause(...arguments)),this},e.resume=function(){return yt(t,r=>r.resume(...arguments)),this},e.set=function(r){yt(t,(i,s)=>{const a=We.fun(r)?r(s,i):r;a&&i.set(a)})},e.start=function(r){const i=[];return yt(t,(s,a)=>{if(We.und(r))i.push(s.start());else{const l=this._getProps(r,s,a);l&&i.push(s.start(l))}}),i},e.stop=function(){return yt(t,r=>r.stop(...arguments)),this},e.update=function(r){return yt(t,(i,s)=>i.update(this._getProps(r,i,s))),this};const n=function(r,i,s){return We.fun(r)?r(s,i):r};return e._getProps=n,e};function k8(t,e,n){const r=We.fun(e)&&e;r&&!n&&(n=[]);const i=b.useMemo(()=>r||arguments.length==3?nge():void 0,[]),s=b.useRef(0),a=w8(),l=b.useMemo(()=>({ctrls:[],queue:[],flush(g,w){const v=K5(g,w);return s.current>0&&!l.queue.length&&!Object.keys(v).some(S=>!g.springs[S])?q5(g,w):new Promise(S=>{Qme(g,v),l.queue.push(()=>{S(q5(g,w))}),a()})}}),[]),c=b.useRef([...l.ctrls]),u=b.useRef([]),d=F5(t)||0;b.useMemo(()=>{yt(c.current.slice(t,d),g=>{B5(g,i),g.stop(!0)}),c.current.length=t,f(d,t)},[t]),b.useMemo(()=>{f(0,Math.min(d,t))},n);function f(g,w){for(let v=g;v<w;v++){const N=c.current[v]||(c.current[v]=new Yme(null,l.flush)),S=r?r(v,N):e[v];S&&(u.current[v]=y_t(S))}}const h=c.current.map((g,w)=>K5(g,u.current[w])),p=b.useContext(tge),m=F5(p),x=p!==m&&zme(p);im(()=>{s.current++,l.ctrls=c.current;const{queue:g}=l;g.length&&(l.queue=[],yt(g,w=>w())),yt(c.current,(w,v)=>{i==null||i.add(w),x&&w.start({default:p});const N=u.current[v];N&&(Bme(w,N.ref),w.ref?w.queue.push(N):w.start(N))})}),_8(()=>()=>{yt(l.ctrls,g=>g.stop(!0))});const y=h.map(g=>({...g}));return i?[y,i]:y}function sp(t,e){const n=We.fun(t),[[r],i]=k8(1,n?t:[t],n?[]:e);return n||arguments.length==2?[r,i]:r}function rge(t,e,n){const r=We.fun(e)&&e,{reset:i,sort:s,trail:a=0,expires:l=!0,exitBeforeEnter:c=!1,onDestroyed:u,ref:d,config:f}=r?r():e,h=b.useMemo(()=>r||arguments.length==3?nge():void 0,[]),p=Ji(t),m=[],x=b.useRef(null),y=i?null:x.current;im(()=>{x.current=m}),_8(()=>(yt(m,E=>{h==null||h.add(E.ctrl),E.ctrl.ref=h}),()=>{yt(x.current,E=>{E.expired&&clearTimeout(E.expirationId),B5(E.ctrl,h),E.ctrl.stop(!0)})}));const g=S_t(p,r?r():e,y),w=i&&x.current||[];im(()=>yt(w,({ctrl:E,item:P,key:O})=>{B5(E,h),Ia(u,P,O)}));const v=[];if(y&&yt(y,(E,P)=>{E.expired?(clearTimeout(E.expirationId),w.push(E)):(P=v[P]=g.indexOf(E.key),~P&&(m[P]=E))}),yt(p,(E,P)=>{m[P]||(m[P]={key:g[P],item:E,phase:"mount",ctrl:new Yme},m[P].ctrl.item=E)}),v.length){let E=-1;const{leave:P}=r?r():e;yt(v,(O,L)=>{const T=y[L];~O?(E=m.indexOf(T),m[E]={...T,item:p[O]}):P&&m.splice(++E,0,T)})}We.fun(s)&&m.sort((E,P)=>s(E.item,P.item));let N=-a;const S=w8(),_=fP(e),j=new Map,A=b.useRef(new Map),C=b.useRef(!1);yt(m,(E,P)=>{const O=E.key,L=E.phase,T=r?r():e;let D,F;const q=Ia(T.delay||0,O);if(L=="mount")D=T.enter,F="enter";else{const W=g.indexOf(O)<0;if(L!="leave")if(W)D=T.leave,F="leave";else if(D=T.update)F="update";else return;else if(!W)D=T.enter,F="enter";else return}if(D=Ia(D,E.item,P),D=We.obj(D)?N8(D):{to:D},!D.config){const W=f||_.config;D.config=Ia(W,E.item,P,F)}N+=a;const B={..._,delay:q+N,ref:d,immediate:T.immediate,reset:!1,...D};if(F=="enter"&&We.und(B.from)){const W=r?r():e,G=We.und(W.initial)||y?W.from:W.initial;B.from=Ia(G,E.item,P)}const{onResolve:z}=B;B.onResolve=W=>{Ia(z,W);const G=x.current,K=G.find(ee=>ee.key===O);if(K&&!(W.cancelled&&K.phase!="update")&&K.ctrl.idle){const ee=G.every(V=>V.ctrl.idle);if(K.phase=="leave"){const V=Ia(l,K.item);if(V!==!1){const J=V===!0?0:V;if(K.expired=!0,!ee&&J>0){J<=2147483647&&(K.expirationId=setTimeout(S,J));return}}}ee&&G.some(V=>V.expired)&&(A.current.delete(K),c&&(C.current=!0),S())}};const H=K5(E.ctrl,B);F==="leave"&&c?A.current.set(E,{phase:F,springs:H,payload:B}):j.set(E,{phase:F,springs:H,payload:B})});const k=b.useContext(tge),M=F5(k),I=k!==M&&zme(k);im(()=>{I&&yt(m,E=>{E.ctrl.start({default:k})})},[k]),yt(j,(E,P)=>{if(A.current.size){const O=m.findIndex(L=>L.key===P.key);m.splice(O,1)}}),im(()=>{yt(A.current.size?A.current:j,({phase:E,payload:P},O)=>{const{ctrl:L}=O;O.phase=E,h==null||h.add(L),I&&E=="enter"&&L.start({default:k}),P&&(Bme(L,P.ref),(L.ref||h)&&!C.current?L.update(P):(L.start(P),C.current&&(C.current=!1)))})},i?void 0:n);const R=E=>b.createElement(b.Fragment,null,m.map((P,O)=>{const{springs:L}=j.get(P)||P.ctrl,T=E({...L},P.item,P,O),D=We.str(P.key)||We.num(P.key)?P.key:P.ctrl.id,F=b.ver
4933sion<"19.0.0",q=(T==null?void 0:T.props)??{},B=F?T==null?void 0:T.ref:q==null?void 0:q.ref;return T&&T.type?b.createElement(T.type,{...q,key:D,ref:B}):T}));return h?[R,h]:R}var __t=1;function S_t(t,{key:e,keys:n=e},r){if(n===null){const i=new Set;return t.map(s=>{const a=r&&r.find(l=>l.item===s&&l.phase!=="leave"&&!i.has(l));return a?(i.add(a),a.key):__t++})}return We.und(n)?t:We.fun(n)?t.map(n):Ji(n)}var ige=class extends C8{constructor(t,e){super(),this.source=t,this.idle=!0,this._active=new Set,this.calc=$_(...e);const n=this._get(),r=U5(n);S8(this,r.create(n))}advance(t){const e=this._get(),n=this.get();Bu(e,n)||(Oc(this).setValue(e),this._onChange(e,this.idle)),!this.idle&&GQ(this._active)&&i3(this)}_get(){const t=We.arr(this.source)?this.source.map(fi):Ji(fi(this.source));return this.calc(...t)}_start(){this.idle&&!GQ(this._active)&&(this.idle=!1,yt(uP(this),t=>{t.done=!1}),ya.skipAnimation?(dn.batchedUpdates(()=>this.advance()),i3(this)):aP.start(this))}_attach(){let t=1;yt(Ji(this.source),e=>{ki(e)&&wu(e,this),H5(e)&&(e.idle||this._active.add(e),t=Math.max(t,e.priority+1))}),this.priority=t,this._start()}_detach(){yt(Ji(this.source),t=>{ki(t)&&Id(t,this)}),this._active.clear(),i3(this)}eventObserved(t){t.type=="change"?t.idle?this.advance():(this._active.add(t.parent),this._start()):t.type=="idle"?this._active.delete(t.parent):t.type=="priority"&&(this.priority=Ji(this.source).reduce((e,n)=>Math.max(e,(H5(n)?n.priority:0)+1),0))}};function N_t(t){return t.idle!==!1}function GQ(t){return!t.size||Array.from(t).every(N_t)}function i3(t){t.idle||(t.idle=!0,yt(uP(t),e=>{e.done=!0}),Rd(t,{type:"idle",parent:t}))}var sge=(t,...e)=>new ige(t,e);ya.assign({createStringInterpolator:X0,to:(t,e)=>new ige(t,e)});var age=/^--/;function j_t(t,e){return e==null||typeof e=="boolean"||e===""?"":typeof e=="number"&&e!==0&&!age.test(t)&&!(Zw.hasOwnProperty(t)&&Zw[t])?e+"px":(""+e).trim()}var qQ={};function C_t(t,e){if(!t.nodeType||!t.setAttribute)return!1;const n=t.nodeName==="filter"||t.parentNode&&t.parentNode.nodeName==="filter",{className:r,style:i,children:s,scrollTop:a,scrollLeft:l,viewBox:c,...u}=e,d=Object.values(u),f=Object.keys(u).map(h=>n||t.hasAttribute(h)?h:qQ[h]||(qQ[h]=h.replace(/([A-Z])/g,p=>"-"+p.toLowerCase())));s!==void 0&&(t.textContent=s);for(const h in i)if(i.hasOwnProperty(h)){const p=j_t(h,i[h]);age.test(h)?t.style.setProperty(h,p):t.style[h]=p}f.forEach((h,p)=>{t.setAttribute(h,d[p])}),r!==void 0&&(t.className=r),a!==void 0&&(t.scrollTop=a),l!==void 0&&(t.scrollLeft=l),c!==void 0&&t.setAttribute("viewBox",c)}var Zw={animationIterationCount:!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,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},k_t=(t,e)=>t+e.charAt(0).toUpperCase()+e.substring(1),E_t=["Webkit","Ms","Moz","O"];Zw=Object.keys(Zw).reduce((t,e)=>(E_t.forEach(n=>t[k_t(n,e)]=t[e]),t),Zw);var A_t=/^(matrix|translate|scale|rotate|skew)/,T_t=/^(translate)/,M_t=/^(rotate|skew)/,s3=(t,e)=>We.num(t)&&t!==0?t+e:t,sk=(t,e)=>We.arr(t)?t.every(n=>sk(n,e)):We.num(t)?t===e:parseFloat(t)===e,P_t=class extends ip{constructor({x:e,y:n,z:r,...i}){const s=[],a=[];(e||n||r)&&(s.push([e||0,n||0,r||0]),a.push(l=>[`translate3d(${l.map(c=>s3(c,"px")).join(",")})`,sk(l,0)])),Ka(i,(l,c)=>{if(c==="transform")s.push([l||""]),a.push(u=>[u,u===""]);else if(A_t.test(c)){if(delete i[c],We.und(l))return;const u=T_t.test(c)?"px":M_t.test(c)?"deg":"";s.push(Ji(l)),a.push(c==="rotate3d"?([d,f,h,p])=>[`rotate3d(${d},${f},${h},${s3(p,u)})`,sk(p,0)]:d=>[`${c}(${d.map(f=>s3(f,u)).join(",")})`,sk(d,c.startsWith("scale")?1:0)])}}),s.length&&(i.transform=new O_t(s,a)),super(i)}},O_t=class extends Y0{constructor(e,n){super(),this.inputs=e,this.transforms=n,this._value=null}get(){return this._value||(this._value=this._get())}_get(){let e="",n=!0;return yt(this.inputs,(r,i)=>{const s=fi(r[0]),[a,l]=this.transforms[i](We.arr(s)?s:r.map(fi));e+=" "+a,n=n&&l}),n?"none":e}
4933observerAdded(e){e==1&&yt(this.inputs,n=>yt(n,r=>ki(r)&&wu(r,this)))}observerRemoved(e){e==0&&yt(this.inputs,n=>yt(n,r=>ki(r)&&Id(r,this)))}eventObserved(e){e.type=="change"&&(this._value=null),Rd(this,e)}},R_t=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"];ya.assign({batchedUpdates:wl.unstable_batchedUpdates,createStringInterpolator:X0,colors:cN});var I_t=uN(R_t,{applyAnimatedValues:C_t,createAnimatedStyle:t=>new P_t(t),getComponentProps:({scrollTop:t,scrollLeft:e,...n})=>n}),oge=I_t.animated,D_t=FM,L_t=BS;function $_t(t,e,n){(n!==void 0&&!L_t(t[e],n)||n===void 0&&!(e in t))&&D_t(t,e,n)}var lge=$_t,F_t=Eg,U_t=vu;function z_t(t){return U_t(t)&&F_t(t)}var cge=z_t;function B_t(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}var uge=B_t,V_t=$dt,H_t=mhe;function W_t(t){return V_t(t,H_t(t))}var G_t=W_t,KQ=lge,q_t=Jdt,K_t=sft,Y_t=eft,X_t=hft,YQ=mM,XQ=ja,Q_t=cge,J_t=B6,Z_t=GT,eSt=Lo,tSt=gfe,nSt=W6,QQ=uge,rSt=G_t;function iSt(t,e,n,r,i,s,a){var l=QQ(t,n),c=QQ(e,n),u=a.get(c);if(u){KQ(t,n,u);return}var d=s?s(l,c,n+"",t,e,a):void 0,f=d===void 0;if(f){var h=XQ(c),p=!h&&J_t(c),m=!h&&!p&&nSt(c);d=c,h||p||m?XQ(l)?d=l:Q_t(l)?d=Y_t(l):p?(f=!1,d=q_t(c,!0)):m?(f=!1,d=K_t(c,!0)):d=[]:tSt(c)||YQ(c)?(d=l,YQ(l)?d=rSt(l):(!eSt(l)||Z_t(l))&&(d=X_t(c))):f=!1}f&&(a.set(c,d),i(d,c,r,s,a),a.delete(c)),KQ(t,n,d)}var sSt=iSt,aSt=$6,oSt=lge,lSt=wue,cSt=sSt,uSt=Lo,dSt=mhe,fSt=uge;function dge(t,e,n,r,i){t!==e&&lSt(e,function(s,a){if(i||(i=new aSt),uSt(s))cSt(t,e,a,n,dge,r,i);else{var l=r?r(fSt(t,a),s,a+"",t,e,i):void 0;l===void 0&&(l=s),oSt(t,a,l)}},dSt)}var hSt=dge,pSt=X6,mSt=HS;function gSt(t){return pSt(function(e,n){var r=-1,i=n.length,s=i>1?n[i-1]:void 0,a=i>2?n[2]:void 0;for(s=t.length>3&&typeof s=="function"?(i--,s):void 0,a&&mSt(n[0],n[1],a)&&(s=i<3?void 0:s,i=1),e=Object(e);++r<i;){var l=n[r];l&&t(e,l,r,s)}return e})}var xSt=gSt,ySt=hSt,vSt=xSt,bSt=vSt(function(t,e,n){ySt(t,e,n)}),wSt=bSt;const fge=An(wSt);var _St=phe,SSt=JT,NSt=gM,JQ=Lo,jSt=VS;function CSt(t,e,n,r){if(!JQ(t))return t;e=SSt(e,t);for(var i=-1,s=e.length,a=s-1,l=t;l!=null&&++i<s;){var c=jSt(e[i]),u=n;if(c==="__proto__"||c==="constructor"||c==="prototype")return t;if(i!=a){var d=l[c];u=r?r(d,c,l):void 0,u===void 0&&(u=JQ(d)?d:NSt(e[i+1])?[]:{})}_St(l,c,u),l=l[c]}return t}var hge=CSt,kSt=hge;function ESt(t,e,n){return t==null?t:kSt(t,e,n)}var ASt=ESt;const vw=An(ASt);function Y5(){return Y5=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Y5.apply(null,arguments)}function TSt(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var MSt=["outlineWidth","outlineColor","outlineOpacity"],PSt=function(t){return t.outlineWidth,t.outlineColor,t.outlineOpacity,TSt(t,MSt)},OSt=["axis.ticks.text","axis.legend.text","legends.title.text","legends.text","legends.ticks.text","legends.title.text","labels.text","dots.text","markers.text","annotations.text"],RSt=function(t,e){return Y5({},e,t)},ISt=function(t,e){var n=fge({},t,e);return OSt.forEach(function(r){vw(n,r,RSt(vi(n,r),n.text))}),n},DSt=function(t,e){return e?fge({},t,e):t},LSt={background:"transparent",text:{fontFamily:"sans-serif",fontSize:11,fill:"#333333",outlineWidth:0,outlineColor:"#ffffff",outlineOpacity:1},axis:{domain:{line:{stroke:"transparent",strokeWidth:1}},ticks:{line:{stroke:"#777777",strokeWidth:1},text:{}},legend:{text:{fontSize:12}}},grid:{line:{stroke:"#dddddd",strokeWidth:1}}
4933,legends:{hidden:{symbol:{fill:"#333333",opacity:.6},text:{fill:"#333333",opacity:.6}},text:{},ticks:{line:{stroke:"#777777",strokeWidth:1},text:{fontSize:10}},title:{text:{}}},labels:{text:{}},markers:{lineColor:"#000000",lineStrokeWidth:1,text:{}},dots:{text:{}},tooltip:{container:{background:"white",color:"inherit",fontSize:"inherit",borderRadius:"2px",boxShadow:"0 1px 2px rgba(0, 0, 0, 0.25)",padding:"5px 9px"},basic:{whiteSpace:"pre",display:"flex",alignItems:"center"},chip:{marginRight:7},table:{},tableCell:{padding:"3px 5px"},tableCellValue:{fontWeight:"bold"}},crosshair:{line:{stroke:"#000000",strokeWidth:1,strokeOpacity:.75,strokeDasharray:"6 6"}},annotations:{text:{fontSize:13,outlineWidth:2,outlineColor:"#ffffff",outlineOpacity:1},link:{stroke:"#000000",strokeWidth:1,outlineWidth:2,outlineColor:"#ffffff",outlineOpacity:1},outline:{fill:"none",stroke:"#000000",strokeWidth:2,outlineWidth:2,outlineColor:"#ffffff",outlineOpacity:1},symbol:{fill:"#000000",outlineWidth:2,outlineColor:"#ffffff",outlineOpacity:1}}},$St=function(t){return b.useMemo(function(){return ISt(LSt,t)},[t])},FSt=function(t,e){return b.useMemo(function(){return DSt(t,e)},[t,e])},pge=b.createContext(null),USt={},zSt=function(t){var e=t.theme,n=e===void 0?USt:e,r=t.children,i=$St(n);return o.jsx(pge.Provider,{value:i,children:r})},ka=function(){var t=b.useContext(pge);if(t===null)throw new Error("Unable to find the theme, did you forget to wrap your component with ThemeProvider?");return t};function rg(){return rg=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},rg.apply(null,arguments)}var BSt=["basic","chip","container","table","tableCell","tableCellValue"],VSt={pointerEvents:"none",position:"absolute",zIndex:10,top:0,left:0},ZQ=function(t,e){return"translate("+t+"px, "+e+"px)"},mge=b.memo(function(t){var e,n=t.position,r=t.anchor,i=t.children,s=ka(),a=_c(),l=a.animate,c=a.config,u=_kt(),d=u[0],f=u[1],h=b.useRef(!1),p=void 0,m=!1,x=f.width>0&&f.height>0,y=Math.round(n[0]),g=Math.round(n[1]);x&&(r==="top"?(y-=f.width/2,g-=f.height+14):r==="right"?(y+=14,g-=f.height/2):r==="bottom"?(y-=f.width/2,g+=14):r==="left"?(y-=f.width+14,g-=f.height/2):r==="center"&&(y-=f.width/2,g-=f.height/2),p={transform:ZQ(y,g)},h.current||(m=!0),h.current=[y,g]);var w=sp({to:p,config:c,immediate:!l||m}),v=s.tooltip;v.basic,v.chip,v.container,v.table,v.tableCell,v.tableCellValue;var N=function(_,j){if(_==null)return{};var A={};for(var C in _)if({}.hasOwnProperty.call(_,C)){if(j.indexOf(C)!==-1)continue;A[C]=_[C]}return A}(v,BSt),S=rg({},VSt,N,{transform:(e=w.transform)!=null?e:ZQ(y,g),opacity:w.transform?1:0});return o.jsx(oge.div,{ref:d,style:S,children:i})});mge.displayName="TooltipWrapper";var HSt=b.memo(function(t){var e=t.size,n=e===void 0?12:e,r=t.color,i=t.style;return o.jsx("span",{style:rg({display:"block",width:n,height:n,background:r},i===void 0?{}:i)})}),X5=b.memo(function(t){var e,n=t.id,r=t.value,i=t.format,s=t.enableChip,a=s!==void 0&&s,l=t.color,c=t.renderContent,u=ka(),d=Nkt(i);if(typeof c=="function")e=c();else{var f=r;d!==void 0&&f!==void 0&&(f=d(f)),e=o.jsxs("div",{style:u.tooltip.basic,children:[a&&o.jsx(HSt,{color:l,style:u.tooltip.chip}),f!==void 0?o.jsxs("span",{children:[n,": ",o.jsx("strong",{children:""+f})]}):n]})}return o.jsx("div",{style:u.tooltip.container,role:"tooltip",children:e})}),WSt={width:"100%",borderCollapse:"collapse"},GSt=b.memo(function(t){var e,n=t.title,r=t.rows,i=r===void 0?[]:r,s=t.renderContent,a=ka();return i.length?(e=typeof s=="function"?s():o.jsxs("div",{children:[n&&n,o.jsx("table",{style:rg({},WSt,a.tooltip.table),children:o.jsx("tbody",{children:i.map(function(l,c){return o.jsx("tr",{children:l.map(function(u,d){return o.jsx("td",{style:a.tooltip.tableCell,children:u},d)})},c)})})})]}),o.jsx("div",{style:a.tooltip.container,children:e})):null});GSt.displayName="TableTooltip";var Q5=b.memo(function(t){var e=t.x0,n=t.x1,r=t.y0,i=t.y1,s=ka(),a=_c(),l=a.animate,c=a.config,u=b.useMemo(function(){return rg({},s.crosshair.line,{pointerEvents:"none"})},[s.crosshair.line]),d=sp({x1:e,x2:n,y1:r,y2:i,config:c,immediate:!l});return o.jsx(oge.line,rg({},d,{fill:"none",style:u}))});Q5.displayName="CrosshairLine";var qSt=b.memo(function(t){var e,n,r=t.width,i=t.height,s=t.type,a=t.x,l=t.y;return s==="cross"?(e={x0:a,x1:a,y0:0,y1:i},n={x0:0,x1:r,y0:l,y1:l}):s==="top-left"?(e={x0:a,x1:a,y0:0,y1:l},n={x0:0,x1:a,y0:l,y1:l}):s==="top"?e={x0:a,x1:a,y0:0,y1:l}:s==="top-right"?(e={x0:a,x1:a,y0:0,y1:l},n={x0:a,x1:r,y0:l,y1:l}):s==="right"?n={x0:a,x1:r,y0:l,y1:l}:s==="bottom-right"?(e={x0:a,x1:a,y0:l,y1:i},n={x0:a,x1:r,y0:l,y1:l}):s==="bottom"?e={x0:a,x1:a,y0:l,y1:i}:s==="bottom-left"?(e={x0:a,x1:a,y0:l,y1:i},n={x0:0,x1:a,y0:l,y1:l}):s==="left"?n={x0:0,x1:a,y0:l,y1:l}:s==="x"?e={x0:a,x1:a,y0:0,y1:i}:s==="y"&&(n={x0:0,x1:r,y0:l,y1:l}),o.jsxs(o.Fragment,{children:[e&&o.jsx(Q5,{x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1}),n&&o.jsx(Q5,{x0:n.x0,x1:n.x1,y0:n.y0,y1:n.y1})]})});qSt.displayName="Crosshair";var gge=b.createContext({showTooltipAt:function(){},showTooltipFromEvent:function(){},hideTooltip:function(){}}),J5={isVisible:!1,position:[null,null],content:null,anchor:null},xge=b.createContext(J5),KSt=function(t){var e=b.useState(J5),n=e[0],r=e[1],i=b.useCallback(function(l,c,u){var d=c[0],f=c[1];u===void 0&&(u="top"),r({isVisible:!0,position:[d,f],anchor:u,content:l})},[r]),s=b.useCallback(function(l,c,u){u===void 0&&(u="top");var d=t.current.getBoundingClientRect(),f=t.current.offsetWidth,h=f===d.width?1:f/d.width,p="touches"in c?c.touches[0]:c,m=p.clientX,x=p.clientY,y=(m-d.left)*h,g=(x-d.top)*h;
4933u!=="left"&&u!=="right"||(u=y<d.width/2?"right":"left"),r({isVisible:!0,position:[y,g],anchor:u,content:l})},[t,r]),a=b.useCallback(function(){r(J5)},[r]);return{actions:b.useMemo(function(){return{showTooltipAt:i,showTooltipFromEvent:s,hideTooltip:a}},[i,s,a]),state:n}},hP=function(){var t=b.useContext(gge);if(t===void 0)throw new Error("useTooltip must be used within a TooltipProvider");return t},YSt=function(){var t=b.useContext(xge);if(t===void 0)throw new Error("useTooltipState must be used within a TooltipProvider");return t},XSt=function(t){return t.isVisible},QSt=function(){var t=YSt();return XSt(t)?o.jsx(mge,{position:t.position,anchor:t.anchor,children:t.content}):null},JSt=function(t){var e=t.container,n=t.children,r=KSt(e),i=r.actions,s=r.state;return o.jsx(gge.Provider,{value:i,children:o.jsx(xge.Provider,{value:s,children:n})})},yge=/^--/;function ZSt(t,e){return e==null||typeof e=="boolean"||e===""?"":typeof e=="number"&&e!==0&&!yge.test(t)&&!(e1.hasOwnProperty(t)&&e1[t])?e+"px":(""+e).trim()}var eJ={};function eNt(t,e){if(!t.nodeType||!t.setAttribute)return!1;const n=t.nodeName==="filter"||t.parentNode&&t.parentNode.nodeName==="filter",{className:r,style:i,children:s,scrollTop:a,scrollLeft:l,viewBox:c,...u}=e,d=Object.values(u),f=Object.keys(u).map(h=>n||t.hasAttribute(h)?h:eJ[h]||(eJ[h]=h.replace(/([A-Z])/g,p=>"-"+p.toLowerCase())));s!==void 0&&(t.textContent=s);for(const h in i)if(i.hasOwnProperty(h)){const p=ZSt(h,i[h]);yge.test(h)?t.style.setProperty(h,p):t.style[h]=p}f.forEach((h,p)=>{t.setAttribute(h,d[p])}),r!==void 0&&(t.className=r),a!==void 0&&(t.scrollTop=a),l!==void 0&&(t.scrollLeft=l),c!==void 0&&t.setAttribute("viewBox",c)}var e1={animationIterationCount:!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,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},tNt=(t,e)=>t+e.charAt(0).toUpperCase()+e.substring(1),nNt=["Webkit","Ms","Moz","O"];e1=Object.keys(e1).reduce((t,e)=>(nNt.forEach(n=>t[tNt(n,e)]=t[e]),t),e1);var rNt=/^(matrix|translate|scale|rotate|skew)/,iNt=/^(translate)/,sNt=/^(rotate|skew)/,a3=(t,e)=>We.num(t)&&t!==0?t+e:t,ak=(t,e)=>We.arr(t)?t.every(n=>ak(n,e)):We.num(t)?t===e:parseFloat(t)===e,aNt=class extends ip{constructor({x:e,y:n,z:r,...i}){const s=[],a=[];(e||n||r)&&(s.push([e||0,n||0,r||0]),a.push(l=>[`translate3d(${l.map(c=>a3(c,"px")).join(",")})`,ak(l,0)])),Ka(i,(l,c)=>{if(c==="transform")s.push([l||""]),a.push(u=>[u,u===""]);else if(rNt.test(c)){if(delete i[c],We.und(l))return;const u=iNt.test(c)?"px":sNt.test(c)?"deg":"";s.push(Ji(l)),a.push(c==="rotate3d"?([d,f,h,p])=>[`rotate3d(${d},${f},${h},${a3(p,u)})`,ak(p,0)]:d=>[`${c}(${d.map(f=>a3(f,u)).join(",")})`,ak(d,c.startsWith("scale")?1:0)])}}),s.length&&(i.transform=new oNt(s,a)),super(i)}},oNt=class extends Y0{constructor(e,n){super(),this.inputs=e,this.transforms=n,this._value=null}get(){return this._value||(this._value=this._get())}_get(){let e="",n=!0;return yt(this.inputs,(r,i)=>{const s=fi(r[0]),[a,l]=this.transforms[i](We.arr(s)?s:r.map(fi));e+=" "+a,n=n&&l}),n?"none":e}observerAdded(e){e==1&&yt(this.inputs,n=>yt(n,r=>ki(r)&&wu(r,this)))}observerRemoved(e){e==0&&yt(this.inputs,n=>yt(n,r=>ki(r)&&Id(r,this)))}eventObserved(e){e.type=="change"&&(this._value=null),Rd(this,e)}},lNt=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"];ya.assign({batchedUpdates:wl.unstable_batchedUpdates,createStringInterpolator:X0,colors:cN});var cNt=uN(lNt,{applyAnimatedValues:eNt,createAnimatedStyle:t=>new aNt(t),getComponentProps:({scrollTop:t,scrollLeft:e,...n})=>n}),uNt=cNt.animated;let fl;typeof window<"u"?fl=window:typeof self<"u"?fl=self:fl=global;let Z5=null,eF=null;const tJ=20,o3=fl.clearTimeout,nJ=fl.setTimeout,l3=fl.cancelAnimationFrame||fl.mozCancelAnimationFrame||fl.webkitCancelAnimationFrame,rJ=fl.requestAnimationFrame||fl.mozRequestAnimationFrame||fl.webkitRequestAnimationFrame;l3==null||rJ==null?(Z5=o3,eF=function(e){return nJ(e,tJ)}):(Z5=function([e,n]){l3(e),o3(n)},eF=function(e){const n=rJ(function(){o3(r),e()}),r=nJ(function(){l3(n),e()},tJ);return[n,r]});function dNt(t){let e,n,r,i,s,a,l;const c=typeof document<"u"&&document.attachEvent;if(!c){a=function(g){const w=g.__resizeTriggers__,v=w.firstElementChild,N=w.lastElementChild,S=v.firstElementChild;N.scrollLeft=N.scrollWidth,N.scrollTop=N.scrollHeight,S.style.width=v.offsetWidth+1+"px",S.style.height=v.offsetHeight+1+"px",v.
4933scrollLeft=v.scrollWidth,v.scrollTop=v.scrollHeight},s=function(g){return g.offsetWidth!==g.__resizeLast__.width||g.offsetHeight!==g.__resizeLast__.height},l=function(g){if(g.target.className&&typeof g.target.className.indexOf=="function"&&g.target.className.indexOf("contract-trigger")<0&&g.target.className.indexOf("expand-trigger")<0)return;const w=this;a(this),this.__resizeRAF__&&Z5(this.__resizeRAF__),this.__resizeRAF__=eF(function(){s(w)&&(w.__resizeLast__.width=w.offsetWidth,w.__resizeLast__.height=w.offsetHeight,w.__resizeListeners__.forEach(function(S){S.call(w,g)}))})};let h=!1,p="";r="animationstart";const m="Webkit Moz O ms".split(" ");let x="webkitAnimationStart animationstart oAnimationStart MSAnimationStart".split(" "),y="";{const g=document.createElement("fakeelement");if(g.style.animationName!==void 0&&(h=!0),h===!1){for(let w=0;w<m.length;w++)if(g.style[m[w]+"AnimationName"]!==void 0){y=m[w],p="-"+y.toLowerCase()+"-",r=x[w],h=!0;break}}}n="resizeanim",e="@"+p+"keyframes "+n+" { from { opacity: 0; } to { opacity: 0; } } ",i=p+"animation: 1ms "+n+"; "}const u=function(h){if(!h.getElementById("detectElementResize")){const p=(e||"")+".resize-triggers { "+(i||"")+'visibility: hidden; opacity: 0; } .resize-triggers, .resize-triggers > div, .contract-trigger:before { content: " "; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; z-index: -1; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }',m=h.head||h.getElementsByTagName("head")[0],x=h.createElement("style");x.id="detectElementResize",x.type="text/css",t!=null&&x.setAttribute("nonce",t),x.styleSheet?x.styleSheet.cssText=p:x.appendChild(h.createTextNode(p)),m.appendChild(x)}};return{addResizeListener:function(h,p){if(c)h.attachEvent("onresize",p);else{if(!h.__resizeTriggers__){const m=h.ownerDocument,x=fl.getComputedStyle(h);x&&x.position==="static"&&(h.style.position="relative"),u(m),h.__resizeLast__={},h.__resizeListeners__=[],(h.__resizeTriggers__=m.createElement("div")).className="resize-triggers";const y=m.createElement("div");y.className="expand-trigger",y.appendChild(m.createElement("div"));const g=m.createElement("div");g.className="contract-trigger",h.__resizeTriggers__.appendChild(y),h.__resizeTriggers__.appendChild(g),h.appendChild(h.__resizeTriggers__),a(h),h.addEventListener("scroll",l,!0),r&&(h.__resizeTriggers__.__animationListener__=function(v){v.animationName===n&&a(h)},h.__resizeTriggers__.addEventListener(r,h.__resizeTriggers__.__animationListener__))}h.__resizeListeners__.push(p)}},removeResizeListener:function(h,p){if(c)h.detachEvent("onresize",p);else if(h.__resizeListeners__.splice(h.__resizeListeners__.indexOf(p),1),!h.__resizeListeners__.length){h.removeEventListener("scroll",l,!0),h.__resizeTriggers__.__animationListener__&&(h.__resizeTriggers__.removeEventListener(r,h.__resizeTriggers__.__animationListener__),h.__resizeTriggers__.__animationListener__=null);try{h.__resizeTriggers__=!h.removeChild(h.__resizeTriggers__)}catch{}}}}}class fNt extends b.Component{constructor(...e){super(...e),this.state={height:this.props.defaultHeight||0,width:this.props.defaultWidth||0},this._autoSizer=null,this._detectElementResize=null,this._didLogDeprecationWarning=!1,this._parentNode=null,this._resizeObserver=null,this._timeoutId=null,this._onResize=()=>{this._timeoutId=null;const{disableHeight:n,disableWidth:r,onResize:i}=this.props;if(this._parentNode){const s=window.getComputedStyle(this._parentNode)||{},a=parseFloat(s.paddingLeft||"0"),l=parseFloat(s.paddingRight||"0"),c=parseFloat(s.paddingTop||"0"),u=parseFloat(s.paddingBottom||"0"),d=this._parentNode.getBoundingClientRect(),f=d.height-c-u,h=d.width-a-l;if(!n&&this.state.height!==f||!r&&this.state.width!==h){this.setState({height:f,width:h});const p=()=>{this._didLogDeprecationWarning||(this._didLogDeprecationWarning=!0,console.warn("scaledWidth and scaledHeight parameters have been deprecated; use width and height instead"))};typeof i=="function"&&i({height:f,width:h,get scaledHeight(){return p(),f},get scaledWidth(){return p(),h}})}}},this._setRef=n=>{this._autoSizer=n}}componentDidMount(){const{nonce:e}=this.props,n=this._autoSizer?this._autoSizer.parentNode:null;if(n!=null&&n.ownerDocument&&n.ownerDocument.defaultView&&n instanceof n.ownerDocument.defaultView.HTMLElement){this._parentNode=n;const r=n.ownerDocument.defaultView.ResizeObserver;r!=null?(this._resizeObserver=new r(()=>{this._timeoutId=setTimeout(this._onResize,0)}),this._resizeObserver.observe(n)):(this._detectElementResize=dNt(e),this._detectElementResize.addResizeListener(n,this._onResize)),this._onResize()}}componentWillUnmount(){this._parentNode&&(this._detectElementResize&&this._detectElementResize.removeResizeListener(this._parentNode,this._onResize),this._timeoutId!==null&&clearTimeout(this._timeoutId),this._resizeObserver&&this._resizeObserver.disconnect())}render(){const{children:e,defaultHeight:n,defaultWidth:r,disableHeight:i=!1,disableWidth:s=!1,doNotBailOutOnEmptyChildren:a=!1,nonce:l,onResize:c,style:u={},tagName:d="div",...f}=this.props,{height:h,width:p}=this.state,m={overflow:"visible"},x={};let y=!1;
4933return i||(h===0&&(y=!0),m.height=0,x.height=h,x.scaledHeight=h),s||(p===0&&(y=!0),m.width=0,x.width=p,x.scaledWidth=p),a&&(y=!1),b.createElement(d,{ref:this._setRef,style:{...m,...u},...f},!y&&e(x))}}function hNt(t,e,n,r){var i=this,s=b.useRef(null),a=b.useRef(0),l=b.useRef(0),c=b.useRef(null),u=b.useRef([]),d=b.useRef(),f=b.useRef(),h=b.useRef(t),p=b.useRef(!0),m=b.useRef(),x=b.useRef();h.current=t;var y=typeof window<"u",g=!e&&e!==0&&y;if(typeof t!="function")throw new TypeError("Expected a function");e=+e||0;var w=!!(n=n||{}).leading,v=!("trailing"in n)||!!n.trailing,N=!!n.flushOnExit&&v,S="maxWait"in n,_="debounceOnServer"in n&&!!n.debounceOnServer,j=S?Math.max(+n.maxWait||0,e):null,A=b.useMemo(function(){var C=function(O){var L=u.current,T=d.current;return u.current=d.current=null,a.current=O,l.current=l.current||O,f.current=h.current.apply(T,L)},k=function(O,L){g&&cancelAnimationFrame(c.current),c.current=g?requestAnimationFrame(O):setTimeout(O,L)},M=function(O){if(!p.current)return!1;var L=O-s.current;return!s.current||L>=e||L<0||S&&O-a.current>=j},I=function(O){return c.current=null,v&&u.current?C(O):(u.current=d.current=null,f.current)},R=function O(){var L=Date.now();if(w&&l.current===a.current&&E(),M(L))return I(L);if(p.current){var T=e-(L-s.current),D=S?Math.min(T,j-(L-a.current)):T;k(O,D)}},E=function(){r&&r({})},P=function(){if(y||_){var O,L=Date.now(),T=M(L);if(u.current=[].slice.call(arguments),d.current=i,s.current=L,N&&!m.current&&(m.current=function(){var D;((D=global.document)==null?void 0:D.visibilityState)==="hidden"&&x.current.flush()},(O=global.document)==null||O.addEventListener==null||O.addEventListener("visibilitychange",m.current)),T){if(!c.current&&p.current)return a.current=s.current,k(R,e),w?C(s.current):f.current;if(S)return k(R,e),C(s.current)}return c.current||k(R,e),f.current}};return P.cancel=function(){var O=c.current;O&&(g?cancelAnimationFrame(c.current):clearTimeout(c.current)),a.current=0,u.current=s.current=d.current=c.current=null,O&&r&&r({})},P.isPending=function(){return!!c.current},P.flush=function(){return c.current?I(Date.now()):f.current},P},[w,S,e,j,v,N,g,y,_,r]);return x.current=A,b.useEffect(function(){return p.current=!0,function(){var C;N&&x.current.flush(),m.current&&((C=global.document)==null||C.removeEventListener==null||C.removeEventListener("visibilitychange",m.current),m.current=null),p.current=!1}},[N]),A}function pNt(t,e){return t===e}function mNt(t,e,n){var r=n&&n.equalityFn||pNt,i=b.useRef(t),s=b.useState({})[1],a=hNt(b.useCallback(function(c){i.current=c,s({})},[s]),e,n,s),l=b.useRef(t);return r(l.current,t)||(a(t),l.current=t),[i.current,a]}var gNt=F6,xNt=mue,yNt=gue,vNt=QT,bNt=H6,wNt=U6,_Nt=200;function SNt(t,e,n,r){var i=-1,s=xNt,a=!0,l=t.length,c=[],u=e.length;if(!l)return c;n&&(e=vNt(e,bNt(n))),r?(s=yNt,a=!1):e.length>=_Nt&&(s=wNt,a=!1,e=new gNt(e));e:for(;++i<l;){var d=t[i],f=n==null?d:n(d);if(d=r||d!==0?d:0,a&&f===f){for(var h=u;h--;)if(e[h]===f)continue e;c.push(d)}else s(e,f,r)||c.push(d)}return c}var NNt=SNt,jNt=NNt,CNt=X6,kNt=cge,ENt=CNt(function(t,e){return kNt(t)?jNt(t,e):[]}),ANt=ENt;const vge=An(ANt);function gn(t){for(var e=t.length/6|0,n=new Array(e),r=0;r<e;)n[r]="#"+t.slice(r*6,++r*6);return n}const TNt=gn("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"),MNt=gn("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"),PNt=gn("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"),ONt=gn("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"),RNt=gn("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"),INt=gn("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc"),DNt=gn("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999"),LNt=gn("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"),bge=gn("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"),$Nt=gn("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab"),jr=t=>eJe(t[t.length-1]);var pP=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(gn);const FNt=jr(pP);var mP=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(gn);const UNt=jr(mP);var gP=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(gn);const zNt=jr(gP);var xP=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(gn);const BNt=jr(xP);var yP=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(gn);const VNt=jr(yP);var vP=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(gn);const HNt=jr(vP);var bP=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(gn);const WNt=jr(bP);var wP=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d
49337191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(gn);const GNt=jr(wP);var _P=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(gn);const qNt=jr(_P);var SP=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(gn);const KNt=jr(SP);var NP=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(gn);const YNt=jr(NP);var jP=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(gn);const XNt=jr(jP);var CP=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(gn);const QNt=jr(CP);var kP=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(gn);const JNt=jr(kP);var EP=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(gn);const ZNt=jr(EP);var AP=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(gn);const ejt=jr(AP);var TP=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(gn);const tjt=jr(TP);var MP=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(gn);const njt=jr(MP);var PP=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(gn);const rjt=jr(PP);var OP=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(gn);const ijt=jr(OP);var RP=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(gn);const sjt=jr(RP);var IP=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ec
4933ae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(gn);const ajt=jr(IP);var DP=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(gn);const ojt=jr(DP);var LP=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(gn);const ljt=jr(LP);var $P=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(gn);const cjt=jr($P);var FP=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(gn);const ujt=jr(FP);var UP=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(gn);const djt=jr(UP);function fjt(t){return t=Math.max(0,Math.min(1,t)),"rgb("+Math.max(0,Math.min(255,Math.round(-4.54-t*(35.34-t*(2381.73-t*(6402.7-t*(7024.72-t*2710.57)))))))+", "+Math.max(0,Math.min(255,Math.round(32.49+t*(170.73+t*(52.82-t*(131.46-t*(176.58-t*67.37)))))))+", "+Math.max(0,Math.min(255,Math.round(81.24+t*(442.36-t*(2482.43-t*(6167.24-t*(6614.94-t*2475.67)))))))+")"}const hjt=sB(cu(300,.5,0),cu(-240,.5,1));var pjt=sB(cu(-100,.75,.35),cu(80,1.5,.8)),mjt=sB(cu(260,.75,.35),cu(80,1.5,.8)),Yj=cu();function gjt(t){(t<0||t>1)&&(t-=Math.floor(t));var e=Math.abs(t-.5);return Yj.h=360*t-100,Yj.s=1.5-1.5*e,Yj.l=.8-.9*e,Yj+""}var Xj=bv(),xjt=Math.PI/3,yjt=Math.PI*2/3;function vjt(t){var e;return t=(.5-t)*Math.PI,Xj.r=255*(e=Math.sin(t))*e,Xj.g=255*(e=Math.sin(t+xjt))*e,Xj.b=255*(e=Math.sin(t+yjt))*e,Xj+""}function bjt(t){return t=Math.max(0,Math.min(1,t)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+t*(1172.33-t*(10793.56-t*(33300.12-t*(38394.49-t*14825.05)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+t*(557.33+t*(1225.33-t*(3574.96-t*(1073.77+t*707.56)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+t*(3211.1-t*(15327.97-t*(27814-t*(22569.18-t*6838.66)))))))+")"}function zP(t){var e=t.length;return function(n){return t[Math.max(0,Math.min(e-1,Math.floor(n*e)))]}}const wjt=zP(gn("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc
49335c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725"));var _jt=zP(gn("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),Sjt=zP(gn("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),Njt=zP(gn("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function jjt(t){return Math.abs(t=Math.round(t))>
vendor: 5,199 bytes, line 4933
4933=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function DE(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Cjt(t){return t=DE(Math.abs(t)),t?t[1]:NaN}function kjt(t,e){return function(n,r){for(var i=n.length,s=[],a=0,l=t[0],c=0;i>0&&l>0&&(c+l+1>r&&(l=Math.max(1,r-c)),s.push(n.substring(i-=l,i+l)),!((c+=l+1)>r));)l=t[a=(a+1)%t.length];return s.reverse().join(e)}}function Ejt(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var Ajt=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function tF(t){if(!(e=Ajt.exec(t)))throw new Error("invalid format: "+t);var e;return new E8({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}tF.prototype=E8.prototype;function E8(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}E8.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function Tjt(t){e:for(var e=t.length,n=1,r=-1,i;n<e;++n)switch(t[n]){case".":r=i=n;break;case"0":r===0&&(r=n),i=n;break;default:if(!+t[n])break e;r>0&&(r=0);break}return r>0?t.slice(0,r)+t.slice(i+1):t}var wge;function Mjt(t,e){var n=DE(t,e);if(!n)return t+"";var r=n[0],i=n[1],s=i-(wge=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,a=r.length;return s===a?r:s>a?r+new Array(s-a+1).join("0"):s>0?r.slice(0,s)+"."+r.slice(s):"0."+new Array(1-s).join("0")+DE(t,Math.max(0,e+s-1))[0]}function iJ(t,e){var n=DE(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const sJ={"%":function(t,e){return(t*100).toFixed(e)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:jjt,e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},g:function(t,e){return t.toPrecision(e)},o:function(t){return Math.round(t).toString(8)},p:function(t,e){return iJ(t*100,e)},r:iJ,s:Mjt,X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}};function aJ(t){return t}var oJ=Array.prototype.map,lJ=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Pjt(t){var e=t.grouping===void 0||t.thousands===void 0?aJ:kjt(oJ.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",r=t.currency===void 0?"":t.currency[1]+"",i=t.decimal+"",s=t.numerals===void 0?aJ:Ejt(oJ.call(t.numerals,String)),a=t.percent===void 0?"%":t.percent+"",l=t.minus+"",c=t.nan===void 0?"NaN":t.nan+"";function u(f){f=tF(f);var h=f.fill,p=f.align,m=f.sign,x=f.symbol,y=f.zero,g=f.width,w=f.comma,v=f.precision,N=f.trim,S=f.type;S==="n"?(w=!0,S="g"):sJ[S]||(v===void 0&&(v=12),N=!0,S="g"),(y||h==="0"&&p==="=")&&(y=!0,h="0",p="=");var _=x==="$"?n:x==="#"&&/[boxX]/.test(S)?"0"+S.toLowerCase():"",j=x==="$"?r:/[%p]/.test(S)?a:"",A=sJ[S],C=/[defgprs%]/.test(S);v=v===void 0?6:/[gprs]/.test(S)?Math.max(1,Math.min(21,v)):Math.max(0,Math.min(20,v));function k(M){var I=_,R=j,E,P,O;if(S==="c")R=A(M)+R,M="";else{M=+M;var L=M<0||1/M<0;if(M=isNaN(M)?c:A(Math.abs(M),v),N&&(M=Tjt(M)),L&&+M==0&&m!=="+"&&(L=!1),I=(L?m==="("?m:l:m==="-"||m==="("?"":m)+I,R=(S==="s"?lJ[8+wge/3]:"")+R+(L&&m==="("?")":""),C){for(E=-1,P=M.length;++E<P;)if(O=M.charCodeAt(E),48>O||O>57){R=(O===46?i+M.slice(E+1):M.slice(E))+R,M=M.slice(0,E);break}}}w&&!y&&(M=e(M,1/0));var T=I.length+M.length+R.length,D=T<g?new Array(g-T+1).join(h):"";switch(w&&y&&(M=e(D+M,D.length?g-R.length:1/0),D=""),p){case"<":M=I+M+R+D;break;case"=":M=I+D+M+R;break;case"^":M=D.slice(0,T=D.length>>1)+I+M+R+D.slice(T);break;default:M=D+I+M+R;break}return s(M)}return k.toString=function(){return f+""},k}function d(f,h){var p=u((f=tF(f),f.type="f",f)),m=Math.max(-8,Math.min(8,Math.floor(Cjt(h)/3)))*3,x=Math.pow(10,-m),y=lJ[8+m/3];return function(g){return p(x*g)+y}}return{format:u,formatPrefix:d}}var Qj,_ge;Ojt({decimal:".",thousands:",",grouping:[3],currency:["$",""],minus:"-"});function Ojt(t){return Qj=Pjt(t),_ge=Qj.format,Qj.formatPrefix,Qj}var c3=new Date,u3=new Date;function Hd(t,e,n,r){function i(s){return t(s=arguments.length===0?new Date:new Date(+s)),s}return i.floor=function(s){return t(s=new Date(+s)),s},i.ceil=function(s){return t(s=new Date(s-1)),e(s,1),t(s),s},i.round=function(s){var a=i(s),l=i.ceil(s);return s-a<l-s?a:l},i.offset=function(s,a){return e(s=new Date(+s),a==null?1:Math.floor(a)),s},i.range=function(s,a,l){var c=[],u;if(s=i.ceil(s),l=l==null?1:Math.floor(l),!(s<a)||!(l>0))return c;do c.push(u=new Date(+s)),e(s,l),t(s);while(u<s&&s<a);return c}
vendor: 4,444 bytes, line 4933
4933,i.filter=function(s){return Hd(function(a){if(a>=a)for(;t(a),!s(a);)a.setTime(a-1)},function(a,l){if(a>=a)if(l<0)for(;++l<=0;)for(;e(a,-1),!s(a););else for(;--l>=0;)for(;e(a,1),!s(a););})},n&&(i.count=function(s,a){return c3.setTime(+s),u3.setTime(+a),t(c3),t(u3),Math.floor(n(c3,u3))},i.every=function(s){return s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?i.filter(r?function(a){return r(a)%s===0}:function(a){return i.count(0,a)%s===0}):i}),i}const Rjt=1e3,A8=Rjt*60,Ijt=A8*60,T8=Ijt*24,Sge=T8*7;var M8=Hd(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*A8)/T8,t=>t.getDate()-1);M8.range;function Dg(t){return Hd(function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},function(e,n){e.setDate(e.getDate()+n*7)},function(e,n){return(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*A8)/Sge})}var Nge=Dg(0),LE=Dg(1),Djt=Dg(2),Ljt=Dg(3),Zv=Dg(4),$jt=Dg(5),Fjt=Dg(6);Nge.range;LE.range;Djt.range;Ljt.range;Zv.range;$jt.range;Fjt.range;var ig=Hd(function(t){t.setMonth(0,1),t.setHours(0,0,0,0)},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t,e){return e.getFullYear()-t.getFullYear()},function(t){return t.getFullYear()});ig.every=function(t){return!isFinite(t=Math.floor(t))||!(t>0)?null:Hd(function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},function(e,n){e.setFullYear(e.getFullYear()+n*t)})};ig.range;var P8=Hd(function(t){t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCDate(t.getUTCDate()+e)},function(t,e){return(e-t)/T8},function(t){return t.getUTCDate()-1});P8.range;function Lg(t){return Hd(function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},function(e,n){e.setUTCDate(e.getUTCDate()+n*7)},function(e,n){return(n-e)/Sge})}var jge=Lg(0),$E=Lg(1),Ujt=Lg(2),zjt=Lg(3),e0=Lg(4),Bjt=Lg(5),Vjt=Lg(6);jge.range;$E.range;Ujt.range;zjt.range;e0.range;Bjt.range;Vjt.range;var sg=Hd(function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)},function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()},function(t){return t.getUTCFullYear()});sg.every=function(t){return!isFinite(t=Math.floor(t))||!(t>0)?null:Hd(function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},function(e,n){e.setUTCFullYear(e.getUTCFullYear()+n*t)})};sg.range;function d3(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function f3(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Fb(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function Hjt(t){var e=t.dateTime,n=t.date,r=t.time,i=t.periods,s=t.days,a=t.shortDays,l=t.months,c=t.shortMonths,u=Ub(i),d=zb(i),f=Ub(s),h=zb(s),p=Ub(a),m=zb(a),x=Ub(l),y=zb(l),g=Ub(c),w=zb(c),v={a:L,A:T,b:D,B:F,c:null,d:pJ,e:pJ,f:hCt,g:SCt,G:jCt,H:uCt,I:dCt,j:fCt,L:Cge,m:pCt,M:mCt,p:q,q:B,Q:xJ,s:yJ,S:gCt,u:xCt,U:yCt,V:vCt,w:bCt,W:wCt,x:null,X:null,y:_Ct,Y:NCt,Z:CCt,"%":gJ},N={a:z,A:H,b:W,B:G,c:null,d:mJ,e:mJ,f:TCt,g:UCt,G:BCt,H:kCt,I:ECt,j:ACt,L:Ege,m:MCt,M:PCt,p:K,q:ee,Q:xJ,s:yJ,S:OCt,u:RCt,U:ICt,V:DCt,w:LCt,W:$Ct,x:null,X:null,y:FCt,Y:zCt,Z:VCt,"%":gJ},S={a:k,A:M,b:I,B:R,c:E,d:fJ,e:fJ,f:aCt,g:dJ,G:uJ,H:hJ,I:hJ,j:nCt,L:sCt,m:tCt,M:rCt,p:C,q:eCt,Q:lCt,s:cCt,S:iCt,u:Yjt,U:Xjt,V:Qjt,w:Kjt,W:Jjt,x:P,X:O,y:dJ,Y:uJ,Z:Zjt,"%":oCt};v.x=_(n,v),v.X=_(r,v),v.c=_(e,v),N.x=_(n,N),N.X=_(r,N),N.c=_(e,N);function _(V,J){return function(Y){var $=[],fe=-1,ce=0,ve=V.length,X,de,Te;for(Y instanceof Date||(Y=new Date(+Y));++fe<ve;)V.charCodeAt(fe)===37&&($.push(V.slice(ce,fe)),(de=cJ[X=V.charAt(++fe)])!=null?X=V.charAt(++fe):de=X==="e"?" ":"0",(Te=J[X])&&(X=Te(Y,de)),$.push(X),ce=fe+1);return $.push(V.slice(ce,fe)),$.join("")}}function j(V,J){return function(Y){var $=Fb(1900,void 0,1),fe=A($,V,Y+="",0),ce,ve;if(fe!=Y.length)return null;if("Q"in $)return new Date($.Q);if("s"in $)return new Date($.s*1e3+("L"in $?$.L:0));if(J&&!("Z"in $)&&($.Z=0),"p"in $&&($.H=$.H%12+$.p*12),$.m===void 0&&($.m="q"in $?$.q:0),"V"in $){if($.V<1||$.V>53)return null;"w"in $||($.w=1),"Z"in $?(ce=f3(Fb($.y,0,1)),ve=ce.getUTCDay(),ce=ve>4||ve===0?$E.ceil(ce):$E(ce),ce=P8.offset(ce,($.V-1)*7),$.y=ce.getUTCFullYear(),$.m=ce.getUTCMonth(),$.d=ce.getUTCDate()+($.w+6)%7):(ce=
vendor: 6,779 bytes, line 4933
4933d3(Fb($.y,0,1)),ve=ce.getDay(),ce=ve>4||ve===0?LE.ceil(ce):LE(ce),ce=M8.offset(ce,($.V-1)*7),$.y=ce.getFullYear(),$.m=ce.getMonth(),$.d=ce.getDate()+($.w+6)%7)}else("W"in $||"U"in $)&&("w"in $||($.w="u"in $?$.u%7:"W"in $?1:0),ve="Z"in $?f3(Fb($.y,0,1)).getUTCDay():d3(Fb($.y,0,1)).getDay(),$.m=0,$.d="W"in $?($.w+6)%7+$.W*7-(ve+5)%7:$.w+$.U*7-(ve+6)%7);return"Z"in $?($.H+=$.Z/100|0,$.M+=$.Z%100,f3($)):d3($)}}function A(V,J,Y,$){for(var fe=0,ce=J.length,ve=Y.length,X,de;fe<ce;){if($>=ve)return-1;if(X=J.charCodeAt(fe++),X===37){if(X=J.charAt(fe++),de=S[X in cJ?J.charAt(fe++):X],!de||($=de(V,Y,$))<0)return-1}else if(X!=Y.charCodeAt($++))return-1}return $}function C(V,J,Y){var $=u.exec(J.slice(Y));return $?(V.p=d.get($[0].toLowerCase()),Y+$[0].length):-1}function k(V,J,Y){var $=p.exec(J.slice(Y));return $?(V.w=m.get($[0].toLowerCase()),Y+$[0].length):-1}function M(V,J,Y){var $=f.exec(J.slice(Y));return $?(V.w=h.get($[0].toLowerCase()),Y+$[0].length):-1}function I(V,J,Y){var $=g.exec(J.slice(Y));return $?(V.m=w.get($[0].toLowerCase()),Y+$[0].length):-1}function R(V,J,Y){var $=x.exec(J.slice(Y));return $?(V.m=y.get($[0].toLowerCase()),Y+$[0].length):-1}function E(V,J,Y){return A(V,e,J,Y)}function P(V,J,Y){return A(V,n,J,Y)}function O(V,J,Y){return A(V,r,J,Y)}function L(V){return a[V.getDay()]}function T(V){return s[V.getDay()]}function D(V){return c[V.getMonth()]}function F(V){return l[V.getMonth()]}function q(V){return i[+(V.getHours()>=12)]}function B(V){return 1+~~(V.getMonth()/3)}function z(V){return a[V.getUTCDay()]}function H(V){return s[V.getUTCDay()]}function W(V){return c[V.getUTCMonth()]}function G(V){return l[V.getUTCMonth()]}function K(V){return i[+(V.getUTCHours()>=12)]}function ee(V){return 1+~~(V.getUTCMonth()/3)}return{format:function(V){var J=_(V+="",v);return J.toString=function(){return V},J},parse:function(V){var J=j(V+="",!1);return J.toString=function(){return V},J},utcFormat:function(V){var J=_(V+="",N);return J.toString=function(){return V},J},utcParse:function(V){var J=j(V+="",!0);return J.toString=function(){return V},J}}}var cJ={"-":"",_:" ",0:"0"},Ns=/^\s*\d+/,Wjt=/^%/,Gjt=/[\\^$*+?|[\]().{}]/g;function Gn(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",s=i.length;return r+(s<n?new Array(n-s+1).join(e)+i:i)}function qjt(t){return t.replace(Gjt,"\\$&")}function Ub(t){return new RegExp("^(?:"+t.map(qjt).join("|")+")","i")}function zb(t){return new Map(t.map((e,n)=>[e.toLowerCase(),n]))}function Kjt(t,e,n){var r=Ns.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function Yjt(t,e,n){var r=Ns.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function Xjt(t,e,n){var r=Ns.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function Qjt(t,e,n){var r=Ns.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function Jjt(t,e,n){var r=Ns.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function uJ(t,e,n){var r=Ns.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function dJ(t,e,n){var r=Ns.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Zjt(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function eCt(t,e,n){var r=Ns.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function tCt(t,e,n){var r=Ns.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function fJ(t,e,n){var r=Ns.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function nCt(t,e,n){var r=Ns.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function hJ(t,e,n){var r=Ns.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function rCt(t,e,n){var r=Ns.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function iCt(t,e,n){var r=Ns.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function sCt(t,e,n){var r=Ns.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function aCt(t,e,n){var r=Ns.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function oCt(t,e,n){var r=Wjt.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function lCt(t,e,n){var r=Ns.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function cCt(t,e,n){var r=Ns.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function pJ(t,e){return Gn(t.getDate(),e,2)}function uCt(t,e){return Gn(t.getHours(),e,2)}function dCt(t,e){return Gn(t.getHours()%12||12,e,2)}function fCt(t,e){return Gn(1+M8.count(ig(t),t),e,3)}function Cge(t,e){return Gn(t.getMilliseconds(),e,3)}function hCt(t,e){return Cge(t,e)+"000"}function pCt(t,e){return Gn(t.getMonth()+1,e,2)}function mCt(t,e){return Gn(t.getMinutes(),e,2)}function gCt(t,e){return Gn(t.getSeconds(),e,2)}function xCt(t){var e=t.getDay();return e===0?7:e}function yCt(t,e){return Gn(Nge.count(ig(t)-1,t),e,2)}function kge(t){var e=t.getDay();return e>=4||e===0?Zv(t):Zv.ceil(t)}function vCt(t,e){return t=kge(t),Gn(Zv.count(ig(t),t)+(ig(t).getDay()===4),e,2)}function bCt(t){return t.getDay()}function wCt(t,e){return Gn(LE.count(ig(t)-1,t),e,2)}function _Ct(t,e){return Gn(t.getFullYear()%100,e,2)}function SCt(t,e){return t=kge(t),Gn(t.getFullYear()%100,e,2)}function NCt(t,e){return Gn(t.getFullYear()%1e4,e,4)}function jCt(t,e){var n=t.getDay();return t=n>=4||n===0?Zv(t):Zv.ceil(t),Gn(t.getFullYear()%1e4,e,4)}function CCt(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Gn(e/60|0,"0",2)+Gn(e%60,"0",2)}function mJ(t,e){return Gn(t.getUTCDate(),e,2)}function kCt(t,e){return Gn(t.getUTCHours(),e,2)}function ECt(t,e){return Gn(t.getUTCHours()%12||12,e,2)}function ACt(t,e){return Gn(1+P8.count(sg(t),t),e,3)}function Ege(t,e){return Gn(t.getUTCMilliseconds(),e,3)}function TCt(t,e){return Ege(t,e)+"000"}function MCt(t,e){return Gn(t.getUTCMonth()+1,e,2)}function PCt(t,e){return Gn(t.getUTCMinutes(),e,2)}function OCt(t,e){return Gn(t.getUTCSeconds(),e,2)}function RCt(t){var e=t.getUTCDay();return e===0?7:e}function ICt(t,e){return Gn(jge.count(sg(t)-1,t),e,2)}function Age(t){var e=t.getUTCDay();return e>=4||e===0?e0(t):e0.ceil(t)}function DCt(t,e){return t=Age(t),Gn(e0.count(sg(t),t)+(sg(t).getUTCDay()===4),e,2)}function LCt(t){return t.getUTCDay()}function $Ct(t,e){return Gn($E.count(sg(t)-1,t),e,2)}function FCt(t,e){return Gn(t.getUTCFullYear()%100,e,2)}function UCt(t,e){return t=Age(t),Gn(t.getUTCFullYear()%100,e,2)}function zCt(t,e){return Gn(t.getUTCFullYear()%1e4,e,4)}function BCt(t,e){var n=t.getUTCDay();return t=n>=4||n===0?e0(t):e0.ceil(t),Gn(t.getUTCFullYear()%1e4,e,4)}function VCt(){return"+0000"}function gJ(){return"%"}function xJ(t){return+t}function yJ(t){return Math.floor(+t/1e3)}var Cx,Tge;HCt({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Frid
4933ay","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function HCt(t){return Cx=Hjt(t),Tge=Cx.format,Cx.parse,Cx.utcFormat,Cx.utcParse,Cx}var WCt=ZT,GCt=hge,qCt=JT;function KCt(t,e,n){for(var r=-1,i=e.length,s={};++r<i;){var a=e[r],l=WCt(t,a);n(l,a)&&GCt(s,qCt(a,t),l)}return s}var YCt=KCt,XCt=YCt,QCt=hue;function JCt(t,e){return XCt(t,e,function(n,r){return QCt(t,r)})}var ZCt=JCt,ekt=ZCt,tkt=wft,nkt=tkt(function(t,e){return t==null?{}:ekt(t,e)}),rkt=nkt;const ikt=An(rkt);var Mge=b.createContext(),skt=function(t){var e=t.children,n=t.animate,r=n===void 0||n,i=t.config,s=i===void 0?"default":i,a=b.useMemo(function(){var l=Ph(s)?Vme[s]:s;return{animate:r,config:l}},[r,s]);return o.jsx(Mge.Provider,{value:a,children:e})},_c=function(){return b.useContext(Mge)},akt=function(t){var e=t.children,n=t.condition,r=t.wrapper;return n?b.cloneElement(r,{},e):e},okt={position:"relative"},O8=function(t){var e=t.children,n=t.theme,r=t.renderWrapper,i=r===void 0||r,s=t.isInteractive,a=s===void 0||s,l=t.animate,c=t.motionConfig,u=b.useRef(null);return o.jsx(zSt,{theme:n,children:o.jsx(skt,{animate:l,config:c,children:o.jsx(JSt,{container:u,children:o.jsxs(akt,{condition:i,wrapper:o.jsx("div",{style:okt,ref:u}),children:[e,a&&o.jsx(QSt,{})]})})})})},lkt=function(t,e){return t.width===e.width&&t.height===e.height},ckt=function(t){var e=t.children,n=t.width,r=t.height,i=t.onResize,s=t.debounceResize,a=mNt({width:n,height:r},s,{equalityFn:lkt})[0];return b.useEffect(function(){i==null||i(a)},[a,i]),o.jsx(o.Fragment,{children:e(a)})},R8=function(t){var e=t.children,n=t.defaultWidth,r=t.defaultHeight,i=t.onResize,s=t.debounceResize,a=s===void 0?0:s;return o.jsx(fNt,{defaultWidth:n,defaultHeight:r,children:function(l){var c=l.width,u=l.height;return o.jsx(ckt,{width:c,height:u,onResize:i,debounceResize:a,children:e})}})};function vJ(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function ukt(t,e){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=function(i,s){if(i){if(typeof i=="string")return vJ(i,s);var a={}.toString.call(i).slice(8,-1);return a==="Object"&&i.constructor&&(a=i.constructor.name),a==="Map"||a==="Set"?Array.from(i):a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?vJ(i,s):void 0}}(t))||e){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
4934In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function tu(){return tu=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},tu.apply(null,arguments)}function Pge(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var dkt=["id","colors"],fkt=function(t){var e=t.id,n=t.colors,r=Pge(t,dkt);return o.jsx("linearGradient",tu({id:e,x1:0,x2:0,y1:0,y2:1},r,{children:n.map(function(i){var s=i.offset,a=i.color,l=i.opacity;return o.jsx("stop",{offset:s+"%",stopColor:a,stopOpacity:l!==void 0?l:1},s)})}))},Oge={linearGradient:fkt},Bb={color:"#000000",background:"#ffffff",size:4,padding:4,stagger:!1},hkt=b.memo(function(t){var e=t.id,n=t.background,r=n===void 0?Bb.background:n,i=t.color,s=i===void 0?Bb.color:i,a=t.size,l=a===void 0?Bb.size:a,c=t.padding,u=c===void 0?Bb.padding:c,d=t.stagger,f=d===void 0?Bb.stagger:d,h=l+u,p=l/2,m=u/2;return f===!0&&(h=2*l+2*u),o.jsxs("pattern",{id:e,width:h,height:h,patternUnits:"userSpaceOnUse",children:[o.jsx("rect",{width:h,height:h,fill:r}),o.jsx("circle",{cx:m+p,cy:m+p,r:p,fill:s}),f&&o.jsx("circle",{cx:1.5*u+l+p,cy:1.5*u+l+p,r:p,fill:s})]})}),bJ=function(t){return t*Math.PI/180},pkt={svg:{align:{left:"start",center:"middle",right:"end",start:"start",middle:"middle",end:"end"},baseline:{top:"text-before-edge",center:"central",bottom:"alphabetic"}},canvas:{align:{left:"left",center:"center",right:"right",start:"left",middle:"center",end:"right"},baseline:{top:"top",center:"middle",bottom:"bottom"}}},Vb={spacing:5,rotation:0,background:"#000000",color:"#ffffff",lineWidth:2}
4934,mkt=b.memo(function(t){var e=t.id,n=t.spacing,r=n===void 0?Vb.spacing:n,i=t.rotation,s=i===void 0?Vb.rotation:i,a=t.background,l=a===void 0?Vb.background:a,c=t.color,u=c===void 0?Vb.color:c,d=t.lineWidth,f=d===void 0?Vb.lineWidth:d,h=Math.round(s)%360,p=Math.abs(r);h>180?h-=360:h>90?h-=180:h<-180?h+=360:h<-90&&(h+=180);var m,x=p,y=p;return h===0?m=`
4935                M 0 0 L `+x+` 0
4936                M 0 `+y+" L "+x+" "+y+`
4937            `:h===90?m=`
4938                M 0 0 L 0 `+y+`
4939                M `+x+" 0 L "+x+" "+y+`
4940            `:(x=Math.abs(p/Math.sin(bJ(h))),y=p/Math.sin(bJ(90-h)),m=h>0?`
4941                    M 0 `+-y+" L "+2*x+" "+y+`
4942                    M `+-x+" "+-y+" L "+x+" "+y+`
4943                    M `+-x+" 0 L "+x+" "+2*y+`
4944                `:`
4945                    M `+-x+" "+y+" L "+x+" "+-y+`
4946                    M `+-x+" "+2*y+" L "+2*x+" "+-y+`
4947                    M 0 `+2*y+" L "+2*x+` 0
4948                `),o.jsxs("pattern",{id:e,width:x,height:y,patternUnits:"userSpaceOnUse",children:[o.jsx("rect",{width:x,height:y,fill:l,stroke:"rgba(255, 0, 0, 0.1)",strokeWidth:0}),o.jsx("path",{d:m,strokeWidth:f,stroke:u,strokeLinecap:"square"})]})}),Hb={color:"#000000",background:"#ffffff",size:4,padding:4,stagger:!1},gkt=b.memo(function(t){var e=t.id,n=t.color,r=n===void 0?Hb.color:n,i=t.background,s=i===void 0?Hb.background:i,a=t.size,l=a===void 0?Hb.size:a,c=t.padding,u=c===void 0?Hb.padding:c,d=t.stagger,f=d===void 0?Hb.stagger:d,h=l+u,p=u/2;return f===!0&&(h=2*l+2*u),o.jsxs("pattern",{id:e,width:h,height:h,patternUnits:"userSpaceOnUse",children:[o.jsx("rect",{width:h,height:h,fill:s}),o.jsx("rect",{x:p,y:p,width:l,height:l,fill:r}),f&&o.jsx("rect",{x:1.5*u+l,y:1.5*u+l,width:l,height:l,fill:r})]})}),Rge={patternDots:hkt,patternLines:mkt,patternSquares:gkt},xkt=["type"],wJ=tu({},Oge,Rge),ykt=b.memo(function(t){var e=t.defs;return!e||e.length<1?null:o.jsx("defs",{"aria-hidden":!0,children:e.map(function(n){var r=n.type,i=Pge(n,xkt);return wJ[r]?b.createElement(wJ[r],tu({key:i.id},i)):null})})}),I8=b.forwardRef(function(t,e){var n=t.width,r=t.height,i=t.margin,s=t.defs,a=t.children,l=t.role,c=t.ariaLabel,u=t.ariaLabelledBy,d=t.ariaDescribedBy,f=t.isFocusable,h=ka();return o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:n,height:r,role:l,"aria-label":c,"aria-labelledby":u,"aria-describedby":d,focusable:f,tabIndex:f?0:void 0,ref:e,children:[o.jsx(ykt,{defs:s}),o.jsx("rect",{width:n,height:r,fill:h.background}),o.jsx("g",{transform:"translate("+i.left+","+i.top+")",children:a})]})}),vkt=b.memo(function(t){var e=t.size,n=t.color,r=t.borderWidth,i=t.borderColor;return o.jsx("circle",{r:e/2,fill:n,stroke:i,strokeWidth:r,style:{pointerEvents:"none"}})});b.memo(function(t){var e=t.x,n=t.y,r=t.symbol,i=r===void 0?vkt:r,s=t.size,a=t.datum,l=t.color,c=t.borderWidth,u=t.borderColor,d=t.label,f=t.labelTextAnchor,h=f===void 0?"middle":f,p=t.labelYOffset,m=p===void 0?-12:p,x=t.ariaLabel,y=t.ariaLabelledBy,g=t.ariaDescribedBy,w=t.ariaHidden,v=t.ariaDisabled,N=t.isFocusable,S=N!==void 0&&N,_=t.tabIndex,j=_===void 0?0:_,A=t.onFocus,C=t.onBlur,k=t.testId,M=ka(),I=_c(),R=I.animate,E=I.config,P=sp({transform:"translate("+e+", "+n+")",config:E,immediate:!R}),O=b.useCallback(function(T){A==null||A(a,T)},[A,a]),L=b.useCallback(function(T){C==null||C(a,T)},[C,a]);return o.jsxs(uNt.g,{transform:P.transform,style:{pointerEvents:"none"},focusable:S,tabIndex:S?j:void 0,"aria-label":x,"aria-labelledby":y,"aria-describedby":g,"aria-disabled":v,"aria-hidden":w,onFocus:S&&A?O:void 0,onBlur:S&&C?L:void 0,"data-testid":k,children:[b.createElement(i,{size:s,color:l,datum:a,borderWidth:c,borderColor:u}),d&&o.jsx("text",{textAnchor:h,y:m,style:PSt(M.dots.text),children:d})]})});var bkt=b.memo(function(t){var e=t.width,n=t.height,r=t.axis,i=t.scale,s=t.value,a=t.lineStyle,l=t.textStyle,c=t.legend,u=t.legendNode,d=t.legendPosition,f=d===void 0?"top-right":d,h=t.legendOffsetX,p=h===void 0?14:h,m=t.legendOffsetY,x=m===void 0?14:m,y=t.legendOrientation,g=y===void 0?"horizontal":y,w=ka(),v=0,N=0,S=0,_=0;if(r==="y"?(S=i(s),N=e):(v=i(s),_=n),c&&!u){var j=function(A){var 
4948C=A.axis,k=A.width,M=A.height,I=A.position,R=A.offsetX,E=A.offsetY,P=A.orientation,O=0,L=0,T=P==="vertical"?-90:0,D="start";if(C==="x")switch(I){case"top-left":O=-R,L=E,D="end";break;case"top":L=-E,D=P==="horizontal"?"middle":"start";break;case"top-right":O=R,L=E,D=P==="horizontal"?"start":"end";break;case"right":O=R,L=M/2,D=P==="horizontal"?"start":"middle";break;case"bottom-right":O=R,L=M-E,D="start";break;case"bottom":L=M+E,D=P==="horizontal"?"middle":"end";break;case"bottom-left":L=M-E,O=-R,D=P==="horizontal"?"end":"start";break;case"left":O=-R,L=M/2,D=P==="horizontal"?"end":"middle"}else switch(I){case"top-left":O=R,L=-E,D="start";break;case"top":O=k/2,L=-E,D=P==="horizontal"?"middle":"start";break;case"top-right":O=k-R,L=-E,D=P==="horizontal"?"end":"start";break;case"right":O=k+R,D=P==="horizontal"?"start":"middle";break;case"bottom-right":O=k-R,L=E,D="end";break;case"bottom":O=k/2,L=E,D=P==="horizontal"?"middle":"end";break;case"bottom-left":O=R,L=E,D=P==="horizontal"?"start":"end";break;case"left":O=-R,D=P==="horizontal"?"end":"middle"}return{x:O,y:L,rotation:T,textAnchor:D}}({axis:r,width:e,height:n,position:f,offsetX:p,offsetY:x,orientation:g});u=o.jsx("text",{transform:"translate("+j.x+", "+j.y+") rotate("+j.rotation+")",textAnchor:j.textAnchor,dominantBaseline:"central",style:l,children:c})}return o.jsxs("g",{transform:"translate("+v+", "+S+")",children:[o.jsx("line",{x1:0,x2:N,y1:0,y2:_,stroke:w.markers.lineColor,strokeWidth:w.markers.lineStrokeWidth,style:a}),u]})});b.memo(function(t){var e=t.markers,n=t.width,r=t.height,i=t.xScale,s=t.yScale;return e&&e.length!==0?e.map(function(a,l){return o.jsx(bkt,tu({},a,{width:n,height:r,scale:a.axis==="y"?s:i}),l)}):null});var Ige=function(t){var e=_c(),n=e.animate,r=e.config,i=function(l){var c=b.useRef();return b.useEffect(function(){c.current=l},[l]),c.current}(t),s=b.useMemo(function(){return rB(i,t)},[i,t]),a=sp({from:{value:0},to:{value:1},reset:!0,config:r,immediate:!n}).value;return sge(a,s)};b.createContext(void 0);var wkt={basis:hM,basisClosed:Oce,basisOpen:Ice,bundle:Q9e,cardinal:J9e,cardinalClosed:Z9e,cardinalOpen:eVe,catmullRom:tVe,catmullRomClosed:nVe,catmullRomOpen:rVe,linear:kg,linearClosed:zce,monotoneX:Hce,monotoneY:Wce,natural:qce,step:Kce,stepAfter:Xce,stepBefore:Yce},D8=Object.keys(wkt);D8.filter(function(t){return t.endsWith("Closed")});vge(D8,"bundle","basisClosed","basisOpen","cardinalClosed","cardinalOpen","catmullRomClosed","catmullRomOpen","linearClosed");vge(D8,"bundle","basisClosed","basisOpen","cardinalClosed","cardinalOpen","catmullRomClosed","catmullRomOpen","linearClosed");Bt(pP),Bt(mP),Bt(gP),Bt(xP),Bt(yP),Bt(vP),Bt(bP),Bt(wP),Bt(_P),Bt(IP),Bt(DP),Bt(LP),Bt(UP),Bt($P),Bt(FP),Bt(SP),Bt(NP),Bt(jP),Bt(CP),Bt(kP),Bt(EP),Bt(AP),Bt(TP),Bt(MP),Bt(PP),Bt(OP),Bt(RP);Bt(pP),Bt(mP),Bt(gP),Bt(xP),Bt(yP),Bt(vP),Bt(bP),Bt(wP),Bt(_P),Bt(IP),Bt(DP),Bt(LP),Bt(UP),Bt($P),Bt(FP),Bt(SP),Bt(NP),Bt(jP),Bt(CP),Bt(kP),Bt(EP),Bt(AP),Bt(TP),Bt(MP),Bt(PP),Bt(OP),Bt(RP);qf(bge);var Dge={top:0,right:0,bottom:0,left:0},L8=function(t,e,n){return n===void 0&&(n={}),b.useMemo(function(){var r=tu({},Dge,n);return{margin:r,innerWidth:t-r.left-r.right,innerHeight:e-r.top-r.bottom,outerWidth:t,outerHeight:e}},[t,e,n])},_kt=function(){var t=b.useRef(null),e=b.useState({left:0,top:0,width:0,height:0}),n=e[0],r=e[1],i=b.useState(function(){return typeof ResizeObserver>"u"?null:new ResizeObserver(function(s){var a=s[0];return r(a.contentRect)})})[0];return b.useEffect(function(){return t.current&&i!==null&&i.observe(t.current),function(){i!==null&&i.disconnect()}},[i]),[t,n]},Skt=function(t){return typeof t=="function"?t:typeof t=="string"?t.indexOf("time:")===0?Tge(t.slice("5")):_ge(t):function(e){return""+e}},Nkt=function(t){return b.useMemo(function(){return Skt(t)},[t])},jkt=function(t,e,n,r){return Math.sqrt(Math.pow(n-t,2)+Math.pow(r-e,2))},Ckt=function(t,e){var n,r="touches"in e?e.touches[0]:e,i=r.clientX,s=r.clientY,a=t.getBoundingClientRect(),l=(n=t.getBBox!==void 0?t.getBBox():{width:t.offsetWidth||0,height:t.offsetHeight||0}).width===a.width?1:n.width/a.width;return[(i-a.left)*l,(s-a.top)*l]},kkt=Object.keys(Oge),Ekt=Object.keys(Rge),Akt=function(t,e,n){if(t==="*")return!0;
4948if(Kt(t))return t(e);if(DM(t)){var r=n?vi(e,n):e;return Rh(ikt(r,Object.keys(t)),t)}return!1},Tkt=function(t,e,n,r){var i=r===void 0?{}:r,s=i.dataKey,a=i.colorKey,l=a===void 0?"color":a,c=i.targetKey,u=c===void 0?"fill":c,d=[],f={};return t.length&&e.length&&(d=[].concat(t),e.forEach(function(h){for(var p,m=function(){var y=p.value,g=y.id,w=y.match;if(Akt(w,h,s)){var v=t.find(function(M){return M.id===g});if(v){if(Ekt.includes(v.type))if(v.background==="inherit"||v.color==="inherit"){var N=vi(h,l),S=v.background,_=v.color,j=g;v.background==="inherit"&&(j=j+".bg."+N,S=N),v.color==="inherit"&&(j=j+".fg."+N,_=N),vw(h,u,"url(#"+j+")"),f[j]||(d.push(tu({},v,{id:j,background:S,color:_})),f[j]=1)}else vw(h,u,"url(#"+g+")");else if(kkt.includes(v.type))if(v.colors.map(function(M){return M.color}).includes("inherit")){var A=vi(h,l),C=g,k=tu({},v,{colors:v.colors.map(function(M,I){return M.color!=="inherit"?M:(C=C+"."+I+"."+A,tu({},M,{color:M.color==="inherit"?A:M.color}))})});k.id=C,vw(h,u,"url(#"+C+")"),f[C]||(d.push(k),f[C]=1)}else vw(h,u,"url(#"+g+")")}return 1}},x=ukt(n);!(p=x()).done&&!m(););})),d},Lge=/^--/;function Mkt(t,e){return e==null||typeof e=="boolean"||e===""?"":typeof e=="number"&&e!==0&&!Lge.test(t)&&!(t1.hasOwnProperty(t)&&t1[t])?e+"px":(""+e).trim()}var _J={};function Pkt(t,e){if(!t.nodeType||!t.setAttribute)return!1;const n=t.nodeName==="filter"||t.parentNode&&t.parentNode.nodeName==="filter",{className:r,style:i,children:s,scrollTop:a,scrollLeft:l,viewBox:c,...u}=e,d=Object.values(u),f=Object.keys(u).map(h=>n||t.hasAttribute(h)?h:_J[h]||(_J[h]=h.replace(/([A-Z])/g,p=>"-"+p.toLowerCase())));s!==void 0&&(t.textContent=s);for(const h in i)if(i.hasOwnProperty(h)){const p=Mkt(h,i[h]);Lge.test(h)?t.style.setProperty(h,p):t.style[h]=p}f.forEach((h,p)=>{t.setAttribute(h,d[p])}),r!==void 0&&(t.className=r),a!==void 0&&(t.scrollTop=a),l!==void 0&&(t.scrollLeft=l),c!==void 0&&t.setAttribute("viewBox",c)}var t1={animationIterationCount:!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,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},Okt=(t,e)=>t+e.charAt(0).toUpperCase()+e.substring(1),Rkt=["Webkit","Ms","Moz","O"];t1=Object.keys(t1).reduce((t,e)=>(Rkt.forEach(n=>t[Okt(n,e)]=t[e]),t),t1);var Ikt=/^(matrix|translate|scale|rotate|skew)/,Dkt=/^(translate)/,Lkt=/^(rotate|skew)/,h3=(t,e)=>We.num(t)&&t!==0?t+e:t,ok=(t,e)=>We.arr(t)?t.every(n=>ok(n,e)):We.num(t)?t===e:parseFloat(t)===e,$kt=class extends ip{constructor({x:e,y:n,z:r,...i}){const s=[],a=[];(e||n||r)&&(s.push([e||0,n||0,r||0]),a.push(l=>[`translate3d(${l.map(c=>h3(c,"px")).join(",")})`,ok(l,0)])),Ka(i,(l,c)=>{if(c==="transform")s.push([l||""]),a.push(u=>[u,u===""]);else if(Ikt.test(c)){if(delete i[c],We.und(l))return;const u=Dkt.test(c)?"px":Lkt.test(c)?"deg":"";s.push(Ji(l)),a.push(c==="rotate3d"?([d,f,h,p])=>[`rotate3d(${d},${f},${h},${h3(p,u)})`,ok(p,0)]:d=>[`${c}(${d.map(f=>h3(f,u)).join(",")})`,ok(d,c.startsWith("scale")?1:0)])}}),s.length&&(i.transform=new Fkt(s,a)),super(i)}},Fkt=class extends Y0{constructor(e,n){super(),this.inputs=e,this.transforms=n,this._value=null}get(){return this._value||(this._value=this._get())}_get(){let e="",n=!0;return yt(this.inputs,(r,i)=>{const s=fi(r[0]),[a,l]=this.transforms[i](We.arr(s)?s:r.map(fi));e+=" "+a,n=n&&l}),n?"none":e}observerAdded(e){e==1&&yt(this.inputs,n=>yt(n,r=>ki(r)&&wu(r,this)))}observerRemoved(e){e==0&&yt(this.inputs,n=>yt(n,r=>ki(r)&&Id(r,this)))}eventObserved(e){e.type=="change"&&(this._value=null),Rd(this,e)}},Ukt=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"];ya.assign({batchedUpdates:wl.unstable_batchedUpdates,createStringInterpolator:X0,colors:cN});var zkt=uN(Ukt,{applyAnimatedValues:Pkt,createAnimatedStyle:t=>new $kt(t),getComponentProps:({scrollTop:t,scrollLeft:e,...n})=>n}),SJ=zkt.animated;function n1(){return n1=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},n1.apply(null,arguments)}function NJ(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var Bkt=["style","children"],Vkt=["outlineWidth","outlineColor","outlineOpacity"],BP=function(t){var e=t.style,n=t.children,r=NJ(t,Bkt),i=e.outlineWidth,s=e.outlineColor,a=e.outlineOpacity,l=NJ(e,Vkt);return o.jsxs(o.Fragment,{children:[i>0&&o.jsx(SJ.text,n1({},r,{style:n1({},l,{strokeWidth:2*i,stroke:s,strokeOpacity:a,strokeLinejoin:"round"}),children:n})),o.jsx(SJ.text,n1({},r,{style:l,children:n}))]})},$ge=/^--/;function Hkt(t,e){return e==null||typeof e=="boolean"||e===""?"":typeof e=="number"&&e!==0&&!$ge.test(t)&&!(r1.hasOwnProperty(t)&&r1[t])?e+"px":(""+e).trim()}var jJ={};function Wkt(t,e){if(!t.nodeType||!t.setAttribute)return!1;const n=t.nodeName==="filter"||t.parentNode&&t.parentNode.nodeName==="filter",{className:r,style:i,children:s,scrollTop:a,scrollLeft:l,viewBox:c,...u}=e,d=Object.values(u),f=Object.keys(u).map(h=>n||t.hasAttribute(h)?h:jJ[h]||(jJ[h]=h.replace(/([A-Z])/g,p=>"-"+p.toLowerCase())));s!==void 0&&(t.textContent=s);for(const h in i)if(i.hasOwnProperty(h)){const p=Hkt(h,i[h]);$ge.test(h)?t.style.setProperty(h,p):t.style[h]=p}f.forEach((h,p)=>{t.setAttribute(h,d[p])}),r!==void 0&&(t.className=r),a!==void 0&&(t.scrollTop=a),l!==void 0&&(t.scrollLeft=l),c!==void 0&&t.setAttribute("viewBox",c)}var r1={animationIterationCount:!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,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},Gkt=(t,e)=>t+e.charAt(0).toUpperCase()+e.substring(1),qkt=["Webkit","Ms","Moz","O"];r1=Object.keys(r1).reduce((t,e)=>(qkt.forEach(n=>t[Gkt(n,e)]=t[e]),t),r1);var Kkt=/^(matrix|translate|scale|rotate|skew)/,Ykt=/^(translate)/,Xkt=/^(rotate|skew)/,p3=(t,e)=>We.num(t)&&t!==0?t+e:t,lk=(t,e)=>We.arr(t)?t.every(n=>lk(n,e)):We.num(t)?t===e:parseFloat(t)===e,Qkt=class extends ip{constructor({x:e,y:n,z:r,...i}){const s=[],a=[];(e||n||r)&&(s.push([e||0,n||0,r||0]),a.push(l=>[`translate3d(${l.map(c=>p3(c,"px")).join(",")})`,lk(l,0)])),Ka(i,(l,c)=>{if(c==="transform")s.push([l||""]),a.push(u=>[u,u===""]);else if(Kkt.test(c)){if(delete i[c],We.und(l))return;const u=Ykt.test(c)?"px":Xkt.test(c)?"deg":"";s.push(Ji(l)),a.push(c==="rotate3d"?([d,f,h,p])=>[`rotate3d(${d},${f},${h},${p3(p,u)})`,lk(p,0)]:d=>[`${c}(${d.map(f=>p3(f,u)).join(",")})`,lk(d,c.startsWith("scale")?1:0)])}}),s.length&&(i.transform=new Jkt(s,a)),super(i)}},Jkt=class extends Y0{constructor(e,n){super(),this.inputs=e,this.transforms=n,this._value=null}get(){return this._value||(this._value=this._get())}_get(){let e="",n=!0;return yt(this.inputs,(r,i)=>{const s=fi(r[0]),[a,l]=this.transforms[i](We.arr(s)?s:r.map(fi));e+=" "+a,n=n&&l}),n?"none":e}
4948observerAdded(e){e==1&&yt(this.inputs,n=>yt(n,r=>ki(r)&&wu(r,this)))}observerRemoved(e){e==0&&yt(this.inputs,n=>yt(n,r=>ki(r)&&Id(r,this)))}eventObserved(e){e.type=="change"&&(this._value=null),Rd(this,e)}},Zkt=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"];ya.assign({batchedUpdates:wl.unstable_batchedUpdates,createStringInterpolator:X0,colors:cN});var e2t=uN(Zkt,{applyAnimatedValues:Wkt,createAnimatedStyle:t=>new Qkt(t),getComponentProps:({scrollTop:t,scrollLeft:e,...n})=>n}),FE=e2t.animated,m3=new Date,g3=new Date;function Wd(t,e,n,r){function i(s){return t(s=arguments.length===0?new Date:new Date(+s)),s}return i.floor=function(s){return t(s=new Date(+s)),s},i.ceil=function(s){return t(s=new Date(s-1)),e(s,1),t(s),s},i.round=function(s){var a=i(s),l=i.ceil(s);return s-a<l-s?a:l},i.offset=function(s,a){return e(s=new Date(+s),a==null?1:Math.floor(a)),s},i.range=function(s,a,l){var c=[],u;if(s=i.ceil(s),l=l==null?1:Math.floor(l),!(s<a)||!(l>0))return c;do c.push(u=new Date(+s)),e(s,l),t(s);while(u<s&&s<a);return c},i.filter=function(s){return Wd(function(a){if(a>=a)for(;t(a),!s(a);)a.setTime(a-1)},function(a,l){if(a>=a)if(l<0)for(;++l<=0;)for(;e(a,-1),!s(a););else for(;--l>=0;)for(;e(a,1),!s(a););})},n&&(i.count=function(s,a){return m3.setTime(+s),g3.setTime(+a),t(m3),t(g3),Math.floor(n(m3,g3))},i.every=function(s){return s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?i.filter(r?function(a){return r(a)%s===0}:function(a){return i.count(0,a)%s===0}):i}),i}const t2t=1e3,$8=t2t*60,n2t=$8*60,F8=n2t*24,Fge=F8*7;var U8=Wd(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*$8)/F8,t=>t.getDate()-1);U8.range;function $g(t){return Wd(function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},function(e,n){e.setDate(e.getDate()+n*7)},function(e,n){return(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*$8)/Fge})}var Uge=$g(0),UE=$g(1),r2t=$g(2),i2t=$g(3),t0=$g(4),s2t=$g(5),a2t=$g(6);Uge.range;UE.range;r2t.range;i2t.range;t0.range;s2t.range;a2t.range;var ag=Wd(function(t){t.setMonth(0,1),t.setHours(0,0,0,0)},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t,e){return e.getFullYear()-t.getFullYear()},function(t){return t.getFullYear()});ag.every=function(t){return!isFinite(t=Math.floor(t))||!(t>0)?null:Wd(function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},function(e,n){e.setFullYear(e.getFullYear()+n*t)})};ag.range;var z8=Wd(function(t){t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCDate(t.getUTCDate()+e)},function(t,e){return(e-t)/F8},function(t){return t.getUTCDate()-1});z8.range;function Fg(t){return Wd(function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},function(e,n){e.setUTCDate(e.getUTCDate()+n*7)},function(e,n){return(n-e)/Fge})}var zge=Fg(0),zE=Fg(1),o2t=Fg(2),l2t=Fg(3),n0=Fg(4),c2t=Fg(5),u2t=Fg(6);zge.range;zE.range;o2t.range;l2t.range;n0.range;c2t.range;u2t.range;var og=Wd(function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)},function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()},function(t){return t.getUTCFullYear()});og.every=function(t){return!isFinite(t=Math.floor(t))||!(t>0)?null:Wd(function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},function(e,n){e.setUTCFullYear(e.getUTCFullYear()+n*t)})};og.range;function x3(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function y3(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Wb(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function d2t(t){var e=t.dateTime,n=t.date,r=t.time,i=t.periods,s=t.days,a=t.shortDays,l=t.months,c=t.shortMonths,u=Gb(i),d=qb(i),f=Gb(s),h=qb(s),p=Gb(a),m=qb(a
vendor: 4,565 bytes, line 4948
4948),x=Gb(l),y=qb(l),g=Gb(c),w=qb(c),v={a:L,A:T,b:D,B:F,c:null,d:MJ,e:MJ,f:R2t,g:H2t,G:G2t,H:M2t,I:P2t,j:O2t,L:Bge,m:I2t,M:D2t,p:q,q:B,Q:RJ,s:IJ,S:L2t,u:$2t,U:F2t,V:U2t,w:z2t,W:B2t,x:null,X:null,y:V2t,Y:W2t,Z:q2t,"%":OJ},N={a:z,A:H,b:W,B:G,c:null,d:PJ,e:PJ,f:Q2t,g:oEt,G:cEt,H:K2t,I:Y2t,j:X2t,L:Hge,m:J2t,M:Z2t,p:K,q:ee,Q:RJ,s:IJ,S:eEt,u:tEt,U:nEt,V:rEt,w:iEt,W:sEt,x:null,X:null,y:aEt,Y:lEt,Z:uEt,"%":OJ},S={a:k,A:M,b:I,B:R,c:E,d:AJ,e:AJ,f:k2t,g:EJ,G:kJ,H:TJ,I:TJ,j:S2t,L:C2t,m:_2t,M:N2t,p:C,q:w2t,Q:A2t,s:T2t,S:j2t,u:g2t,U:x2t,V:y2t,w:m2t,W:v2t,x:P,X:O,y:EJ,Y:kJ,Z:b2t,"%":E2t};v.x=_(n,v),v.X=_(r,v),v.c=_(e,v),N.x=_(n,N),N.X=_(r,N),N.c=_(e,N);function _(V,J){return function(Y){var $=[],fe=-1,ce=0,ve=V.length,X,de,Te;for(Y instanceof Date||(Y=new Date(+Y));++fe<ve;)V.charCodeAt(fe)===37&&($.push(V.slice(ce,fe)),(de=CJ[X=V.charAt(++fe)])!=null?X=V.charAt(++fe):de=X==="e"?" ":"0",(Te=J[X])&&(X=Te(Y,de)),$.push(X),ce=fe+1);return $.push(V.slice(ce,fe)),$.join("")}}function j(V,J){return function(Y){var $=Wb(1900,void 0,1),fe=A($,V,Y+="",0),ce,ve;if(fe!=Y.length)return null;if("Q"in $)return new Date($.Q);if("s"in $)return new Date($.s*1e3+("L"in $?$.L:0));if(J&&!("Z"in $)&&($.Z=0),"p"in $&&($.H=$.H%12+$.p*12),$.m===void 0&&($.m="q"in $?$.q:0),"V"in $){if($.V<1||$.V>53)return null;"w"in $||($.w=1),"Z"in $?(ce=y3(Wb($.y,0,1)),ve=ce.getUTCDay(),ce=ve>4||ve===0?zE.ceil(ce):zE(ce),ce=z8.offset(ce,($.V-1)*7),$.y=ce.getUTCFullYear(),$.m=ce.getUTCMonth(),$.d=ce.getUTCDate()+($.w+6)%7):(ce=x3(Wb($.y,0,1)),ve=ce.getDay(),ce=ve>4||ve===0?UE.ceil(ce):UE(ce),ce=U8.offset(ce,($.V-1)*7),$.y=ce.getFullYear(),$.m=ce.getMonth(),$.d=ce.getDate()+($.w+6)%7)}else("W"in $||"U"in $)&&("w"in $||($.w="u"in $?$.u%7:"W"in $?1:0),ve="Z"in $?y3(Wb($.y,0,1)).getUTCDay():x3(Wb($.y,0,1)).getDay(),$.m=0,$.d="W"in $?($.w+6)%7+$.W*7-(ve+5)%7:$.w+$.U*7-(ve+6)%7);return"Z"in $?($.H+=$.Z/100|0,$.M+=$.Z%100,y3($)):x3($)}}function A(V,J,Y,$){for(var fe=0,ce=J.length,ve=Y.length,X,de;fe<ce;){if($>=ve)return-1;if(X=J.charCodeAt(fe++),X===37){if(X=J.charAt(fe++),de=S[X in CJ?J.charAt(fe++):X],!de||($=de(V,Y,$))<0)return-1}else if(X!=Y.charCodeAt($++))return-1}return $}function C(V,J,Y){var $=u.exec(J.slice(Y));return $?(V.p=d.get($[0].toLowerCase()),Y+$[0].length):-1}function k(V,J,Y){var $=p.exec(J.slice(Y));return $?(V.w=m.get($[0].toLowerCase()),Y+$[0].length):-1}function M(V,J,Y){var $=f.exec(J.slice(Y));return $?(V.w=h.get($[0].toLowerCase()),Y+$[0].length):-1}function I(V,J,Y){var $=g.exec(J.slice(Y));return $?(V.m=w.get($[0].toLowerCase()),Y+$[0].length):-1}function R(V,J,Y){var $=x.exec(J.slice(Y));return $?(V.m=y.get($[0].toLowerCase()),Y+$[0].length):-1}function E(V,J,Y){return A(V,e,J,Y)}function P(V,J,Y){return A(V,n,J,Y)}function O(V,J,Y){return A(V,r,J,Y)}function L(V){return a[V.getDay()]}function T(V){return s[V.getDay()]}function D(V){return c[V.getMonth()]}function F(V){return l[V.getMonth()]}function q(V){return i[+(V.getHours()>=12)]}function B(V){return 1+~~(V.getMonth()/3)}function z(V){return a[V.getUTCDay()]}function H(V){return s[V.getUTCDay()]}function W(V){return c[V.getUTCMonth()]}function G(V){return l[V.getUTCMonth()]}function K(V){return i[+(V.getUTCHours()>=12)]}function ee(V){return 1+~~(V.getUTCMonth()/3)}return{format:function(V){var J=_(V+="",v);return J.toString=function(){return V},J},parse:function(V){var J=j(V+="",!1);return J.toString=function(){return V},J},utcFormat:function(V){var J=_(V+="",N);return J.toString=function(){return V},J},utcParse:function(V){var J=j(V+="",!0);return J.toString=function(){return V},J}}}var CJ={"-":"",_:" ",0:"0"},js=/^\s*\d+/,f2t=/^%/,h2t=/[\\^$*+?|[\]().{}]/g;function qn(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",s=i.length;return r+(s<n?new Array(n-s+1).join(e)+i:i)}function p2t(t){return t.replace(h2t,"\\$&")}function Gb(t){return new RegExp("^(?:"+t.map(p2t).join("|")+")","i")}function qb(t){return new Map(t.map((e,n)=>[e.toLowerCase(),n]))}function m2t(t,e,n){var r=js.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function g2t(t,e,n){var r=js.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function x2t(t,e,n){var r=js.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function y2t(t,e,n){var r=js.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function v2t(t,e,n){var r=js.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function kJ(t,e,n){var r=js.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function EJ(t,e,n){var r=js.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}
vendor: 4,118 bytes, line 4948
4948function b2t(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function w2t(t,e,n){var r=js.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function _2t(t,e,n){var r=js.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function AJ(t,e,n){var r=js.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function S2t(t,e,n){var r=js.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function TJ(t,e,n){var r=js.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function N2t(t,e,n){var r=js.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function j2t(t,e,n){var r=js.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function C2t(t,e,n){var r=js.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function k2t(t,e,n){var r=js.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function E2t(t,e,n){var r=f2t.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function A2t(t,e,n){var r=js.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function T2t(t,e,n){var r=js.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function MJ(t,e){return qn(t.getDate(),e,2)}function M2t(t,e){return qn(t.getHours(),e,2)}function P2t(t,e){return qn(t.getHours()%12||12,e,2)}function O2t(t,e){return qn(1+U8.count(ag(t),t),e,3)}function Bge(t,e){return qn(t.getMilliseconds(),e,3)}function R2t(t,e){return Bge(t,e)+"000"}function I2t(t,e){return qn(t.getMonth()+1,e,2)}function D2t(t,e){return qn(t.getMinutes(),e,2)}function L2t(t,e){return qn(t.getSeconds(),e,2)}function $2t(t){var e=t.getDay();return e===0?7:e}function F2t(t,e){return qn(Uge.count(ag(t)-1,t),e,2)}function Vge(t){var e=t.getDay();return e>=4||e===0?t0(t):t0.ceil(t)}function U2t(t,e){return t=Vge(t),qn(t0.count(ag(t),t)+(ag(t).getDay()===4),e,2)}function z2t(t){return t.getDay()}function B2t(t,e){return qn(UE.count(ag(t)-1,t),e,2)}function V2t(t,e){return qn(t.getFullYear()%100,e,2)}function H2t(t,e){return t=Vge(t),qn(t.getFullYear()%100,e,2)}function W2t(t,e){return qn(t.getFullYear()%1e4,e,4)}function G2t(t,e){var n=t.getDay();return t=n>=4||n===0?t0(t):t0.ceil(t),qn(t.getFullYear()%1e4,e,4)}function q2t(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+qn(e/60|0,"0",2)+qn(e%60,"0",2)}function PJ(t,e){return qn(t.getUTCDate(),e,2)}function K2t(t,e){return qn(t.getUTCHours(),e,2)}function Y2t(t,e){return qn(t.getUTCHours()%12||12,e,2)}function X2t(t,e){return qn(1+z8.count(og(t),t),e,3)}function Hge(t,e){return qn(t.getUTCMilliseconds(),e,3)}function Q2t(t,e){return Hge(t,e)+"000"}function J2t(t,e){return qn(t.getUTCMonth()+1,e,2)}function Z2t(t,e){return qn(t.getUTCMinutes(),e,2)}function eEt(t,e){return qn(t.getUTCSeconds(),e,2)}function tEt(t){var e=t.getUTCDay();return e===0?7:e}function nEt(t,e){return qn(zge.count(og(t)-1,t),e,2)}function Wge(t){var e=t.getUTCDay();return e>=4||e===0?n0(t):n0.ceil(t)}function rEt(t,e){return t=Wge(t),qn(n0.count(og(t),t)+(og(t).getUTCDay()===4),e,2)}function iEt(t){return t.getUTCDay()}function sEt(t,e){return qn(zE.count(og(t)-1,t),e,2)}function aEt(t,e){return qn(t.getUTCFullYear()%100,e,2)}function oEt(t,e){return t=Wge(t),qn(t.getUTCFullYear()%100,e,2)}function lEt(t,e){return qn(t.getUTCFullYear()%1e4,e,4)}function cEt(t,e){var n=t.getUTCDay();return t=n>=4||n===0?n0(t):n0.ceil(t),qn(t.getUTCFullYear()%1e4,e,4)}function uEt(){return"+0000"}function OJ(){return"%"}function RJ(t){return+t}function IJ(t){return Math.floor(+t/1e3)}var kx,Gge;dEt({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function dEt(t){return kx=d2t(t),Gge=kx.format,kx.parse,kx.utcFormat,kx.utcParse,kx}function fEt(t){return Math.abs(t=Math.round(t))>
vendor: 5,224 bytes, line 4948
4948=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function BE(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function hEt(t){return t=BE(Math.abs(t)),t?t[1]:NaN}function pEt(t,e){return function(n,r){for(var i=n.length,s=[],a=0,l=t[0],c=0;i>0&&l>0&&(c+l+1>r&&(l=Math.max(1,r-c)),s.push(n.substring(i-=l,i+l)),!((c+=l+1)>r));)l=t[a=(a+1)%t.length];return s.reverse().join(e)}}function mEt(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var gEt=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function nF(t){if(!(e=gEt.exec(t)))throw new Error("invalid format: "+t);var e;return new B8({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}nF.prototype=B8.prototype;function B8(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}B8.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function xEt(t){e:for(var e=t.length,n=1,r=-1,i;n<e;++n)switch(t[n]){case".":r=i=n;break;case"0":r===0&&(r=n),i=n;break;default:if(!+t[n])break e;r>0&&(r=0);break}return r>0?t.slice(0,r)+t.slice(i+1):t}var qge;function yEt(t,e){var n=BE(t,e);if(!n)return t+"";var r=n[0],i=n[1],s=i-(qge=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,a=r.length;return s===a?r:s>a?r+new Array(s-a+1).join("0"):s>0?r.slice(0,s)+"."+r.slice(s):"0."+new Array(1-s).join("0")+BE(t,Math.max(0,e+s-1))[0]}function DJ(t,e){var n=BE(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const LJ={"%":function(t,e){return(t*100).toFixed(e)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:fEt,e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},g:function(t,e){return t.toPrecision(e)},o:function(t){return Math.round(t).toString(8)},p:function(t,e){return DJ(t*100,e)},r:DJ,s:yEt,X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}};function $J(t){return t}var FJ=Array.prototype.map,UJ=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function vEt(t){var e=t.grouping===void 0||t.thousands===void 0?$J:pEt(FJ.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",r=t.currency===void 0?"":t.currency[1]+"",i=t.decimal+"",s=t.numerals===void 0?$J:mEt(FJ.call(t.numerals,String)),a=t.percent===void 0?"%":t.percent+"",l=t.minus+"",c=t.nan===void 0?"NaN":t.nan+"";function u(f){f=nF(f);var h=f.fill,p=f.align,m=f.sign,x=f.symbol,y=f.zero,g=f.width,w=f.comma,v=f.precision,N=f.trim,S=f.type;S==="n"?(w=!0,S="g"):LJ[S]||(v===void 0&&(v=12),N=!0,S="g"),(y||h==="0"&&p==="=")&&(y=!0,h="0",p="=");var _=x==="$"?n:x==="#"&&/[boxX]/.test(S)?"0"+S.toLowerCase():"",j=x==="$"?r:/[%p]/.test(S)?a:"",A=LJ[S],C=/[defgprs%]/.test(S);v=v===void 0?6:/[gprs]/.test(S)?Math.max(1,Math.min(21,v)):Math.max(0,Math.min(20,v));function k(M){var I=_,R=j,E,P,O;if(S==="c")R=A(M)+R,M="";else{M=+M;var L=M<0||1/M<0;if(M=isNaN(M)?c:A(Math.abs(M),v),N&&(M=xEt(M)),L&&+M==0&&m!=="+"&&(L=!1),I=(L?m==="("?m:l:m==="-"||m==="("?"":m)+I,R=(S==="s"?UJ[8+qge/3]:"")+R+(L&&m==="("?")":""),C){for(E=-1,P=M.length;++E<P;)if(O=M.charCodeAt(E),48>O||O>57){R=(O===46?i+M.slice(E+1):M.slice(E))+R,M=M.slice(0,E);break}}}w&&!y&&(M=e(M,1/0));var T=I.length+M.length+R.length,D=T<g?new Array(g-T+1).join(h):"";switch(w&&y&&(M=e(D+M,D.length?g-R.length:1/0),D=""),p){case"<":M=I+M+R+D;break;case"=":M=I+D+M+R;break;case"^":M=D.slice(0,T=D.length>>1)+I+M+R+D.slice(T);break;default:M=D+I+M+R;break}return s(M)}return k.toString=function(){return f+""},k}function d(f,h){var p=u((f=nF(f),f.type="f",f)),m=Math.max(-8,Math.min(8,Math.floor(hEt(h)/3)))*3,x=Math.pow(10,-m),y=UJ[8+m/3];return function(g){return p(x*g)+y}}return{format:u,formatPrefix:d}}var Jj,Kge;bEt({decimal:".",thousands:",",grouping:[3],currency:["$",""],minus:"-"});function bEt(t){return Jj=vEt(t),Kge=Jj.format,Jj.formatPrefix,Jj}var zJ=sue;zJ&&zJ.isDate;var v3=new Date,b3=new Date;function _s(t,e,n,r){function i(s){return t(s=arguments.length===0?new Date:new Date(+s)),s}return i.floor=function(s){return t(s=new Date(+s)),s},i.ceil=function(s){return t(s=new Date(s-1)),e(s,1),t(s),s},i.round=function(s){var a=i(s),l=i.ceil(s);return s-a<l-s?a:l},i.offset=function(s,a){return e(s=new Date(+s),a==null?1:Math.floor(a)),s},i.range=function(s,a,l){var c=[],u;if(s=i.ceil(s),l=l==null?1:Math.floor(l),!(s<a)||!(l>0))return c;do c.push(u=new Date(+s)),e(s,l),t(s);while(u<s&&s<a);return c}
4948,i.filter=function(s){return _s(function(a){if(a>=a)for(;t(a),!s(a);)a.setTime(a-1)},function(a,l){if(a>=a)if(l<0)for(;++l<=0;)for(;e(a,-1),!s(a););else for(;--l>=0;)for(;e(a,1),!s(a););})},n&&(i.count=function(s,a){return v3.setTime(+s),b3.setTime(+a),t(v3),t(b3),Math.floor(n(v3,b3))},i.every=function(s){return s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?i.filter(r?function(a){return r(a)%s===0}:function(a){return i.count(0,a)%s===0}):i}),i}var H_=_s(function(){},function(t,e){t.setTime(+t+e)},function(t,e){return e-t});H_.every=function(t){return t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?_s(function(e){e.setTime(Math.floor(e/t)*t)},function(e,n){e.setTime(+e+n*t)},function(e,n){return(n-e)/t}):H_};H_.range;var VE=1e3,r0=6e4,HE=36e5,Yge=6048e5,rF=_s(function(t){t.setTime(t-t.getMilliseconds())},function(t,e){t.setTime(+t+e*VE)},function(t,e){return(e-t)/VE},function(t){return t.getUTCSeconds()});rF.range;var Xge=_s(function(t){t.setTime(t-t.getMilliseconds()-t.getSeconds()*VE)},function(t,e){t.setTime(+t+e*r0)},function(t,e){return(e-t)/r0},function(t){return t.getMinutes()});Xge.range;var Qge=_s(function(t){t.setTime(t-t.getMilliseconds()-t.getSeconds()*VE-t.getMinutes()*r0)},function(t,e){t.setTime(+t+e*HE)},function(t,e){return(e-t)/HE},function(t){return t.getHours()});Qge.range;function Ug(t){return _s(function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},function(e,n){e.setDate(e.getDate()+n*7)},function(e,n){return(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*r0)/Yge})}var iF=Ug(0),Jge=Ug(1),Zge=Ug(2),exe=Ug(3),txe=Ug(4),nxe=Ug(5),rxe=Ug(6);iF.range;Jge.range;Zge.range;exe.range;txe.range;nxe.range;rxe.range;var ixe=_s(function(t){t.setDate(1),t.setHours(0,0,0,0)},function(t,e){t.setMonth(t.getMonth()+e)},function(t,e){return e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12},function(t){return t.getMonth()});ixe.range;var V8=_s(function(t){t.setMonth(0,1),t.setHours(0,0,0,0)},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t,e){return e.getFullYear()-t.getFullYear()},function(t){return t.getFullYear()});V8.every=function(t){return!isFinite(t=Math.floor(t))||!(t>0)?null:_s(function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},function(e,n){e.setFullYear(e.getFullYear()+n*t)})};V8.range;var sxe=_s(function(t){t.setUTCSeconds(0,0)},function(t,e){t.setTime(+t+e*r0)},function(t,e){return(e-t)/r0},function(t){return t.getUTCMinutes()});sxe.range;var axe=_s(function(t){t.setUTCMinutes(0,0,0)},function(t,e){t.setTime(+t+e*HE)},function(t,e){return(e-t)/HE},function(t){return t.getUTCHours()});axe.range;function zg(t){return _s(function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},function(e,n){e.setUTCDate(e.getUTCDate()+n*7)},function(e,n){return(n-e)/Yge})}var sF=zg(0),oxe=zg(1),lxe=zg(2),cxe=zg(3),uxe=zg(4),dxe=zg(5),fxe=zg(6);sF.range;oxe.range;lxe.range;cxe.range;uxe.range;dxe.range;fxe.range;var hxe=_s(function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCMonth(t.getUTCMonth()+e)},function(t,e){return e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12},function(t){return t.getUTCMonth()});hxe.range;var H8=_s(function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)},function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()},function(t){return t.getUTCFullYear()});H8.every=function(t){return!isFinite(t=Math.floor(t))||!(t>0)?null:_s(function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},function(e,n){e.setUTCFullYear(e.getUTCFullYear()+n*t)})};H8.range;var wEt=function(t,e){e===void 0&&(e=!1);var n=t;return n.type="linear",n.stacked=e,n},aF=function(t){var e=t;return e.type="point",e},pxe=function(t){var e=t.bandwidth();if(e===0)return t;var n=e/2;return t.round()&&(n=Math.round(n)),function(r){var i;return((i=t(r))!=null?i:0)+n}},mxe={millisecond:[H_,H_],second:[rF,rF],minute:[Xge,sxe],hour:[Qge,axe],day:[_s(function(t){return t.setHours(0,0,0,0)},function(t,e){return t.setDate(t.getDate()+e)},function(t,e){return(e.getTime()-t.getTime())/864e5},function(t){return Math.floor(t.getTime()/864e5)}),_s(function(t){return t.setUTCHours(0,0,0,0)},function(t,e){return t.setUTCDate(t.getUTCDate()+e)},function(t,e){return(e.getTime()-t.getTime())/864e5},function(t){return Math.floor(t.getTime()/864e5)})],week:[iF,sF],sunday:[iF,sF],monday:[Jge,oxe],tuesday:[Zge,lxe],wednesday:[exe,cxe],thursday:[txe,uxe],friday:[nxe,dxe],saturday:[rxe,fxe],month:[ixe,hxe],year:[V8,H8]},_Et=Object.keys(mxe),SEt=new RegExp("^every\\s*(\\d+)?\\s*("+_Et.join("|")+")s?$","i"),gxe=function(t,e){if(Array.isArray(e))return e;if(typeof e=="string"&&"useUTC"in t){var n=e.match(SEt);if(n){var r=n[1],i=n[2],s=mxe[i][t.useUTC?1:0];if(i==="day"){var a,l,c=t.domain(),u=c[0],d=c[1],f=new Date(d);return f.setDate(f.getDate()+1),(a=(l=s.every(Number(r??1)))==null?void 0:l.range(u,f))!=null?a:[]}if(r===void 0)return t.ticks(s);var h=s.every(Number(r));if(h)return t.ticks(h)}throw new Error("Invalid tickValues: "+e)}if("ticks"in t){if(e===void 0)return t.ticks();if(typeof(p=e)=="number"&&isFinite(p)&&Math.floor(p)===p)return t.ticks(e)}var p;return t.domain()};function du(){return du=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},du.apply(null,arguments)}var NEt=function(t){var e,n=t.axis,r=t.scale,i=t.ticksPosition,s=t.tickValues,a=t.tickSize,l=t.tickPadding,c=t.tickRotation,u=t.truncateTickAt,d=t.engine,f=d===void 0?"svg":d,h=gxe(r,s),p=pkt[f],m="bandwidth"in r?pxe(r):r,x={lineX:0,lineY:0},y={textX:0,textY:0},g=typeof document=="object"&&document.dir==="rtl",w=p.align.center,v=p.baseline.center;return n==="x"?(e=function(N){var S;return{x:(S=m(N))!=null?S:0,y:0}},x.lineY=a*(i==="after"?1:-1),y.textY=(a+l)*(i==="after"?1:-1),v=i==="after"?p.baseline.top:p.baseline.bottom,c===0?w=p.align.center:i==="after"&&c<0||i==="before"&&c>
49480?(w=p.align[g?"left":"right"],v=p.baseline.center):(i==="after"&&c>0||i==="before"&&c<0)&&(w=p.align[g?"right":"left"],v=p.baseline.center)):(e=function(N){var S;return{x:0,y:(S=m(N))!=null?S:0}},x.lineX=a*(i==="after"?1:-1),y.textX=(a+l)*(i==="after"?1:-1),w=i==="after"?p.align.left:p.align.right),{ticks:h.map(function(N){var S=typeof N=="string"?function(_){var j=String(_).length;return u&&u>0&&j>u?""+String(_).slice(0,u).concat("..."):""+_}(N):N;return du({key:N instanceof Date?""+N.valueOf():""+N,value:S},e(N),x,y)}),textAlign:w,textBaseline:v}},jEt=function(t,e){if(t===void 0||typeof t=="function")return t;if(e.type==="time"){var n=Gge(t);return function(r){return n(r instanceof Date?r:new Date(r))}}return Kge(t)},BJ=function(t){var e,n=t.width,r=t.height,i=t.scale,s=t.axis,a=t.values,l=(e=a,(Array.isArray(e)?a:void 0)||gxe(i,a)),c="bandwidth"in i?pxe(i):i,u=s==="x"?l.map(function(d){var f,h;return{key:d instanceof Date?""+d.valueOf():""+d,x1:(f=c(d))!=null?f:0,x2:(h=c(d))!=null?h:0,y1:0,y2:r}}):l.map(function(d){var f,h;return{key:d instanceof Date?""+d.valueOf():""+d,x1:0,x2:n,y1:(f=c(d))!=null?f:0,y2:(h=c(d))!=null?h:0}});return u},CEt=b.memo(function(t){var e,n=t.value,r=t.format,i=t.lineX,s=t.lineY,a=t.onClick,l=t.textBaseline,c=t.textAnchor,u=t.theme,d=t.animatedProps,f=(e=r==null?void 0:r(n))!=null?e:n,h=b.useMemo(function(){var p={opacity:d.opacity};return a?{style:du({},p,{cursor:"pointer"}),onClick:function(m){return a(m,f)}}:{style:p}},[d.opacity,a,f]);return o.jsxs(FE.g,du({transform:d.transform},h,{children:[o.jsx("line",{x1:0,x2:i,y1:0,y2:s,style:u.line}),o.jsx(BP,{dominantBaseline:l,textAnchor:c,transform:d.textTransform,style:u.text,children:""+f})]}))}),Kb={tickSize:5,tickPadding:5,tickRotation:0,legendPosition:"middle",legendOffset:0},kEt=function(t){var e=t.axis,n=t.scale,r=t.x,i=r===void 0?0:r,s=t.y,a=s===void 0?0:s,l=t.length,c=t.ticksPosition,u=t.tickValues,d=t.tickSize,f=d===void 0?Kb.tickSize:d,h=t.tickPadding,p=h===void 0?Kb.tickPadding:h,m=t.tickRotation,x=m===void 0?Kb.tickRotation:m,y=t.format,g=t.renderTick,w=g===void 0?CEt:g,v=t.truncateTickAt,N=t.legend,S=t.legendPosition,_=S===void 0?Kb.legendPosition:S,j=t.legendOffset,A=j===void 0?Kb.legendOffset:j,C=t.style,k=t.onClick,M=t.ariaHidden,I=ka(),R=FSt(I.axis,C),E=b.useMemo(function(){return jEt(y,n)},[y,n]),P=NEt({axis:e,scale:n,ticksPosition:c,tickValues:u,tickSize:f,tickPadding:p,tickRotation:x,truncateTickAt:v}),O=P.ticks,L=P.textAlign,T=P.textBaseline,D=null;if(N!==void 0){var F,q=0,B=0,z=0;e==="y"?(z=-90,q=A,_==="start"?(F="start",B=l):_==="middle"?(F="middle",B=l/2):_==="end"&&(F="end")):(B=A,_==="start"?F="start":_==="middle"?(F="middle",q=l/2):_==="end"&&(F="end",q=l)),D=o.jsx(o.Fragment,{children:o.jsx(BP,{transform:"translate("+q+", "+B+") rotate("+z+")",textAnchor:F,style:du({},R.legend.text,{dominantBaseline:"central"}),children:N})})}var H=_c(),W=H.animate,G=H.config,K=sp({transform:"translate("+i+","+a+")",lineX2:e==="x"?l:0,lineY2:e==="x"?0:l,config:G,immediate:!W}),ee=b.useCallback(function(Y){return{opacity:1,transform:"translate("+Y.x+","+Y.y+")",textTransform:"translate("+Y.textX+","+Y.textY+") rotate("+x+")"}},[x]),V=b.useCallback(function(Y){return{opacity:0,transform:"translate("+Y.x+","+Y.y+")",textTransform:"translate("+Y.textX+","+Y.textY+") rotate("+x+")"}},[x]),J=rge(O,{keys:function(Y){return Y.key},initial:ee,from:V,enter:ee,update:ee,leave:{opacity:0},config:G,immediate:!W});return o.jsxs(FE.g,{transform:K.transform,"aria-hidden":M,children:[J(function(Y,$,fe,ce){return b.createElement(w,du({tickIndex:ce,format:E,rotate:x,textBaseline:T,textAnchor:L,truncateTickAt:v,animatedProps:Y,theme:R.ticks},$,k?{onClick:k}:{}))}),o.jsx(FE.line,{style:R.domain.line,x1:0,x2:K.lineX2,y1:0,y2:K.lineY2}),D]})},EEt=b.memo(kEt),AEt=["top","right","bottom","left"],xxe=b.memo(function(t){var e=t.xScale,n=t.yScale,r=t.width,i=t.height,s={top:t.top,right:t.right,bottom:t.bottom,left:t.left};return o.jsx(o.Fragment,{children:AEt.map(function(a){var l=s[a];if(!l)return null;var c=a==="top"||a==="bottom";return o.jsx(EEt,du({},l,{axis:c?"x":"y",x:a==="right"?r:0,y:a==="bottom"?i:0,scale:c?e:n,length:c?r:i,ticksPosition:a==="top"||a==="left"?"before":"after",truncateTickAt:l.truncateTickAt}),a)})})}),TEt=b.memo(function(t){var e=t.animatedProps,n=ka();return o.jsx(FE.line,du({},e,n.grid.line))}
4948),VJ=b.memo(function(t){var e=t.lines,n=_c(),r=n.animate,i=n.config,s=rge(e,{keys:function(a){return a.key},initial:function(a){return{opacity:1,x1:a.x1,x2:a.x2,y1:a.y1,y2:a.y2}},from:function(a){return{opacity:0,x1:a.x1,x2:a.x2,y1:a.y1,y2:a.y2}},enter:function(a){return{opacity:1,x1:a.x1,x2:a.x2,y1:a.y1,y2:a.y2}},update:function(a){return{opacity:1,x1:a.x1,x2:a.x2,y1:a.y1,y2:a.y2}},leave:{opacity:0},config:i,immediate:!r});return o.jsx("g",{children:s(function(a,l){return b.createElement(TEt,du({},l,{key:l.key,animatedProps:a}))})})}),yxe=b.memo(function(t){var e=t.width,n=t.height,r=t.xScale,i=t.yScale,s=t.xValues,a=t.yValues,l=b.useMemo(function(){return!!r&&BJ({width:e,height:n,scale:r,axis:"x",values:s})},[r,s,e,n]),c=b.useMemo(function(){return!!i&&BJ({width:e,height:n,scale:i,axis:"y",values:a})},[n,e,i,a]);return o.jsxs(o.Fragment,{children:[l&&o.jsx(VJ,{lines:l}),c&&o.jsx(VJ,{lines:c})]})});function HJ(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function MEt(t,e){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=function(i,s){if(i){if(typeof i=="string")return HJ(i,s);var a={}.toString.call(i).slice(8,-1);return a==="Object"&&i.constructor&&(a=i.constructor.name),a==="Map"||a==="Set"?Array.from(i):a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?HJ(i,s):void 0}}(t))||e){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
4949In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function WE(){return WE=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},WE.apply(null,arguments)}var vxe={nivo:["#e8c1a0","#f47560","#f1e15b","#e8a838","#61cdbb","#97e3d5"],category10:TNt,accent:MNt,dark2:PNt,paired:ONt,pastel1:RNt,pastel2:INt,set1:DNt,set2:LNt,set3:bge,tableau10:$Nt},PEt=Object.keys(vxe),bxe={brown_blueGreen:pP,purpleRed_green:mP,pink_yellowGreen:gP,purple_orange:xP,red_blue:yP,red_grey:vP,red_yellow_blue:bP,red_yellow_green:wP,spectral:_P},OEt=Object.keys(bxe),REt={brown_blueGreen:FNt,purpleRed_green:UNt,pink_yellowGreen:zNt,purple_orange:BNt,red_blue:VNt,red_grey:HNt,red_yellow_blue:WNt,red_yellow_green:GNt,spectral:qNt},wxe={blues:IP,greens:DP,greys:LP,oranges:UP,purples:$P,reds:FP,blue_green:SP,blue_purple:NP,green_blue:jP,orange_red:CP,purple_blue_green:kP,purple_blue:EP,purple_red:AP,red_purple:TP,yellow_green_blue:MP,yellow_green:PP,yellow_orange_brown:OP,yellow_orange_red:RP},IEt=Object.keys(wxe),DEt={blues:ajt,greens:ojt,greys:ljt,oranges:djt,purples:cjt,reds:ujt,turbo:bjt,viridis:wjt,inferno:Sjt,magma:_jt,plasma:Njt,cividis:fjt,warm:pjt,cool:mjt,cubehelixDefault:hjt,blue_green:KNt,blue_purple:YNt,green_blue:XNt,orange_red:QNt,purple_blue_green:JNt,purple_blue:ZNt,purple_red:ejt,red_purple:tjt,yellow_green_blue:njt,yellow_green:rjt,yellow_orange_brown:ijt,yellow_orange_red:sjt},w3=WE({},vxe,bxe,wxe),LEt=function(t){return PEt.includes(t)},$Et=function(t){return OEt.includes(t)},FEt=function(t){return IEt.includes(t)},UEt={rainbow:gjt,sinebow:vjt};WE({},REt,DEt,UEt);var zEt=function(t){return t.theme!==void 0},BEt=function(t){return t.from!==void 0},VEt=function(t,e){if(typeof t=="function")return t;if(DM(t)){if(zEt(t)){if(e===void 0)throw new Error("Unable to use color from theme as no theme was provided");var n=vi(e,t.theme);if(n===void 0)throw new Error("Color from theme is undefined at path: '"+t.theme+"'");return function(){return n}}if(BEt(t)){var r=function(c){return vi(c,t.from)};if(Array.isArray(t.modifiers)){for(var i,s=[],a=function(){var c=i.value,u=c[0],d=c[1];if(u==="brighter")s.push(function(f){return f.brighter(d)});else if(u==="darker")s.push(function(f){return f.darker(d)});else{if(u!=="opacity")throw new Error("Invalid color modifier: '"+u+"', must be one of: 'brighter', 'darker', 'opacity'");s.push(function(f){return f.opacity=d,f})}},l=MEt(t.modifiers);!(i=l()).done;)a();return s.length===0?r:function(c){return s.reduce(function(u,d){return d(u)},bv(r(c))).toString()}}return r}throw new Error("Invalid color spec, you should either specify 'theme' or 'from' when using a config object")}return function(){return t}},W_=function(t,e){return b.useMemo(function(){return VEt(t,e)},[t,e])},HEt=function(t,e){if(typeof t=="function")return t;var n=function(f){return vi(f,e)};if(Array.isArray(t)){var r=qf(t),i=function(f){return r(n(f))};return i.scale=r,i}if(DM(t)){if(function(f){return f.datum!==void 0}(t))return function(f){return vi(f,t.datum)};if(function(f){return f.scheme!==void 0}
4949(t)){if(LEt(t.scheme)){var s=qf(w3[t.scheme]),a=function(f){return s(n(f))};return a.scale=s,a}if($Et(t.scheme)){if(t.size!==void 0&&(t.size<3||t.size>11))throw new Error("Invalid size '"+t.size+"' for diverging color scheme '"+t.scheme+"', must be between 3~11");var l=qf(w3[t.scheme][t.size||11]),c=function(f){return l(n(f))};return c.scale=l,c}if(FEt(t.scheme)){if(t.size!==void 0&&(t.size<3||t.size>9))throw new Error("Invalid size '"+t.size+"' for sequential color scheme '"+t.scheme+"', must be between 3~9");var u=qf(w3[t.scheme][t.size||9]),d=function(f){return u(n(f))};return d.scale=u,d}}throw new Error("Invalid colors, when using an object, you should either pass a 'datum' or a 'scheme' property")}return function(){return t}},_xe=function(t,e){return b.useMemo(function(){return HEt(t,e)},[t,e])},Sxe=/^--/;function WEt(t,e){return e==null||typeof e=="boolean"||e===""?"":typeof e=="number"&&e!==0&&!Sxe.test(t)&&!(i1.hasOwnProperty(t)&&i1[t])?e+"px":(""+e).trim()}var WJ={};function GEt(t,e){if(!t.nodeType||!t.setAttribute)return!1;const n=t.nodeName==="filter"||t.parentNode&&t.parentNode.nodeName==="filter",{className:r,style:i,children:s,scrollTop:a,scrollLeft:l,viewBox:c,...u}=e,d=Object.values(u),f=Object.keys(u).map(h=>n||t.hasAttribute(h)?h:WJ[h]||(WJ[h]=h.replace(/([A-Z])/g,p=>"-"+p.toLowerCase())));s!==void 0&&(t.textContent=s);for(const h in i)if(i.hasOwnProperty(h)){const p=WEt(h,i[h]);Sxe.test(h)?t.style.setProperty(h,p):t.style[h]=p}f.forEach((h,p)=>{t.setAttribute(h,d[p])}),r!==void 0&&(t.className=r),a!==void 0&&(t.scrollTop=a),l!==void 0&&(t.scrollLeft=l),c!==void 0&&t.setAttribute("viewBox",c)}var i1={animationIterationCount:!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,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},qEt=(t,e)=>t+e.charAt(0).toUpperCase()+e.substring(1),KEt=["Webkit","Ms","Moz","O"];i1=Object.keys(i1).reduce((t,e)=>(KEt.forEach(n=>t[qEt(n,e)]=t[e]),t),i1);var YEt=/^(matrix|translate|scale|rotate|skew)/,XEt=/^(translate)/,QEt=/^(rotate|skew)/,_3=(t,e)=>We.num(t)&&t!==0?t+e:t,ck=(t,e)=>We.arr(t)?t.every(n=>ck(n,e)):We.num(t)?t===e:parseFloat(t)===e,JEt=class extends ip{constructor({x:t,y:e,z:n,...r}){const i=[],s=[];(t||e||n)&&(i.push([t||0,e||0,n||0]),s.push(a=>[`translate3d(${a.map(l=>_3(l,"px")).join(",")})`,ck(a,0)])),Ka(r,(a,l)=>{if(l==="transform")i.push([a||""]),s.push(c=>[c,c===""]);else if(YEt.test(l)){if(delete r[l],We.und(a))return;const c=XEt.test(l)?"px":QEt.test(l)?"deg":"";i.push(Ji(a)),s.push(l==="rotate3d"?([u,d,f,h])=>[`rotate3d(${u},${d},${f},${_3(h,c)})`,ck(h,0)]:u=>[`${l}(${u.map(d=>_3(d,c)).join(",")})`,ck(u,l.startsWith("scale")?1:0)])}}),i.length&&(r.transform=new ZEt(i,s)),super(r)}},ZEt=class extends Y0{constructor(t,e){super(),this.inputs=t,this.transforms=e,this._value=null}get(){return this._value||(this._value=this._get())}_get(){let t="",e=!0;return yt(this.inputs,(n,r)=>{const i=fi(n[0]),[s,a]=this.transforms[r](We.arr(i)?i:n.map(fi));t+=" "+s,e=e&&a}),e?"none":t}observerAdded(t){t==1&&yt(this.inputs,e=>yt(e,n=>ki(n)&&wu(n,this)))}observerRemoved(t){t==0&&yt(this.inputs,e=>yt(e,n=>ki(n)&&Id(n,this)))}eventObserved(t){t.type=="change"&&(this._value=null),Rd(this,t)}},eAt=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"];ya.assign({batchedUpdates:wl.unstable_batchedUpdates,createStringInterpolator:X0,colors:cN});var tAt=uN(eAt,{applyAnimatedValues:GEt,createAnimatedStyle:t=>new JEt(t),getComponentProps:({scrollTop:t,scrollLeft:e,...n})=>n}),W8=tAt.animated;const hd=11102230246251565e-32,Vs=134217729,nAt=(3+8*hd)*hd;function S3(t,e,n,r,i){let s,a,l,c,u=e[0],d=r[0],f=0,h=0;d>u==d>-u?(s=u,u=e[++f]):(s=d,d=r[++h]);let p=0;if(f<t&&h<n)for(d>u==d>-u?(a=u+s,l=s-(a-u),u=e[++f]):(a=d+s,l=s-(a-d),d=r[++h]),s=a,l!==0&&(i[p++]=l);f<t&&h<n;)d>u==d>-u?(a=s+u,c=a-s,l=s-(a-c)+(u-c),u=e[++f]):(a=s+d,c=a-s,l=s-(a-c)+(d-c),d=r[++h]),s=a,l!==0&&(i[p++]=l);for(;f<t;)a=s+u,c=a-s,l=s-(a-c)+(u-c),u=e[++f],s=a,l!==0&&(i[p++]=l);for(;h<n;)a=s+d,c=a-s,l=s-(a-c)+(d-c),d=r[++h],s=a,l!==0&&(i[p++]=l);return(s!==0||p===0)&&(i[p++]=s),p}function rAt(t,e){let n=e[0];for(let r=1;r<t;r++)n+=e[r];return n}function dN(t){return new Float64Array(t)}const iAt=(3+16*hd)*hd,sAt=(2+12*hd)*hd,aAt=(9+64*hd)*hd*hd,Ex=dN(4),GJ=dN(8),qJ=dN(12),KJ=dN(16),na=dN(4);function oAt(t,e,n,r,i,s,a){let l,c,u,d,f,h,p,m,x,y,g,w,v,N,S,_,j,A;const C=t-i,k=n-i,M=e-s,I=r-s;N=C*I,h=Vs*C,p=h-(h-C),m=C-p,h=Vs*I,x=h-(h-I),y=I-x,S=m*y-(N-p*x-m*x-p*y),_=M*k,h=Vs*M,p=h-(h-M),m=M-p,h=Vs*k,x=h-(h-k),y=k-x,j=m*y-(_-p*x-m*x-p*y),g=S-j,f=S-g,Ex[0]=S-(g+f)+(f-j),w=N+g,f=w-N,v=N-(w-f)+(g-f),g=v-_,f=v-g,Ex[1]=v-(g+f)+(f-_),A=w+g,f=A-w,Ex[2]=w-(A-f)+(g-f),Ex[3]=A;let R=rAt(4,Ex),E=sAt*a;if(R>=E||-R>=E||(f=t-C,l=t-(C+f)+(f-i),f=n-k,u=n-(k+f)+(f-i),f=e-M,c=e-(M+f)+(f-s),f=r-I,d=r-(I+f)+(f-s),l===0&&c===0&&u===0&&d===0)||(E=aAt*a+nAt*Math.abs(R),R+=C*d+I*l-(M*u+k*c),R>=E||-R>=E))return R;N=l*I,h=Vs*l,p=h-(h-l),m=l-p,h=Vs*I,x=h-(h-I),y=I-x,S=m*y-(N-p*x-m*x-p*y),_=c*k,h=Vs*c,p=h-(h-c),m=c-p,h=Vs*k,x=h-(h-k),y=k-x,j=m*y-(_-p*x-m*x-p*y),g=S-j,f=S-g,na[0]=S-(g+f)+(f-j),w=N+g,f=w-N,v=N-(w-f)+(g-f),g=v-_,f=v-g,na[1]=v-(g+f)+(f-_),A=w+g,f=A-w,na[2]=w-(A-f)+(g-f),na[3]=A;const P=S3(4,Ex,4,na,GJ);N=C*d,h=Vs*C,p=h-(h-C),m=C-p,h=Vs*d,x=h-(h-d),y=d-x,S=m*y-(N-p*x-m*x-p*y),_=M*u,h=Vs*M,p=h-(h-M),m=M-p,h=Vs*u,x=h-(h-u),y=u-x,j=m*y-(_-p*x-m*x-p*y),g=S-j,f=S-g,na[0]=S-(g+f)+(f-j),w=N+g,f=w-N,v=N-(w-f)+(g-f),g=v-_,f=v-g,na[1]=v-(g+f)+(f-_),A=w+g,f=A-w,na[2]=w-(A-f)+(g-f),na[3]=A;const O=S3(P,GJ,4,na,qJ);N=l*d,h=Vs*l,p=h-(h-l),m=l-p,h=Vs*d,x=h-(h-d),y=d-x,S=m*y-(N-p*x-m*x-p*y),_=c*u,h=Vs*c,p=h-(h-c),m=c-p,h=Vs*u,x=h-(h-u),y=u-x,j=m*y-(_-p*x-m*x-p*y),g=S-j,f=S-g,na[0]=S-(g+f)+(f-j),w=N+g,f=w-N,v=N-(w-f)+(g-f),g=v-_,f=v-g,na[1]=v-(g+f)+(f-_),A=w+g,f=A-w,na[2]=w-(A-f)+(g-f),na[3]=A;const L=S3(O,qJ,4,na,KJ);return KJ[L-1]}function Zj(t,e,n,r,i,s){const a=(e-s)*(n-i),l=(t-i)*(r-s),c=a-l,u=Math.abs(a+l);return Math.abs(c)>=iAt*u?c:-oAt(t,e,n,r,i,s,u)}const YJ=Math.pow(2,-52),eC=new Uint32Array(512);class GE{static from(e,n=fAt,r=hAt){const i=e.length,s=new Float64Array(i*2);for(let a=0;a<i;a++){const l=e[a];s[2*a]=n(l),s[2*a+1]=r(l)}return new GE(s)}constructor(e){const n=e.length>>1;if(n>0&&typeof e[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=e;const r=Math.max(2*n-5,0);this._triangles=new Uint32Array(r*3),this._halfedges=new Int32Array(r*3),this._hashSize=Math.ceil(Math.sqrt(n)),this._hullPrev=new Uint32Array(n),this._hullNext=new Uint32Array(n),this._hullTri=new Uint32Array(n),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(n),this._dists=new Float64Array(n),this.update()}update(){const{coords:e,_hullPrev:n,_hullNext:r,_hullTri:i,_hullHash:s}=this,a=e.length>>1;let l=1/0,c=1/0,u=-1/0,d=-1/0;for(let C=0;C<a;C++){const k=e[2*C],M=e[2*C+1];k<l&&(l=k),M<c&&(c=M),k>u&&(u=k),M>d&&(d=M),this._ids[C]=C}const f=(l+u)/2,h=(c+d)/2;let p,m,x;for(let C=0,k=1/0;C<a;C++){const M=N3(f,h,e[2*C],e[2*C+1]);M<k&&(p=C,k=M)}const y=e[2*p],g=e[2*p+1];for(let C=0,k=1/0;C<a;
vendor: 15,023 bytes, line 4949
4949C++){if(C===p)continue;const M=N3(y,g,e[2*C],e[2*C+1]);M<k&&M>0&&(m=C,k=M)}let w=e[2*m],v=e[2*m+1],N=1/0;for(let C=0;C<a;C++){if(C===p||C===m)continue;const k=uAt(y,g,w,v,e[2*C],e[2*C+1]);k<N&&(x=C,N=k)}let S=e[2*x],_=e[2*x+1];if(N===1/0){for(let M=0;M<a;M++)this._dists[M]=e[2*M]-e[0]||e[2*M+1]-e[1];fy(this._ids,this._dists,0,a-1);const C=new Uint32Array(a);let k=0;for(let M=0,I=-1/0;M<a;M++){const R=this._ids[M],E=this._dists[R];E>I&&(C[k++]=R,I=E)}this.hull=C.subarray(0,k),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(Zj(y,g,w,v,S,_)<0){const C=m,k=w,M=v;m=x,w=S,v=_,x=C,S=k,_=M}const j=dAt(y,g,w,v,S,_);this._cx=j.x,this._cy=j.y;for(let C=0;C<a;C++)this._dists[C]=N3(e[2*C],e[2*C+1],j.x,j.y);fy(this._ids,this._dists,0,a-1),this._hullStart=p;let A=3;r[p]=n[x]=m,r[m]=n[p]=x,r[x]=n[m]=p,i[p]=0,i[m]=1,i[x]=2,s.fill(-1),s[this._hashKey(y,g)]=p,s[this._hashKey(w,v)]=m,s[this._hashKey(S,_)]=x,this.trianglesLen=0,this._addTriangle(p,m,x,-1,-1,-1);for(let C=0,k,M;C<this._ids.length;C++){const I=this._ids[C],R=e[2*I],E=e[2*I+1];if(C>0&&Math.abs(R-k)<=YJ&&Math.abs(E-M)<=YJ||(k=R,M=E,I===p||I===m||I===x))continue;let P=0;for(let F=0,q=this._hashKey(R,E);F<this._hashSize&&(P=s[(q+F)%this._hashSize],!(P!==-1&&P!==r[P]));F++);P=n[P];let O=P,L;for(;L=r[O],Zj(R,E,e[2*O],e[2*O+1],e[2*L],e[2*L+1])>=0;)if(O=L,O===P){O=-1;break}if(O===-1)continue;let T=this._addTriangle(O,I,r[O],-1,-1,i[O]);i[I]=this._legalize(T+2),i[O]=T,A++;let D=r[O];for(;L=r[D],Zj(R,E,e[2*D],e[2*D+1],e[2*L],e[2*L+1])<0;)T=this._addTriangle(D,I,L,i[I],-1,i[D]),i[I]=this._legalize(T+2),r[D]=D,A--,D=L;if(O===P)for(;L=n[O],Zj(R,E,e[2*L],e[2*L+1],e[2*O],e[2*O+1])<0;)T=this._addTriangle(L,I,O,-1,i[O],i[L]),this._legalize(T+2),i[L]=T,r[O]=O,A--,O=L;this._hullStart=n[I]=O,r[O]=n[D]=I,r[I]=D,s[this._hashKey(R,E)]=I,s[this._hashKey(e[2*O],e[2*O+1])]=O}this.hull=new Uint32Array(A);for(let C=0,k=this._hullStart;C<A;C++)this.hull[C]=k,k=r[k];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(e,n){return Math.floor(lAt(e-this._cx,n-this._cy)*this._hashSize)%this._hashSize}_legalize(e){const{_triangles:n,_halfedges:r,coords:i}=this;let s=0,a=0;for(;;){const l=r[e],c=e-e%3;if(a=c+(e+2)%3,l===-1){if(s===0)break;e=eC[--s];continue}const u=l-l%3,d=c+(e+1)%3,f=u+(l+2)%3,h=n[a],p=n[e],m=n[d],x=n[f];if(cAt(i[2*h],i[2*h+1],i[2*p],i[2*p+1],i[2*m],i[2*m+1],i[2*x],i[2*x+1])){n[e]=x,n[l]=h;const g=r[f];if(g===-1){let v=this._hullStart;do{if(this._hullTri[v]===f){this._hullTri[v]=e;break}v=this._hullPrev[v]}while(v!==this._hullStart)}this._link(e,g),this._link(l,r[a]),this._link(a,f);const w=u+(l+1)%3;s<eC.length&&(eC[s++]=w)}else{if(s===0)break;e=eC[--s]}}return a}_link(e,n){this._halfedges[e]=n,n!==-1&&(this._halfedges[n]=e)}_addTriangle(e,n,r,i,s,a){const l=this.trianglesLen;return this._triangles[l]=e,this._triangles[l+1]=n,this._triangles[l+2]=r,this._link(l,i),this._link(l+1,s),this._link(l+2,a),this.trianglesLen+=3,l}}function lAt(t,e){const n=t/(Math.abs(t)+Math.abs(e));return(e>0?3-n:1+n)/4}function N3(t,e,n,r){const i=t-n,s=e-r;return i*i+s*s}function cAt(t,e,n,r,i,s,a,l){const c=t-a,u=e-l,d=n-a,f=r-l,h=i-a,p=s-l,m=c*c+u*u,x=d*d+f*f,y=h*h+p*p;return c*(f*y-x*p)-u*(d*y-x*h)+m*(d*p-f*h)<0}function uAt(t,e,n,r,i,s){const a=n-t,l=r-e,c=i-t,u=s-e,d=a*a+l*l,f=c*c+u*u,h=.5/(a*u-l*c),p=(u*d-l*f)*h,m=(a*f-c*d)*h;return p*p+m*m}function dAt(t,e,n,r,i,s){const a=n-t,l=r-e,c=i-t,u=s-e,d=a*a+l*l,f=c*c+u*u,h=.5/(a*u-l*c),p=t+(u*d-l*f)*h,m=e+(a*f-c*d)*h;return{x:p,y:m}}function fy(t,e,n,r){if(r-n<=20)for(let i=n+1;i<=r;i++){const s=t[i],a=e[s];let l=i-1;for(;l>=n&&e[t[l]]>a;)t[l+1]=t[l--];t[l+1]=s}else{const i=n+r>>1;let s=n+1,a=r;Yb(t,i,s),e[t[n]]>e[t[r]]&&Yb(t,n,r),e[t[s]]>e[t[r]]&&Yb(t,s,r),e[t[n]]>e[t[s]]&&Yb(t,n,s);const l=t[s],c=e[l];for(;;){do s++;while(e[t[s]]<c);do a--;while(e[t[a]]>c);if(a<s)break;Yb(t,s,a)}t[n+1]=t[a],t[a]=l,r-s+1>=a-n?(fy(t,e,s,r),fy(t,e,n,a-1)):(fy(t,e,n,a-1),fy(t,e,s,r))}}function Yb(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function fAt(t){return t[0]}function hAt(t){return t[1]}const XJ=1e-6;class sm{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(e,n){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(e,n){this._+=`L${this._x1=+e},${this._y1=+n}`}arc(e,n,r){e=+e,n=+n,r=+r;const i=e+r,s=n;if(r<0)throw new Error("negative radius");this._x1===null?this._+=`M${i},${s}`:(Math.abs(this._x1-i)>XJ||Math.abs(this._y1-s)>XJ)&&(this._+="L"+i+","+s),r&&(this._+=`A${r},${r},0,1,1,${e-r},${n}A${r},${r},0,1,1,${this._x1=i},${this._y1=s}`)}rect(e,n,r,i){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}h${+r}v${+i}h${-r}Z`}value(){return this._||null}}class oF{constructor(){this._=[]}moveTo(e,n){this._.push([e,n])}closePath(){this._.push(this._[0].slice())}lineTo(e,n){this._.push([e,n])}value(){return this._.length?this._:null}}class pAt{constructor(e,[n,r,i,s]=[0,0,960,500]){if(!((i=+i)>=(n=+n))||!((s=+s)>=(r=+r)))throw new Error("invalid bounds");this.delaunay=e,this._circumcenters=new Float64Array(e.points.length*2),this.vectors=new Float64Array(e.points.length*2),this.xmax=i,this.xmin=n,this.ymax=s,this.ymin=r,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:e,hull:n,triangles:r},vectors:i}=this;let s,a;const l=this.circumcenters=this._circumcenters.subarray(0,r.length/3*2);for(let x=0,y=0,g=r.length,w,v;x<g;x+=3,y+=2){const N=r[x]*2,S=r[x+1]*2,_=r[x+2]*2,j=e[N],A=e[N+1],C=e[S],k=e[S+1],M=e[_],I=e[_+1],R=C-j,E=k-A,P=M-j,O=I-A,L=(R*O-E*P)*2;if(Math.abs(L)<1e-9){if(s===void 0){s=a=0;for(const D of n)s+=e[D*2],a+=e[D*2+1];s/=n.length,a/=n.length}const T=1e9*Math.sign((s-j)*O-(a-A)*P);w=(j+M)/2-T*O,v=(A+I)/2+T*P}else{const T=1/L,D=R*R+E*E,F=P*P+O*O;w=j+(O*D-E*F)*T,v=A+(R*F-P*D)*T}l[y]=w,l[y+1]=v}let c=n[n.length-1],u,d=c*4,f,h=e[2*c],p,m=e[2*c+1];i.fill(0);for(let x=0;x<n.length;++x)c=n[x],u=d,f=h,p=m,d=c*4,h=e[2*c],m=e[2*c+1],i[u+2]=i[d]=p-m,i[u+3]=i[d+1]=h-f}render(e){const n=e==null?e=new sm:void 0,{delaunay:{halfedges:r,inedges:i,hull:s},circumcenters:a,vectors:l}=this;if(s.length<=1)return null;for(let d=0,f=r.length;d<f;++d){const h=r[d];if(h<d)continue;const p=Math.floor(d/3)*2,m=Math.floor(h/3)*2,x=a[p],y=a[p+1],g=a[m],w=a[m+1];this._renderSegment(x,y,g,w,e)}let c,u=s[s.length-1];for(let d=0;d<s.length;++d){c=u,u=s[d];const f=Math.floor(i[u]/3)*2,h=a[f],p=a[f+1],m=c*4,x=this._project(h,p,l[m+2],l[m+3]);x&&this._renderSegment(h,p,x[0],x[1],e)}return n&&n.value()}renderBounds(e){const n=e==null?e=new sm:void 0;return e.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),n&&n.value()}renderCell(e,n){const r=n==null?n=new sm:void 0,i=this._clip(e);if(i===null||!i.length)return;n.moveTo(i[0],i[1]);let s=i.length;for(;i[0]===i[s-2]&&i[1]===i[s-1]&&s>1;)s-=2;for(let a=2;a<s;a+=2)(i[a]!==i[a-2]||i[a+1]!==i[a-1])&&n.lineTo(i[a],i[a+1]);return n.closePath(),r&&r.value()}*cellPolygons(){const{delaunay:{points:e}}=this;for(let n=0,r=e.length/2;n<r;++n){const i=this.cellPolygon(n);i&&(i.index=n,yield i)}}cellPolygon(e){const n=new oF;return this.renderCell(e,n),n.value()}_renderSegment(e,n,r,i,s){let a;const l=this._regioncode(e,n),c=this._regioncode(r,i);l===0&&c===0?(s.moveTo(e,n),s.lineTo(r,i)):(a=this._clipSegment(e,n,r,i,l,c))&&(s.moveTo(a[0],a[1]),s.lineTo(a[2],a[3]))}contains(e,n,r){return n=+n,n!==n||(r=+r,r!==r)?!1:this.delaunay._step(e,n,r)===e}*neighbors(e){const n=this._clip(e);if(n)for(const r of this.delaunay.neighbors(e)){const i=this._clip(r);if(i){e:for(let s=0,a=n.length;s<a;s+=2)for(let l=0,c=i.length;l<c;l+=2)if(n[s]===i[l]&&n[s+1]===i[l+1]&&n[(s+2)%a]===i[(l+c-2)%c]&&n[(s+3)%a]===i[(l+c-1)%c]){yield r;break e}}}}_cell(e){const{circumcenters:n,delaunay:{inedges:r,halfedges:i,triangles:s}}=this,a=r[e];if(a===-1)return null;const l=[];let c=a;do{const u=Math.floor(c/3);if(l.push(n[u*2],n[u*2+1]),c=c%3===2?c-2:c+1,s[c]!==e)break;c=i[c]}while(c!==a&&c!==-1);return l}_clip(e){if(e===0&&this.delaunay.hull.length===1)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];const n=this._cell(e);if(n===null)return null;const{vectors:r}=this,i=e*4;return this._simplify(r[i]||r[i+1]?this._clipInfinite(e,n,r[i],r[i+1],r[i+2],r[i+3]):this._clipFinite(e,n))}_clipFinite(e,n){const r=n.length;let i=null,s,a,l=n[r-2],c=n[r-1],u,d=this._regioncode(l,c),f,h=0;for(let p=0;p<r;p+=2)if(s=l,a=c,l=n[p],c=n[p+1],u=d,d=this._regioncode(l,c),u===0&&d===0)f=h,h=0,i?i.push(l,c):i=[l,c];else{let m,x,y,g,w;if(u===0){if((m=this._clipSegment(s,a,l,c,u,d))===null)continue;[x,y,g,w]=m}else{if((m=this._clipSegment(l,c,s,a,d,u))===null)continue;[g,w,x,y]=m,f=h,h=this._edgecode(x,y),f&&h&&this._edge(e,f,h,i,i.length),i?i.push(x,y):i=[x,y]}f=h,h=this._edgecode(g,w),f&&h&&this._edge(e,f,h,i,i.length),i?i.push(g,w):i=[g,w]}if(i)f=h,h=this._edgecode(i[0],i[1]),f&&h&&this._edge(e,f,h,i,i.length);else if(this.contains(e,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return i}_clipSegment(e,n,r,i,s,a){const l=s<a;for(l&&([e,n,r,i,s,a]=[r,i,e,n,a,s]);;){if(s===0&&a===0)return l?[r,i,e,n]:[e,n,r,i];if(s&a)return null;let c,u,d=s||a;d&8?(c=e+(r-e)*(this.ymax-n)/(i-n),u=this.ymax):d&4?(c=e+(r-e)*(this.ymin-n)/(i-n),u=this.ymin):d&2?(u=n+(i-n)*(this.xmax-e)/(r-e),c=this.xmax):(u=n+(i-n)*(this.xmin-e)/(r-e),c=this.xmin),s?(e=c,n=u,s=this._regioncode(e,n)):(r=c,i=u,a=this._regioncode(r,i))}}_clipInfinite(e,n,r,i,s,a){let l=Array.from(n),c;if((c=this._project(l[0],l[1],r,i))&&l.unshift(c[0],c[1]),(c=this._project(l[l.length-2],l[l.length-1],s,a))&&l.push(c[0],c[1]),l=this._clipFinite(e,l))for(let u=0,d=l.length,f,h=this._edgecode(l[d-2],l[d-1]);u<d;u+=2)f=h,h=this._edgecode(l[u],l[u+1]),f&&h&&(u=this._edge(e,f,h,l,u),d=l.length);else this.contains(e,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(l=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return l}_edge(e,n,r,i,s){for(;n!==r;){let a,l;switch(n){case 5:n=4;continue;case 4:n=6,a=this.xmax,l=this.ymin;break;case 6:n=2;continue;case 2:n=10,a=this.xmax,l=this.ymax;break;case 10:n=8;continue;case 8:n=9,a=this.xmin,l=this.ymax;break;case 9:n=1;continue;case 1:n=5,a=this.xmin,l=this.ymin;break}(i[s]!==a||i[s+1]!==l)&&this.contains(e,a,l)&&(i.splice(s,0,a,l),s+=2)}return s}_project(e,n,r,i){let s=1/0,a,l,c;if(i<0){if(n<=this.ymin)return null;(a=(this.ymin-n)/i)<s&&(c=this.ymin,l=e+(s=a)*r)}else if(i>0){if(n>=this.ymax)return null;(a=(this.ymax-n)/i)<s&&(c=this.ymax,l=e+(s=a)*r)}if(r>0){if(e>=this.xmax)return null;(a=(this.xmax-e)/r)<s&&(l=this.xmax,c=n+(s=a)*i)}else if(r<0){if(e<=this.xmin)return null;(a=(this.xmin-e)/r)<s&&(l=this.xmin,c=n+(s=a)*i)}return[l,c]}_edgecode(e,n){return(e===this.xmin?1:e===this.xmax?2:0)|(n===this.ymin?4:n===this.ymax?8:0)}_regioncode(e,n){return(e<this.xmin?1:e>this.xmax?2:0)|(n<this.ymin?4:n>this.ymax?8:0)}_simplify(e){if(e&&e.length>4){for(let n=0;n<e.length;n+=2){const r=(n+2)%e.length,i=(n+4)%e.length;(e[n]===e[r]&&e[r]===e[i]||e[n+1]===e[r+1]&&e[r+1]===e[i+1])&&(e.splice(r,2),n-=2)}e.length||(e=null)}return e}}const mAt=2*Math.PI,Ax=Math.pow;function gAt(t){return t[0]}function xAt(t){return t[1]}function yAt(t){const{triangles:e,coords:n}=t;for(let r=0;r<e.length;r+=3){const i=2*e[r],s=2*e[r+1],a=2*e[r+2];if((n[a]-n[i])*(n[s+1]-n[i+1])-(n[s]-n[i])*(n[a+1]-n[i+1])>1e-10)return!1}return!0}function vAt(t,e,n){return[t+Math.sin(t+e)*n,e+Math.cos(t-e)*n]}class VP{static from(e,n=gAt,r=xAt,i){return new VP("length"in e?bAt(e,n,r,i):Float64Array.from(wAt(e,n,r,i)))}constructor(e){this._delaunator=new GE(e),this.inedges=new Int32Array(e.length/2),this._hullIndex=new Int32Array(e.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){const e=this._delaunator,n=this.points;if(e.hull&&e.hull.length>2&&yAt(e)){this.collinear=Int32Array.from({length:n.length/2},(h,p)=>p).sort((h,p)=>n[2*h]-n[2*p]||n[2*h+1]-n[2*p+1]);const c=this.collinear[0],u=this.collinear[this.collinear.length-1],d=[n[2*c],n[2*c+1],n[2*u],n[2*u+1]],f=1e-8*Math.hypot(d[3]-d[1],d[2]-d[0]);for(let h=0,p=n.length/2;h<p;++h){const m=vAt(n[2*h],n[2*h+1],f);n[2*h]=m[0],n[2*h+1]=m[1]}this._delaunator=new GE(n)}else delete this.collinear;const r=this.halfedges=this._delaunator.halfedges,i=this.hull=this._delaunator.hull,s=this.triangles=this._delaunator.triangles,a=this.inedges.fill(-1),l=this._hullIndex.fill(-1);for(let c=0,u=r.length;c<u;++c){const d=s[c%3===2?c-2:c+1];(r[c]===-1||a[d]===-1)&&(a[d]=c)}for(let c=0,u=i.length;c<u;++c)l[i[c]]=c;i.length<=2&&i.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=i[0],a[i[0]]=1,i.length===2&&(a[i[1]]=0,this.triangles[1]=i[1],this.triangles[2]=i[1]))}voronoi(e){return new pAt(this,e)}*neighbors(e){const{inedges:n,hull:r,_hullIndex:i,halfedges:s,triangles:a,collinear:l}=this;if(l){const f=l.indexOf(e);f>0&&(yield l[f-1]),f<l.length-1&&(yield l[f+1]);return}const c=n[e];if(c===-1)return;let u=c,d=-1;do{if(yield d=a[u],u=u%3===2?u-2:u+1,a[u]!==e)return;if(u=s[u],u===-1){const f=r[(i[e]+1)%r.length];f!==d&&(yield f);return}}while(u!==c)}find(e,n,r=0){if(e=+e,e!==e||(n=+n,n!==n))return-1;const i=r;let s;for(;(s=this._step(r,e,n))>=0&&s!==r&&s!==i;)r=s;return s}_step(e,n,r){const{inedges:i,hull:s,_hullIndex:a,halfedges:l,triangles:c,points:u}=this;if(i[e]===-1||!u.length)return(e+1)%(u.length>>1);let d=e,f=Ax(n-u[e*2],2)+Ax(r-u[e*2+1],2);const h=i[e];let p=h;do{let m=c[p];const x=Ax(n-u[m*2],2)+Ax(r-u[m*2+1],2);if(x<f&&(f=x,d=m),p=p%3===2?p-2:p+1,c[p]!==e)break;if(p=l[p],p===-1){if(p=s[(a[e]+1)%s.length],p!==m&&Ax(n-u[p*2],2)+Ax(r-u[p*2+1],2)<f)return p;break}}while(p!==h);return d}render(e){const n=e==null?e=new sm:void 0,{points:r,halfedges:i,triangles:s}=this;for(let a=0,l=i.length;a<l;++a){const c=i[a];if(c<a)continue;const u=s[a]*2,d=s[c]*2;e.moveTo(r[u],r[u+1]),e.lineTo(r[d],r[d+1])}return this.renderHull(e),n&&n.value()}renderPoints(e,n){n===void 0&&(!e||typeof e.moveTo!="function")&&(n=e,e=null),n=n==null?2:+n;const r=e==null?e=new sm:void 0,{points:i}=this;for(let s=0,a=i.length;s<a;s+=2){const l=i[s],c=i[s+1];e.moveTo(l+n,c),e.arc(l,c,n,0,mAt)}return r&&r.value()}renderHull(e){const n=e==null?e=new sm:void 0,{hull:r,points:i}=this,s=r[0]*2,a=r.length;e.moveTo(i[s],i[s+1]);for(let l=1;l<a;++l){const c=2*r[l];e.lineTo(i[c],i[c+1])}return e.closePath(),n&&n.value()}hullPolygon(){const e=new oF;return this.renderHull(e),e.value()}renderTriangle(e,n){const r=n==null?n=new sm:void 0,{points:i,triangles:s}=this,a=s[e*=3]*2,l=s[e+1]*2,c=s[e+2]*2;return n.moveTo(i[a],i[a+1]),n.lineTo(i[l],i[l+1]),n.lineTo(i[c],i[c+1]),n.closePath(),r&&r.value()}*trianglePolygons(){const{triangles:e}=this;for(let n=0,r=e.length/3;n<r;++n)yield this.trianglePolygon(n)}trianglePolygon(e){const n=new oF;
4949return this.renderTriangle(e,n),n.value()}}function bAt(t,e,n,r){const i=t.length,s=new Float64Array(i*2);for(let a=0;a<i;++a){const l=t[a];s[a*2]=e.call(r,l,a,t),s[a*2+1]=n.call(r,l,a,t)}return s}function*wAt(t,e,n,r){let i=0;for(const s of t)yield e.call(r,s,i,t),yield n.call(r,s,i,t),++i}function qE(){return qE=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},qE.apply(null,arguments)}function Nxe(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var no={xDomain:[0,1],yDomain:[0,1],layers:["links","cells","points","bounds"],enableLinks:!1,linkLineWidth:1,linkLineColor:"#bbbbbb",enableCells:!0,cellLineWidth:2,cellLineColor:"#000000",pointSize:4,pointColor:"#666666",role:"img"},G8=function(t){return[t.x,t.y]},fN=Dge,jxe="cursor",Cxe="top",_At=function(t){var e=t.points,n=t.getNodePosition,r=n===void 0?G8:n,i=t.margin,s=i===void 0?fN:i;return e.map(function(a){var l=r(a),c=l[0],u=l[1];return[c+s.left,u+s.top]})},SAt=function(t){var e=t.points,n=t.width,r=t.height,i=t.margin,s=i===void 0?fN:i,a=t.debug,l=VP.from(e),c=a?l.voronoi([0,0,s.left+n+s.right,s.top+r+s.bottom]):void 0;return{points:e,delaunay:l,voronoi:c}},NAt=function(t){var e=t.points,n=t.getNodePosition,r=n===void 0?G8:n,i=t.width,s=t.height,a=t.margin,l=a===void 0?fN:a,c=t.debug;return b.useMemo(function(){return SAt({points:_At({points:e,margin:l,getNodePosition:r}),width:i,height:s,margin:l,debug:c})},[r,e,i,s,l,c])},jAt=function(t){var e=t.data,n=t.width,r=t.height,i=t.xDomain,s=t.yDomain,a=b.useMemo(function(){return Ym().domain(i).range([0,n])},[i,n]),l=b.useMemo(function(){return Ym().domain(s).range([0,r])},[s,r]),c=b.useMemo(function(){return e.map(function(u){return{x:a(u.x),y:l(u.y),data:u}})},[e,a,l]);return b.useMemo(function(){var u=VP.from(c.map(function(f){return[f.x,f.y]})),d=u.voronoi([0,0,n,r]);return{points:c,delaunay:u,voronoi:d}},[c,n,r])},CAt=function(t){var e=t.points,n=t.delaunay,r=t.voronoi;return b.useMemo(function(){return{points:e,delaunay:n,voronoi:r}},[e,n,r])},kAt=function(t){var e=t.elementRef,n=t.nodes,r=t.getNodePosition,i=r===void 0?G8:r,s=t.delaunay,a=t.setCurrent,l=t.margin,c=l===void 0?fN:l,u=t.detectionRadius,d=u===void 0?1/0:u,f=t.isInteractive,h=f===void 0||f,p=t.onMouseEnter,m=t.onMouseMove,x=t.onMouseLeave,y=t.onMouseDown,g=t.onMouseUp,w=t.onClick,v=t.onDoubleClick,N=t.onTouchStart,S=t.onTouchMove,_=t.onTouchEnd,j=t.enableTouchCrosshair,A=j!==void 0&&j,C=t.tooltip,k=t.tooltipPosition,M=k===void 0?jxe:k,I=t.tooltipAnchor,R=I===void 0?Cxe:I,E=b.useState(null),P=E[0],O=E[1],L=b.useRef(null);b.useEffect(function(){L.current=P},[L,P]);var T=b.useCallback(function(ce){if(!e.current||n.length===0)return null;var ve=Ckt(e.current,ce),X=ve[0],de=ve[1],Te=s.find(X,de),Pe=Te!==void 0?n[Te]:null;if(Pe&&d!==1/0){var se=i(Pe),U=se[0],Q=se[1];jkt(X,de,U+c.left,Q+c.top)>d&&(Te=null,Pe=null)}return Te===null||Pe===null?null:[Te,Pe]},[e,s,n,i,c,d]),D=hP(),F=D.showTooltipAt,q=D.showTooltipFromEvent,B=D.hideTooltip,z=b.useMemo(function(){if(C)return M==="cursor"?function(ce,ve){q(C(ce),ve,R)}:function(ce){var ve=i(ce),X=ve[0],de=ve[1];F(C(ce),[X+c.left,de+c.top],R)}},[F,q,C,M,R,i,c]),H=b.useCallback(function(ce){var ve=T(ce);if(O(ve),a==null||a(ve?ve[1]:null),ve){var X=ve[1];z==null||z(X,ce),p==null||p(ve[1],ce)}},[T,O,a,z,p]),W=b.useCallback(function(ce){var ve=T(ce);if(O(ve),ve){var X=ve[0],de=ve[1];if(a==null||a(de),z==null||z(de,ce),L.current){var Te=L.current,Pe=Te[0],se=Te[1];X!==Pe?x==null||x(se,ce):m==null||m(de,ce)}else p==null||p(de,ce)}else a==null||a(null),B==null||B(),L.current&&(x==null||x(L.current[1],ce))},[T,O,a,L,p,m,x,z,B]),G=b.useCallback(function(ce){O(null),a==null||a(null),B(),x&&L.current&&x(L.current[1],ce)},[O,a,L,B,x]),K=b.useCallback(function(ce){var ve=T(ce);O(ve),ve&&(y==null||y(ve[1],ce))},[T,O,y]),ee=b.useCallback(function(ce){var ve=T(ce);O(ve),ve&&(g==null||g(ve[1],ce))},[T,O,g]),V=b.useCallback(function(ce){var ve=T(ce);O(ve),ve&&(w==null||w(ve[1],ce))},[T,O,w]),J=b.useCallback(function(ce){var ve=T(ce);O(ve),ve&&(v==null||v(ve[1],ce))},[T,O,v]),Y=b.useCallback(function(ce){var ve=T(ce);A&&(O(ve),a==null||a(ve?ve[1]:null)),ve&&(N==null||N(ve[1],ce))},[T,O,a,A,N]),$=b.useCallback(function(ce){var ve=T(ce);A&&(O(ve),a==null||a(ve?ve[1]:null)),ve&&(S==null||S(ve[1],ce))},[T,O,a,A,S]),fe=b.useCallback(function(ce){A&&(O(null),a==null||a(null)),_&&L.current&&_(L.current[1],ce)},[A,O,a,_,L]);return{current:P,handleMouseEnter:h?H:void 0,handleMouseMove:h?W:void 0,handleMouseLeave:h?G
4949:void 0,handleMouseDown:h?K:void 0,handleMouseUp:h?ee:void 0,handleClick:h?V:void 0,handleDoubleClick:h?J:void 0,handleTouchStart:h?Y:void 0,handleTouchMove:h?$:void 0,handleTouchEnd:h?fe:void 0}},EAt=["theme"],AAt=function(t){var e=t.data,n=t.width,r=t.height,i=t.margin,s=t.layers,a=s===void 0?no.layers:s,l=t.xDomain,c=l===void 0?no.xDomain:l,u=t.yDomain,d=u===void 0?no.yDomain:u,f=t.enableLinks,h=f===void 0?no.enableLinks:f,p=t.linkLineWidth,m=p===void 0?no.linkLineWidth:p,x=t.linkLineColor,y=x===void 0?no.linkLineColor:x,g=t.enableCells,w=g===void 0?no.enableCells:g,v=t.cellLineWidth,N=v===void 0?no.cellLineWidth:v,S=t.cellLineColor,_=S===void 0?no.cellLineColor:S,j=t.enablePoints,A=j===void 0?no.enableCells:j,C=t.pointSize,k=C===void 0?no.pointSize:C,M=t.pointColor,I=M===void 0?no.pointColor:M,R=t.role,E=R===void 0?no.role:R,P=t.forwardedRef,O=L8(n,r,i),L=O.outerWidth,T=O.outerHeight,D=O.margin,F=O.innerWidth,q=O.innerHeight,B=jAt({data:e,width:F,height:q,xDomain:c,yDomain:d}),z=B.points,H=B.delaunay,W=B.voronoi,G={links:null,cells:null,points:null,bounds:null};h&&a.includes("links")&&(G.links=o.jsx("path",{stroke:y,strokeWidth:m,fill:"none",d:H.render()},"links")),w&&a.includes("cells")&&(G.cells=o.jsx("path",{d:W.render(),fill:"none",stroke:_,strokeWidth:N},"cells")),A&&a.includes("points")&&(G.points=o.jsx("path",{stroke:"none",fill:I,d:H.renderPoints(void 0,k/2)},"points")),a.includes("bounds")&&(G.bounds=o.jsx("path",{fill:"none",stroke:_,strokeWidth:N,d:W.renderBounds()},"bounds"));var K=CAt({points:z,delaunay:H,voronoi:W});return o.jsx(I8,{width:L,height:T,margin:D,role:E,ref:P,children:a.map(function(ee,V){return G[ee]!==void 0?G[ee]:typeof ee=="function"?o.jsx(b.Fragment,{children:b.createElement(ee,K)},V):null})})},TAt=b.forwardRef(function(t,e){var n=t.theme,r=Nxe(t,EAt);return o.jsx(O8,{isInteractive:!1,animate:!1,theme:n,children:o.jsx(AAt,qE({},r,{forwardedRef:e}))})}),MAt=["defaultWidth","defaultHeight","onResize","debounceResize"];b.forwardRef(function(t,e){var n=t.defaultWidth,r=t.defaultHeight,i=t.onResize,s=t.debounceResize,a=Nxe(t,MAt);return o.jsx(R8,{defaultWidth:n,defaultHeight:r,onResize:i,debounceResize:s,children:function(l){var c=l.width,u=l.height;return o.jsx(TAt,qE({},a,{width:c,height:u,ref:e}))}})});var PAt=function(t){var e=t.nodes,n=t.width,r=t.height,i=t.margin,s=i===void 0?fN:i,a=t.getNodePosition,l=t.setCurrent,c=t.onMouseEnter,u=t.onMouseMove,d=t.onMouseLeave,f=t.onMouseDown,h=t.onMouseUp,p=t.onClick,m=t.onDoubleClick,x=t.onTouchStart,y=t.onTouchMove,g=t.onTouchEnd,w=t.enableTouchCrosshair,v=w!==void 0&&w,N=t.detectionRadius,S=N===void 0?1/0:N,_=t.tooltip,j=t.tooltipPosition,A=j===void 0?jxe:j,C=t.tooltipAnchor,k=C===void 0?Cxe:C,M=t.debug,I=b.useRef(null),R=NAt({points:e,getNodePosition:a,width:n,height:r,margin:s,debug:M}),E=R.delaunay,P=R.voronoi,O=kAt({elementRef:I,nodes:e,delaunay:E,margin:s,detectionRadius:S,setCurrent:l,onMouseEnter:c,onMouseMove:u,onMouseLeave:d,onMouseDown:f,onMouseUp:h,onClick:p,onDoubleClick:m,onTouchStart:x,onTouchMove:y,onTouchEnd:g,enableTouchCrosshair:v,tooltip:_,tooltipPosition:A,tooltipAnchor:k}),L=O.current,T=O.handleMouseEnter,D=O.handleMouseMove,F=O.handleMouseLeave,q=O.handleMouseDown,B=O.handleMouseUp,z=O.handleClick,H=O.handleDoubleClick,W=O.handleTouchStart,G=O.handleTouchMove,K=O.handleTouchEnd,ee=b.useMemo(function(){if(M&&P)return P.render()},[M,P]);return o.jsxs("g",{ref:I,transform:"translate("+-s.left+","+-s.top+")",children:[M&&P&&o.jsxs(o.Fragment,{children:[o.jsx("path",{d:ee,stroke:"red",strokeWidth:1,opacity:.75}),S<1/0&&o.jsx("path",{stroke:"red",strokeWidth:.35,fill:"none",d:E.renderPoints(void 0,S)}),L&&o.jsx("path",{fill:"pink",opacity:.35,d:P.renderCell(L[0])})]}),o.jsx("rect",{"data-ref":"mesh-interceptor",width:s.left+n+s.right,height:s.top+r+s.bottom,fill:"red",opacity:0,style:{cursor:"auto"},onMouseEnter:T,onMouseMove:D,onMouseLeave:F,onMouseDown:q,onMouseUp:B,onTouchStart:W,onTouchMove:G,onTouchEnd:K,onClick:z,onDoubleClick:H})]})};function Xs(){return Xs=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Xs.apply(null,arguments)}function HP(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var Ho=function(t){return b.useMemo(function(){return typeof t=="function"?t:function(){return t}},[t])},OAt=function(t){var e=t.width,n=t.height,r=t.data,i=t.interpolation,s=t.xPadding,a=t.xOuterPadding,l=t.yOuterPadding,c=t.lineWidth,u=t.activeLineWidth,d=t.inactiveLineWidth,f=t.colors,h=t.opacity,p=t.activeOpacity,m=t.inactiveOpacity,x=t.pointSize,y=t.activePointSize,g=t.inactivePointSize,w=t.pointColor,v=t.pointBorderWidth,N=t.activePointBorderWidth,S=t.inactivePointBorderWidth,_=t.pointBorderColor,j=t.isInteractive,A=t.defaultActiveSerieIds,C=b.useState(A),k=C[0],M=C[1],I=b.useState(A),R=I[0],E=I[1],P=b.useMemo(function(){return function(ee){var V=ee.width,J=ee.height,Y=ee.data,$=ee.xPadding,fe=ee.xOuterPadding,ce=ee.yOuterPadding,ve=new Set,X=new Set;Y.forEach(function(Q){Q.data.forEach(function(oe){ve.add(oe.x),oe.y!==null&&X.add(oe.y)})});var de=Array.from(ve),Te=aF(mh().domain(de).range([0,V]).padding(fe)),Pe=Array.from(X).sort(function(Q,oe){return Q-oe}),se=aF(mh().domain(Pe).range([0,J]).padding(ce)),U=Te.step()*Math.min(.5*$,.5);return{series:Y.map(function(Q){var oe={id:Q.id,data:Q,points:[],linePoints:[]};return Q.data.forEach(function(_e,ye){var re=null,he=null;_e.y!==null&&(re=Te(_e.x),he=se(_e.y));var pe={id:Q.id+"."+ye,serie:Q,data:_e,x:re,y:he};oe.points.push(pe),pe.x!==null&&(ye===0?oe.linePoints.push([0,pe.y]):oe.linePoints.push([pe.x-U,pe.y])),oe.linePoints.push([pe.x,pe.y]),re!==null&&(ye===Q.data.length-1&&re?oe.linePoints.push([V,pe.y]):oe.linePoints.push([pe.x+U,pe.y])),oe.points=oe.points.filter(function(je){return je.x!==null})}),oe}),xScale:Te,yScale:se}}({width:e,height:n,data:r,xPadding:s,xOuterPadding:a,yOuterPadding:l})},[e,n,r,s,a,l]),O=P.series,L=P.xScale,T=P.yScale,D=function(ee){return b.useMemo(function(){return T6().curve(ee==="smooth"?hM:kg).defined(function(V){return V[0]!==null&&V[
49491]!==null})},[ee])}(i),F=_xe(f,"id"),q=function(ee){var V=ee.lineWidth,J=ee.activeLineWidth,Y=ee.inactiveLineWidth,$=ee.opacity,fe=ee.activeOpacity,ce=ee.inactiveOpacity,ve=ee.isInteractive,X=ee.activeSerieIds,de=Ho(V),Te=Ho(J),Pe=Ho(Y),se=Ho($),U=Ho(fe),Q=Ho(ce),oe=b.useCallback(function(re){return{opacity:se(re),lineWidth:de(re)}},[de,se]),_e=b.useCallback(function(re){return{opacity:U(re),lineWidth:Te(re)}},[Te,U]),ye=b.useCallback(function(re){return{opacity:Q(re),lineWidth:Pe(re)}},[Pe,Q]);return b.useCallback(function(re){return ve&&X.length!==0?X.includes(re.id)?_e(re):ye(re):oe(re)},[oe,_e,ye,ve,X])}({lineWidth:c,activeLineWidth:u,inactiveLineWidth:d,opacity:h,activeOpacity:p,inactiveOpacity:m,isInteractive:j,activeSerieIds:k}),B=b.useMemo(function(){return O.map(function(ee){return Xs({},ee,{color:F(ee.data)},q(ee))})},[O,F,q]),z=ka(),H=W_(w,z),W=W_(_,z),G=function(ee){var V=ee.pointSize,J=ee.activePointSize,Y=ee.inactivePointSize,$=ee.pointBorderWidth,fe=ee.activePointBorderWidth,ce=ee.inactivePointBorderWidth,ve=ee.isInteractive,X=ee.activePointIds,de=Ho(V),Te=Ho(J),Pe=Ho(Y),se=Ho($),U=Ho(fe),Q=Ho(ce),oe=b.useCallback(function(re){return{size:de(re),borderWidth:se(re)}},[de,se]),_e=b.useCallback(function(re){return{size:Te(re),borderWidth:U(re)}},[Te,U]),ye=b.useCallback(function(re){return{size:Pe(re),borderWidth:Q(re)}},[Pe,Q]);return b.useCallback(function(re){return ve&&X.length!==0?X.includes(re.id)?_e(re):ye(re):oe(re)},[oe,_e,ye,ve,X])}({pointSize:x,activePointSize:y,inactivePointSize:g,pointBorderWidth:v,activePointBorderWidth:N,inactivePointBorderWidth:S,isInteractive:j,activePointIds:R}),K=b.useMemo(function(){var ee=[];return B.forEach(function(V){V.points.forEach(function(J){var Y=Xs({},J,{serie:V,isActive:k.includes(V.id),isInactive:k.length>0&&!k.includes(V.id)});Y.color=H(Y),Y.borderColor=W(Y),ee.push(Xs({},Y,G(Y)))})}),ee},[B,k,H,W,G]);return{xScale:L,yScale:T,series:B,points:K,lineGenerator:D,activeSerieIds:k,setActiveSerieIds:M,activePointIds:R,setActivePointIds:E}},RAt=function(t){var e=t.serie,n=t.isInteractive,r=t.onMouseEnter,i=t.onMouseMove,s=t.onMouseLeave,a=t.onMouseDown,l=t.onMouseUp,c=t.onClick,u=t.onDoubleClick,d=t.setActiveSerieIds,f=t.lineTooltip,h=hP(),p=h.showTooltipFromEvent,m=h.hideTooltip,x=b.useCallback(function(_){p(b.createElement(f,{serie:e}),_),d([e.id]),r==null||r(e,_)},[e,r,p,d,f]),y=b.useCallback(function(_){p(b.createElement(f,{serie:e}),_),i==null||i(e,_)},[e,i,p,f]),g=b.useCallback(function(_){m(),d([]),s==null||s(e,_)},[e,s,m,d]),w=b.useCallback(function(_){a==null||a(e,_)},[e,a]),v=b.useCallback(function(_){l==null||l(e,_)},[e,l]),N=b.useCallback(function(_){c==null||c(e,_)},[e,c]),S=b.useCallback(function(_){u==null||u(e,_)},[e,u]);return b.useMemo(function(){return{onMouseEnter:n?x:void 0,onMouseMove:n?y:void 0,onMouseLeave:n?g:void 0,onMouseDown:n?w:void 0,onMouseUp:n?v:void 0,onClick:n?N:void 0,onDoubleClick:n?S:void 0}},[n,x,y,g,w,v,N,S])},IAt=function(t){var e=t.series,n=t.position,r=t.padding,i=t.color,s=t.getLabel,a=ka(),l=W_(i,a);return b.useMemo(function(){var c,u;n==="start"?(c="end",u=-1*r):(c="start",u=r);var d=[];return e.forEach(function(f){var h=f.id;typeof s=="function"&&(h=s(f.data));var p=n==="start"?f.linePoints[0]:f.linePoints[f.linePoints.length-1];(p==null?void 0:p[0])!==null&&(p==null?void 0:p[1])!==null&&d.push({id:f.id,label:h,x:p[0]+u,y:p[1],color:l(f),opacity:f.opacity,serie:f,textAnchor:c})}),d},[e,n,r,l,s])},DAt={pointerEvents:"none"},fn=Xs({},{layers:["grid","axes","labels","lines","points","mesh"],interpolation:"smooth",xPadding:.6,xOuterPadding:.5,yOuterPadding:.5,colors:{scheme:"nivo"},lineWidth:2,activeLineWidth:4,inactiveLineWidth:1,opacity:1,activeOpacity:1,inactiveOpacity:.3,startLabel:!1,startLabelPadding:16,startLabelTextColor:{from:"color"},endLabel:!0,endLabelPadding:16,endLabelTextColor:{from:"color"},pointSize:6,activePointSize:8,inactivePointSize:4,pointColor:{from:"serie.color"},pointBorderWidth:0,activePointBorderWidth:0,inactivePointBorderWidth:0,pointBorderColor:{from:"serie.color",modifiers:[["darker",1.4]]},enableGridX:!0,enableGridY:!0,axisTop:{},axisRight:null,axisBottom:{},axisLeft:{},isInteractive:!0,defaultActiveSerieIds:[],lineTooltip:function(t){var e=t.serie;return o.jsx(X5,{"data-testid":"tooltip."+e.data.id,id:e.data.id,enableChip:!0,color:e.color})},pointTooltip:b.memo(function(t){var e=t.point;return o.jsx(X5,{id:o.jsxs("span",{children:["x: ",o.jsx("strong",{children:e.data.x}),", y: ",o.jsx("strong",{children:e.data.y})]}),enableChip:!0,color:e.serie.color})}),useMesh:!1,debugMesh:!1,role:"img",renderWrapper:!0},{pointComponent:function(t){var e=t.point,n=_c(),r=n.animate,i=n.
4949config,s=sp({x:e.x,y:e.y,radius:e.size/2,color:e.color,borderWidth:e.borderWidth,config:i,immediate:!r});return o.jsx(W8.circle,{"data-testid":"point."+e.serie.id+"."+e.data.x,cx:s.x,cy:s.y,r:sge(s.radius,function(a){return Math.max(a,0)}),fill:s.color,strokeWidth:s.borderWidth,stroke:e.borderColor,style:DAt})},animate:!0,motionConfig:"gentle"}),LAt=function(t){var e=t.serie,n=t.lineGenerator,r=t.yStep,i=t.isInteractive,s=t.onMouseEnter,a=t.onMouseMove,l=t.onMouseLeave,c=t.onMouseDown,u=t.onMouseUp,d=t.onClick,f=t.onDoubleClick,h=t.setActiveSerieIds,p=t.lineTooltip,m=t.useMesh,x=RAt({serie:e,isInteractive:i,onMouseEnter:s,onMouseMove:a,onMouseLeave:l,onMouseDown:c,onMouseUp:u,onClick:d,onDoubleClick:f,setActiveSerieIds:h,lineTooltip:p}),y=_c(),g=y.animate,w=y.config,v=n(e.linePoints)||"",N=Ige(v),S=sp({color:e.color,opacity:e.opacity,lineWidth:e.lineWidth,config:w,immediate:!g});return o.jsxs(o.Fragment,{children:[o.jsx(W8.path,{"data-testid":"line."+e.id,fill:"none",d:N,stroke:S.color,strokeWidth:S.lineWidth,strokeLinecap:"round",strokeOpacity:S.opacity,style:{pointerEvents:"none"}}),i&&!m&&o.jsx("path",{"data-testid":"line."+e.id+".interactive",fill:"none",stroke:"red",strokeOpacity:0,strokeWidth:r,d:v,strokeLinecap:"butt",onMouseEnter:x.onMouseEnter,onMouseMove:x.onMouseMove,onMouseLeave:x.onMouseLeave,onMouseDown:x.onMouseDown,onMouseUp:x.onMouseUp,onClick:x.onClick,onDoubleClick:x.onDoubleClick})]})},QJ=function(t){var e=t.series,n=t.getLabel,r=t.position,i=t.padding,s=t.color,a=ka(),l=_c(),c=l.animate,u=l.config,d=IAt({series:e,getLabel:n,position:r,padding:i,color:s}),f=k8(d.length,d.map(function(h){return{x:h.x,y:h.y,opacity:h.opacity,config:u,immediate:!c}}));return o.jsx(o.Fragment,{children:f.map(function(h,p){var m=d[p];return o.jsx(BP,{"data-testid":"label."+r+"."+m.serie.id,x:h.x,y:h.y,textAnchor:m.textAnchor,dominantBaseline:"central",opacity:h.opacity,style:Xs({},a.labels.text,{fill:m.color}),children:m.label},m.id)})})},$At=b.memo(function(t){var e=t.points,n=t.width,r=t.height,i=t.margin,s=t.setActivePointIds,a=t.setActiveSerieIds,l=t.onMouseEnter,c=t.onMouseMove,u=t.onMouseLeave,d=t.onMouseDown,f=t.onMouseUp,h=t.onClick,p=t.onDoubleClick,m=t.tooltip,x=t.debug,y=hP(),g=y.showTooltipAt,w=y.hideTooltip,v=b.useCallback(function(k,M){var I;g(b.createElement(m,{point:k}),[k.x+i.left,(I=k.y)!=null?I:0+i.top],"top"),s([k.id]),a([k.serie.id]),l==null||l(k,M)},[g,m,i.left,i.top,s,a,l]),N=b.useCallback(function(k,M){var I;g(b.createElement(m,{point:k}),[k.x+i.left,(I=k.y)!=null?I:0+i.top],"top"),s([k.id]),a([k.serie.id]),c==null||c(k,M)},[g,m,i.left,i.top,s,a,c]),S=b.useCallback(function(k,M){w(),s([]),a([]),u==null||u(k,M)},[w,u,s,a]),_=b.useCallback(function(k,M){d==null||d(k,M)},[d]),j=b.useCallback(function(k,M){f==null||f(k,M)},[f]),A=b.useCallback(function(k,M){h==null||h(k,M)},[h]),C=b.useCallback(function(k,M){p==null||p(k,M)},[p]);return o.jsx(PAt,{nodes:e,width:n,height:r,onMouseEnter:v,onMouseMove:N,onMouseLeave:S,onMouseDown:_,onMouseUp:j,onClick:A,onDoubleClick:C,debug:x})}),FAt=["isInteractive","animate","motionConfig","theme","renderWrapper"],UAt=function(t){var e=t.data,n=t.width,r=t.height,i=t.margin,s=t.layers,a=s===void 0?fn.layers:s,l=t.interpolation,c=l===void 0?fn.interpolation:l,u=t.xPadding,d=u===void 0?fn.xPadding:u,f=t.xOuterPadding,h=f===void 0?fn.xOuterPadding:f,p=t.yOuterPadding,m=p===void 0?fn.yOuterPadding:p,x=t.colors,y=x===void 0?fn.colors:x,g=t.lineWidth,w=g===void 0?fn.lineWidth:g,v=t.activeLineWidth,N=v===void 0?fn.activeLineWidth:v,S=t.inactiveLineWidth,_=S===void 0?fn.inactiveLineWidth:S,j=t.opacity,A=j===void 0?fn.opacity:j,C=t.activeOpacity,k=C===void 0?fn.activeOpacity:C,M=t.inactiveOpacity,I=M===void 0?fn.inactiveOpacity:M,R=t.startLabel,E=R===void 0?fn.startLabel:R,P=t.startLabelPadding,O=P===void 0?fn.startLabelPadding:P,L=t.startLabelTextColor,T=L===void 0?fn.startLabelTextColor:L,D=t.endLabel,F=D===void 0?fn.endLabel:D,q=t.endLabelPadding,B=q===void 0?fn.endLabelPadding:q,z=t.endLabelTextColor,H=z===void 0?fn.endLabelTextColor:z,W=t.pointComponent,G=W===void 0?fn.pointComponent:W,K=t.pointSize,ee=K===void 0?fn.pointSize:K,V=t.activePointSize,J=V===void 0?fn.activePointSize:V,Y=t.inactivePointSize,$=Y===void 0?fn.inactivePointSize:Y,fe=t.pointColor,ce=fe===void 0?fn.pointColor:fe,ve=t.pointBorderWidth,X=ve===void 0?fn.pointBorderWidth:ve,de=t.activePointBorderWidth,Te=de===void 0?fn.activePointBorderWidth:de,Pe=t.inactivePointBorderWidth,se=Pe===void 0?fn.inactivePointBorderWidth:Pe,U=t.pointBorderColor,Q=U===void 0?fn.pointBorderColor:U,oe=t.enableGridX,_e=oe===void 0?fn.enableGridX:oe,ye=t.enableGridY,re=ye===void 0?fn.enableGridY:ye,he=t.axisTop,pe=he===void 0?fn.axisTop:he,je=t.axisRight,ae=t.axisBottom,we=ae===void 0?fn.axisBottom:ae,Ie=t.axisLeft,Ue=Ie===void 0?fn.axisLeft:Ie,Oe=t.isInteractive,ie=Oe===void 0?fn.isInteractive:Oe,De=t.defaultActiveSerieIds,Ve=De===void 0?fn.defaultActiveSerieIds:De,xe=t.onMouseEnter,$e=t.onMouseMove,ue=t.onMouseLeave,Ne=t.onMouseDown,Le=t.onMouseUp,tt=t.onClick,St=t.onDoubleClick,rt=t.useMesh,vt=rt===void 0?fn.useMesh:rt,me=t.debugMesh,Fe=me===void 0?fn.debugMesh:me,He=t.lineTooltip,Ye=He===void 0?fn.lineTooltip:He,Nt=t.pointTooltip,qt=Nt===void 0?fn.pointTooltip:Nt,Jt=t.role,ea=Jt===void 0?fn.role:Jt,hn=t.forwardedRef,sn=L8(n,r,i),Jn=sn.margin,sr=sn.innerWidth,ar=sn.innerHeight,as=sn.outerWidth,Cs=sn.outerHeight,en=OAt({width:sr,height:ar,data:e,interpolation:c,xPadding:d,xOuterPadding:h,yOuterPadding:m,lineWidth:w,activeLineWidth:N,inactiveLineWidth:_,colors:y,opacity:A,activeOpacity:k,inactiveOpacity:I,pointSize:ee,activePointSize:J,inactivePointSize:$,pointColor:ce,pointBorderWidth:X,activePointBorderWidth:Te,inactivePointBorderWidth:se,pointBorderColor:Q,isInteractive:ie,defaultActiveSerieIds:Ve}),Z=en.series,Se=en.points,ke=en.xScale,Ee=en.yScale,Ae=en.lineGenerator,qe=en.activePointIds,st=en.activeSerieIds,it=en.setActiveSerieIds,lt=en.setActivePointIds,ht={grid:null,axes:null,labels:null,lines:null,points:null,mesh:null};a.includes("grid")&&(ht.grid=o.jsx(yxe,{width:sr,height:ar,xScale:_e?ke:null,yScale:re?Ee:null},"grid")),a.includes("axes")&&(ht.axes=o.jsx(xxe,{xScale:ke,yScale:Ee,width:sr,height:ar,top:pe,right:je,bottom:we,left:Ue},"axes")),a.includes("lines")&&(ht.lines=o.jsx(b.Fragment,{children:Z.map(function(pt){return o.jsx(LAt,{serie:pt,setActiveSerieIds:it,lineGenerator:Ae,yStep:Ee.step(),isInteractive:ie,onMouseEnter:xe,onMouseMove:$e,onMouseLeave:ue,onMouseDown:Ne,onMouseUp:Le,onClick:tt,onDoubleClick:St,lineTooltip:Ye,useMesh:vt},pt.id)})},"lines")),ie&&vt&&a.includes("mesh")&&(ht.mesh=o.jsx($At,{points:Se,width:sr,height:ar,margin:Jn,setActivePointIds:lt,setActiveSerieIds:it,onMouseEnter:xe,onMouseMove:$e,onMouseLeave:ue,onMouseDown:Ne,onMouseUp:Le,onClick:tt,onDoubleClick:St,tooltip:qt,debug:Fe},"mesh")),a.includes("points")&&(ht.points=Se.map(function(pt){return b.createElement(G,{key:pt.id,point:pt})})),a.includes("labels")&&(ht.labels=o.jsxs(b.Fragment,{children:[E!==!1&&o.jsx(QJ,{series:Z,getLabel:E,position:"start",padding:O,color:T}),F!==!1&&o.jsx(QJ,{series:Z,getLabel:F,position:"end",padding:B,color:H})]},"legends"));
4949var At=b.useMemo(function(){return{innerHeight:ar,innerWidth:sr,lineGenerator:Ae,points:Se,series:Z,xScale:ke,yScale:Ee,activeSerieIds:st,activePointIds:qe,setActiveSerieIds:it,setActivePointIds:lt}},[qe,st,lt,it,ar,sr,Ae,Se,Z,ke,Ee]);return o.jsx(I8,{width:as,height:Cs,margin:Jn,role:ea,ref:hn,children:a.map(function(pt,xn){var Fn;return typeof pt=="function"?o.jsx(b.Fragment,{children:b.createElement(pt,At)},xn):(Fn=ht==null?void 0:ht[pt])!=null?Fn:null})})},zAt=b.forwardRef(function(t,e){var n=t.isInteractive,r=n===void 0?fn.isInteractive:n,i=t.animate,s=i===void 0?fn.animate:i,a=t.motionConfig,l=a===void 0?fn.motionConfig:a,c=t.theme,u=t.renderWrapper,d=HP(t,FAt);return o.jsx(O8,{animate:s,isInteractive:r,motionConfig:l,renderWrapper:u,theme:c,children:o.jsx(UAt,Xs({isInteractive:r},d,{forwardedRef:e}))})}),BAt=["defaultWidth","defaultHeight","onResize","debounceResize"],VAt=b.forwardRef(function(t,e){var n=t.defaultWidth,r=t.defaultHeight,i=t.onResize,s=t.debounceResize,a=HP(t,BAt);return o.jsx(R8,{defaultWidth:n,defaultHeight:r,onResize:i,debounceResize:s,children:function(l){var c=l.width,u=l.height;return o.jsx(zAt,Xs({width:c,height:u},a,{ref:e}))}})}),HAt=function(t){var e=t.data,n=t.width,r=t.height,i=t.align,s=t.spacing,a=t.xPadding;return b.useMemo(function(){return function(l){var c,u,d=l.data,f=l.width,h=l.height,p=l.align,m=l.spacing,x=l.xPadding,y=new Map;d.forEach(function(S){S.data.forEach(function(_){y.has(_.x)||y.set(_.x,{id:_.x,total:0,values:new Map,x:0});var j=y.get(_.x),A=j.total+_.y;j.total=A,j.values.set(S.id,{serieId:S.id,value:_.y,position:0,height:0,beforeHeight:0}),(c===void 0||A>c)&&(c=A),(u===void 0||j.values.size>u)&&(u=j.values.size)})});var g=aF(mh().domain(Array.from(y.keys())).range([0,f])),w=wEt(Ym().domain([0,c]).range([0,h-u*m]));y.forEach(function(S,_){S.x=g(_);var j=w(S.total)+S.values.size*m,A=0;p==="middle"?A=(h-j)/2:p==="end"&&(A=h-j),Array.from(S.values.values()).sort(function(C,k){return k.value-C.value}).forEach(function(C,k,M){var I=M.filter(function(P,O){return O<k}),R=I.reduce(function(P,O){return P+O.value},0),E=S.values.get(C.serieId);E.position=k,E.height=w(C.value),E.beforeHeight=w(R)+A+m*(I.length+.5)})});var v=g.step()*Math.min(.5*x,.5),N=d.map(function(S){var _={id:S.id,data:S,points:[],areaPoints:[]};return S.data.forEach(function(j,A){var C=y.get(j.x),k=C.values.get(S.id),M=C.x,I=k.beforeHeight,R=k.height,E=I+R/2,P=I,O=I+R;_.points.push({x:M,y:E,height:R,data:Xs({},j)}),A>0&&_.areaPoints.push({x:M-v,y0:P,y1:O}),_.areaPoints.push({x:M,y0:P,y1:O}),A<S.data.length-1&&_.areaPoints.push({x:M+v,y0:P,y1:O})}),_});return{series:N,xScale:g,heightScale:w}}({data:e,width:n,height:r,align:i,spacing:s,xPadding:a})},[e,n,r,i,s,a])},Mu=function(t){return b.useMemo(function(){return typeof t=="function"?t:function(){return t}},[t])},WAt=function(t){var e=t.data,n=t.width,r=t.height,i=t.align,s=t.spacing,a=t.xPadding,l=t.interpolation,c=t.colors,u=t.fillOpacity,d=t.activeFillOpacity,f=t.inactiveFillOpacity,h=t.borderWidth,p=t.activeBorderWidth,m=t.inactiveBorderWidth,x=t.borderColor,y=t.borderOpacity,g=t.activeBorderOpacity,w=t.inactiveBorderOpacity,v=t.isInteractive,N=t.defaultActiveSerieIds,S=b.useState(N),_=S[0],j=S[1],A=HAt({data:e,width:n,height:r,align:i,spacing:s,xPadding:a}),C=A.series,k=A.xScale,M=A.heightScale,I=function(P){return b.useMemo(function(){return hw().x(function(O){return O.x}).y0(function(O){return O.y0}).y1(function(O){return O.y1}).curve(P==="smooth"?hM:kg)},[P])}(l),R=_xe(c,"id"),E=function(P){var O=P.fillOpacity,L=P.activeFillOpacity,T=P.inactiveFillOpacity,D=P.borderWidth,F=P.activeBorderWidth,q=P.inactiveBorderWidth,B=P.borderColor,z=P.borderOpacity,H=P.activeBorderOpacity,W=P.inactiveBorderOpacity,G=P.isInteractive,K=P.activeSerieIds,ee=Mu(O),V=Mu(L),J=Mu(T),Y=Mu(D),$=Mu(F),fe=Mu(q),ce=ka(),ve=W_(B,ce),X=Mu(z),de=Mu(H),Te=Mu(W),Pe=b.useCallback(function(Q){return{fillOpacity:ee(Q),borderWidth:Y(Q),borderColor:ve(Q),borderOpacity:X(Q)}},[ee,Y,ve,X]),se=b.useCallback(function(Q){return{fillOpacity:V(Q),borderWidth:$(Q),borderColor:ve(Q),borderOpacity:de(Q)}},[V,$,ve,de]),U=b.useCallback(function(Q){return{fillOpacity:J(Q),borderWidth:fe(Q),borderColor:ve(Q),borderOpacity:Te(Q)}},[J,fe,ve,Te]);return b.useCallback(function(Q){return G&&K.length!==0?K.includes(Q.id)?se(Q):U(Q):Pe(Q)},[Pe,se,U,G,K])}({fillOpacity:u,activeFillOpacity:d,inactiveFillOpacity:f,borderWidth:h,activeBorderWidth:p,inactiveBorderWidth:m,borderColor:x,borderOpacity:y,activeBorderOpacity:g,inactiveBorderOpacity:w,isInteractive:v,activeSerieIds:_});return{series:b.useMemo(function(){return C.map(function(P){var O=Xs({},P,{color:R(P.data)});return Xs({},O,E(O))})},[C,R,E]),xScale:k,heightScale:M,areaGenerator:I,activeSerieIds:_,setActiveSerieIds:j}},GAt=function(t){var e=t.serie,n=t.isInteractive,r=t.onMouseEnter,i=t.onMouseMove,s=t.onMouseLeave,a=t.onClick,l=t.setActiveSerieIds,c=t.tooltip,u=hP(),d=u.showTooltipFromEvent,f=u.hideTooltip,h=b.useCallback(function(y){d(b.createElement(c,{serie:e}
4949),y),l([e.id]),r==null||r(e,y)},[e,r,d,l,c]),p=b.useCallback(function(y){d(b.createElement(c,{serie:e}),y),i==null||i(e,y)},[e,i,d,c]),m=b.useCallback(function(y){f(),l([]),s==null||s(e,y)},[e,s,f,l]),x=b.useCallback(function(y){a==null||a(e,y)},[e,a]);return b.useMemo(function(){return{onMouseEnter:n?h:void 0,onMouseMove:n?p:void 0,onMouseLeave:n?m:void 0,onClick:n?x:void 0}},[n,h,p,m,x])},qAt=function(t){var e=t.series,n=t.position,r=t.padding,i=t.color,s=t.getLabel,a=ka(),l=W_(i,a);return b.useMemo(function(){var c,u;return n==="start"?(c="end",u=-1*r):(c="start",u=r),e.map(function(d){var f=d.id;typeof s=="function"&&(f=s(d.data));var h=n==="start"?d.points[0]:d.points[d.points.length-1];return{id:d.id,label:f,x:h.x+u,y:h.y,color:l(d),opacity:d.fillOpacity,serie:d,textAnchor:c}})},[s,e,n,r,l])},KAt=function(t){var e=t.serie,n=t.areaGenerator,r=t.blendMode,i=t.isInteractive,s=t.onMouseEnter,a=t.onMouseMove,l=t.onMouseLeave,c=t.onClick,u=t.setActiveSerieIds,d=t.tooltip,f=GAt({serie:e,isInteractive:i,onMouseEnter:s,onMouseMove:a,onMouseLeave:l,onClick:c,setActiveSerieIds:u,tooltip:d}),h=_c(),p=h.animate,m=h.config,x=Ige(n(e.areaPoints)||""),y=sp({color:e.color,fillOpacity:e.fillOpacity,stroke:e.borderColor,strokeOpacity:e.borderOpacity,config:m,immediate:!p});return o.jsx(W8.path,{"data-testid":"area."+e.id,d:x,fill:e.fill?e.fill:y.color,fillOpacity:y.fillOpacity,stroke:y.stroke,strokeWidth:e.borderWidth,strokeOpacity:y.strokeOpacity,style:{mixBlendMode:r},onMouseEnter:f.onMouseEnter,onMouseMove:f.onMouseMove,onMouseLeave:f.onMouseLeave,onClick:f.onClick})},JJ=function(t){var e=t.getLabel,n=t.series,r=t.position,i=t.padding,s=t.color,a=ka(),l=_c(),c=l.animate,u=l.config,d=qAt({getLabel:e,series:n,position:r,padding:i,color:s}),f=k8(d.length,d.map(function(h){return{x:h.x,y:h.y,opacity:h.opacity,config:u,immediate:!c}}));return o.jsx(o.Fragment,{children:f.map(function(h,p){var m=d[p];return o.jsx(BP,{"data-testid":"label."+r+"."+m.serie.id,x:h.x,y:h.y,textAnchor:m.textAnchor,dominantBaseline:"central",opacity:h.opacity,style:Xs({},a.labels.text,{fill:m.color}),children:m.label},m.id)})})},On=Xs({},{align:"middle",layers:["grid","axes","labels","areas"],interpolation:"smooth",spacing:0,xPadding:.6,colors:{scheme:"nivo"},blendMode:"normal",fillOpacity:.8,activeFillOpacity:1,inactiveFillOpacity:.15,borderWidth:1,activeBorderWidth:1,inactiveBorderWidth:0,borderColor:{from:"color",modifiers:[["darker",.4]]},borderOpacity:1,activeBorderOpacity:1,inactiveBorderOpacity:0,startLabel:!0,startLabelPadding:12,startLabelTextColor:{from:"color",modifiers:[["darker",1]]},endLabel:!0,endLabelPadding:12,endLabelTextColor:{from:"color",modifiers:[["darker",1]]},enableGridX:!0,axisTop:{},axisBottom:{},isInteractive:!0,defaultActiveSerieIds:[],tooltip:function(t){var e=t.serie;return o.jsx(X5,{id:e.id,enableChip:!0,color:e.color})},role:"img"},{defs:[],fill:[],animate:!0,motionConfig:"gentle"}),YAt=["isInteractive","animate","motionConfig","theme","renderWrapper"],XAt=function(t){var e=t.data,n=t.align,r=n===void 0?On.align:n,i=t.width,s=t.height,a=t.margin,l=t.layers,c=l===void 0?On.layers:l,u=t.interpolation,d=u===void 0?On.interpolation:u,f=t.spacing,h=f===void 0?On.spacing:f,p=t.xPadding,m=p===void 0?On.xPadding:p,x=t.colors,y=x===void 0?On.colors:x,g=t.blendMode,w=g===void 0?On.blendMode:g,v=t.fillOpacity,N=v===void 0?On.fillOpacity:v,S=t.activeFillOpacity,_=S===void 0?On.activeFillOpacity:S,j=t.inactiveFillOpacity,A=j===void 0?On.inactiveFillOpacity:j,C=t.defs,k=C===void 0?On.defs:C,M=t.fill,I=M===void 0?On.fill:M,R=t.borderWidth,E=R===void 0?On.borderWidth:R,P=t.activeBorderWidth,O=P===void 0?On.activeBorderWidth:P,L=t.inactiveBorderWidth,T=L===void 0?On.inactiveBorderWidth:L,D=t.borderColor,F=D===void 0?On.borderColor:D,q=t.borderOpacity,B=q===void 0?On.borderOpacity:q,z=t.activeBorderOpacity,H=z===void 0?On.activeBorderOpacity:z,W=t.inactiveBorderOpacity,G=W===void 0?On.inactiveBorderOpacity:W,K=t.startLabel,ee=K===void 0?On.startLabel:K,V=t.startLabelPadding,J=V===void 0?On.startLabelPadding:V,Y=t.startLabelTextColor,$=Y===void 0?On.startLabelTextColor:Y,fe=t.endLabel,ce=fe===void 0?On.endLabel:fe,ve=t.endLabelPadding,X=ve===void 0?On.endLabelPadding:ve,de=t.endLabelTextColor,Te=de===void 0?On.endLabelTextColor:de,Pe=t.enableGridX,se=Pe===void 0?On.enableGridX:Pe,U=t.axisTop,Q=U===void 0?On.axisTop:U,oe=t.axisBottom,_e=oe===void 0?On.axisBottom:oe,ye=t.isInteractive,re=ye===void 0?On.isInteractive:ye,he=t.defaultActiveSerieIds,pe=he===void 0?On.defaultActiveSerieIds:he,je=t.onMouseEnter,ae=t.onMouseMove,we=t.onMouseLeave,Ie=t.onClick,Ue=t.tooltip,Oe=Ue===void 0?On.tooltip:Ue,ie=t.role,De=ie===void 0?On.role:ie,Ve=t.forwardedRef,xe=L8(i,s,a),$e=xe.margin,ue=xe.innerWidth,Ne=xe.innerHe
4949ight,Le=xe.outerWidth,tt=xe.outerHeight,St=WAt({data:e,width:ue,height:Ne,align:r,spacing:h,xPadding:m,interpolation:d,colors:y,fillOpacity:N,activeFillOpacity:_,inactiveFillOpacity:A,borderWidth:E,activeBorderWidth:O,inactiveBorderWidth:T,borderColor:F,borderOpacity:B,activeBorderOpacity:H,inactiveBorderOpacity:G,isInteractive:re,defaultActiveSerieIds:pe}),rt=St.series,vt=St.xScale,me=St.heightScale,Fe=St.areaGenerator,He=St.setActiveSerieIds,Ye=b.useMemo(function(){return Tkt(k,rt,I,{targetKey:"fill"})},[k,rt,I]),Nt={grid:null,axes:null,labels:null,areas:null};c.includes("grid")&&se&&(Nt.grid=o.jsx(yxe,{width:ue,height:Ne,xScale:vt},"grid")),c.includes("axes")&&(Nt.axes=o.jsx(xxe,{xScale:vt,yScale:me,width:ue,height:Ne,top:Q,bottom:_e},"axes")),c.includes("areas")&&(Nt.areas=o.jsx(b.Fragment,{children:rt.map(function(Jt){return o.jsx(KAt,{areaGenerator:Fe,serie:Jt,blendMode:w,isInteractive:re,setActiveSerieIds:He,onMouseEnter:je,onMouseMove:ae,onMouseLeave:we,onClick:Ie,tooltip:Oe},Jt.id)})},"areas")),c.includes("labels")&&(Nt.labels=o.jsxs(b.Fragment,{children:[ee!==!1&&o.jsx(JJ,{getLabel:ee,series:rt,position:"start",padding:J,color:$}),ce!==!1&&o.jsx(JJ,{getLabel:ce,series:rt,position:"end",padding:X,color:Te})]},"labels"));var qt=b.useMemo(function(){return{innerWidth:ue,innerHeight:Ne,outerWidth:Le,outerHeight:tt,series:rt,xScale:vt,areaGenerator:Fe}},[ue,Ne,Le,tt,rt,vt,Fe]);return o.jsx(I8,{defs:Ye,width:Le,height:tt,margin:$e,role:De,ref:Ve,children:c.map(function(Jt,ea){var hn;return typeof Jt=="function"?o.jsx(b.Fragment,{children:b.createElement(Jt,qt)},ea):(hn=Nt==null?void 0:Nt[Jt])!=null?hn:null})})},QAt=b.forwardRef(function(t,e){var n=t.isInteractive,r=n===void 0?On.isInteractive:n,i=t.animate,s=i===void 0?On.animate:i,a=t.motionConfig,l=a===void 0?On.motionConfig:a,c=t.theme,u=t.renderWrapper,d=HP(t,YAt);return o.jsx(O8,{animate:s,isInteractive:r,motionConfig:l,renderWrapper:u,theme:c,children:o.jsx(XAt,Xs({isInteractive:r},d,{forwardedRef:e}))})}),JAt=["defaultWidth","defaultHeight","onResize","debounceResize"];b.forwardRef(function(t,e){var n=t.defaultWidth,r=t.defaultHeight,i=t.onResize,s=t.debounceResize,a=HP(t,JAt);return o.jsx(R8,{defaultWidth:n,defaultHeight:r,onResize:i,debounceResize:s,children:function(l){var c=l.width,u=l.height;return o.jsx(QAt,Xs({width:c,height:u},a,{ref:e}))}})});const ZAt=({point:t})=>{if(t.y===null)return null;const e=t.serie.data.faviconUrl,n=t.serie.id||"",r=t.size,i=t.borderColor,s=`clip-${String(n).replace(/[^a-zA-Z0-9]/g,"")}-${t.x}-${t.y}`,a=r-2;return o.jsxs("g",{transform:`translate(${t.x}, ${t.y})`,style:{pointerEvents:"none"},children:[o.jsx("defs",{children:o.jsx("clipPath",{id:s,children:o.jsx("circle",{r:a/2,cx:0,cy:0})})}),o.jsx("circle",{r:r/2+3,fill:"var(--background)",stroke:i,strokeWidth:4,opacity:1}),o.jsx("circle",{r:r/2,fill:"var(--background)",stroke:"var(--background)",strokeWidth:1}),e?o.jsx("image",{href:e,x:-a/2,y:-a/2,width:a,height:a,preserveAspectRatio:"xMidYMid slice",clipPath:`url(#${s})`,style:{pointerEvents:"none"}}):o.jsx("text",{textAnchor:"middle",dominantBaseline:"central",style:{fontSize:r*.35,fontWeight:600,fill:i},children:String(n).charAt(0).toUpperCase()})]})},ZJ=7;function eTt({data:t,entities:e,className:n}){const r=b.useMemo(()=>{const s=new Map;return e.forEach(a=>{s.set(a.name,a.faviconUrl||null)}),s},[e]),i=b.useMemo(()=>{if(t.length===0||e.length===0)return[];const s=new Map,a=t.map((u,d)=>{const f=u.date;if(typeof f=="string")try{const h=new Date(f),p=h.getDate().toString().padStart(2,"0"),m=(h.getMonth()+1).toString().padStart(2,"0"),x=`${p}/${m}`,y=(s.get(x)||0)+1;return s.set(x,y),y===1?`${p} / ${m}`:`${p} / ${m} #${y}`}catch{return`Run ${d+1}`}return`Run ${d+1}`}),l=new Map;e.forEach(u=>{l.set(u.key,new Array(t.length).fill(null))}),t.forEach((u,d)=>{const f=[];e.forEach(h=>{const p=u[h.key];typeof p=="number"&&f.push({key:h.key,rank:p})}),f.sort((h,p)=>h.rank-p.rank),f.forEach((h,p)=>{const m=l.get(h.key);m&&(m[d]=p+1)})});const c=e.map(u=>{const d=l.get(u.key)||[],f=a.map((h,p)=>({x:h,y:d[p]}));return{id:u.name,faviconUrl:r.get(u.name)||null,data:f}});if(a.length<ZJ){const u=ZJ-a.length;let d=new Date;if(t.length>0){const f=t[t.length-1].date;if(typeof f=="string")try{d=new Date(f)}catch{}}for(let f=0;f<u;f++){const h=new Date(d);h.setDate(h.getDate()+f+1);const p=h.getDate().toString().padStart(2,"0"),m=(h.getMonth()+1).toString().padStart(2,"0"),x=`${p} / ${m}`;
vendor: 22,180 bytes, line 4949
4949c.forEach(y=>{y.data.push({x,y:null})})}}return c},[t,e,r]);return i.length===0?o.jsx("div",{className:ne("flex h-[450px] items-center justify-center text-muted-foreground",n),children:"No ranking data available"}):o.jsx("div",{className:ne("h-[450px] w-full",n),children:o.jsx(VAt,{data:i,interpolation:"smooth",xPadding:.6,xOuterPadding:1,yOuterPadding:1,colors:{scheme:"tableau10"},lineWidth:2,activeLineWidth:2,inactiveLineWidth:2,inactiveOpacity:2,startLabel:!1,startLabelPadding:0,endLabel:!1,endLabelPadding:0,pointSize:24,activePointSize:24,inactivePointSize:24,pointColor:{theme:"background"},pointBorderWidth:0,activePointBorderWidth:0,inactivePointBorderWidth:0,pointBorderColor:{from:"serie.color"},pointComponent:ZAt,axisTop:{tickSize:0,tickPadding:12,tickRotation:0},axisBottom:null,axisLeft:{tickSize:0,tickPadding:12,tickRotation:0,format:s=>`#${s}`},axisRight:null,margin:{top:20,right:20,bottom:20,left:30},enableGridX:!0,enableGridY:!0,theme:{background:"transparent",text:{fill:"var(--text-foreground)",fontSize:12,fontFamily:"inherit"},axis:{ticks:{text:{fill:"var(--muted-foreground)",fontSize:11}}},grid:{line:{stroke:"var(--border)",strokeWidth:1,strokeDasharray:"4 4"}}}})})}function eZ(t,[e,n]){return Math.min(n,Math.max(e,t))}function tTt(t,e=[]){let n=[];function r(s,a){const l=b.createContext(a),c=n.length;n=[...n,a];const u=f=>{var g;const{scope:h,children:p,...m}=f,x=((g=h==null?void 0:h[t])==null?void 0:g[c])||l,y=b.useMemo(()=>m,Object.values(m));return o.jsx(x.Provider,{value:y,children:p})};u.displayName=s+"Provider";function d(f,h){var x;const p=((x=h==null?void 0:h[t])==null?void 0:x[c])||l,m=b.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[u,d]}const i=()=>{const s=n.map(a=>b.createContext(a));return function(l){const c=(l==null?void 0:l[t])||s;return b.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return i.scopeName=t,[r,nTt(i,...e)]}function nTt(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const a=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...l,...f}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return n.scopeName=e.scopeName,n}function kxe(t){const e=rTt(t),n=b.forwardRef((r,i)=>{const{children:s,...a}=r,l=b.Children.toArray(s),c=l.find(sTt);if(c){const u=c.props.children,d=l.map(f=>f===c?b.Children.count(u)>1?b.Children.only(null):b.isValidElement(u)?u.props.children:null:f);return o.jsx(e,{...a,ref:i,children:b.isValidElement(u)?b.cloneElement(u,void 0,d):null})}return o.jsx(e,{...a,ref:i,children:s})});return n.displayName=`${t}.Slot`,n}function rTt(t){const e=b.forwardRef((n,r)=>{const{children:i,...s}=n;if(b.isValidElement(i)){const a=oTt(i),l=aTt(s,i.props);return i.type!==b.Fragment&&(l.ref=r?Ir(r,a):a),b.cloneElement(i,l)}return b.Children.count(i)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var iTt=Symbol("radix.slottable");function sTt(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===iTt}function aTt(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...l)=>{const c=s(...l);return i(...l),c}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function oTt(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var lTt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],$o=lTt.reduce((t,e)=>{const n=kxe(`Primitive.${e}`),r=b.forwardRef((i,s)=>{const{asChild:a,...l}=i,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),cTt=[" ","Enter","ArrowUp","ArrowDown"],uTt=[" ","Enter"],lg="Select",[WP,GP,dTt]=$B(lg),[Q0]=tTt(lg,[dTt,xu]),qP=xu(),[fTt,ap]=Q0(lg),[hTt,pTt]=Q0(lg),Exe=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:i,onOpenChange:s,value:a,defaultValue:l,onValueChange:c,dir:u,name:d,autoComplete:f,disabled:h,required:p,form:m}=t,x=qP(e),[y,g]=b.useState(null),[w,v]=b.useState(null),[N,S]=b.useState(!1),_=GM(u),[j,A]=su({prop:r,defaultProp:i??!1,onChange:s,caller:lg}),[C,k]=su({prop:a,defaultProp:l,onChange:c,caller:lg}),M=b.useRef(null),I=y?m||!!y.closest("form"):!0,[R,E]=b.useState(new Set),P=Array.from(R).map(O=>O.props.value).join(";");return o.jsx(TS,{...x,children:o.jsxs(fTt,{required:p,scope:e,trigger:y,onTriggerChange:g,valueNode:w,onValueNodeChange:v,valueNodeHasChildren:N,onValueNodeHasChildrenChange:S,contentId:ys(),value:C,onValueChange:k,open:j,onOpenChange:A,dir:_,triggerPointerDownPosRef:M,disabled:h,children:[o.jsx(WP.Provider,{scope:e,children:o.jsx(hTt,{scope:t.__scopeSelect,onNativeOptionAdd:b.useCallback(O=>{E(L=>new Set(L).add(O))},[]),onNativeOptionRemove:b.useCallback(O=>{E(L=>{const T=new Set(L);return T.delete(O),T})},[]),children:n})}),I?o.jsxs(Jxe,{"aria-hidden":!0,required:p,tabIndex:-1,name:d,autoComplete:f,value:C,onChange:O=>k(O.target.value),disabled:h,form:m,children:[C===void 0?o.jsx("option",{value:""}):null,Array.from(R)]},P):null]})})};Exe.displayName=lg;var Axe="SelectTrigger",Txe=b.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...i}=t,s=qP(n),a=ap(Axe,n),l=a.disabled||r,c=Pn(e,a.onTriggerChange),u=GP(n),d=b.useRef("touch"),[f,h,p]=eye(x=>{const y=u().filter(v=>!v.disabled),g=y.find(v=>v.value===a.value),w=tye(y,x,g);w!==void 0&&a.onValueChange(w.value)}),m=x=>{l||(a.onOpenChange(!0),p()),x&&(a.triggerPointerDownPosRef.current={x:Math.round(x.pageX),y:Math.round(x.pageY)})};return o.jsx(T0,{asChild:!0,...s,children:o.jsx($o.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:l,"data-disabled":l?"":void 0,"data-placeholder":Zxe(a.value)?"":void 0,...i,ref:c,onClick:at(i.onClick,x=>{x.currentTarget.focus(),d.current!=="mouse"&&m(x)}),onPointerDown:at(i.onPointerDown,x=>{d.current=x.pointerType;const y=x.target;y.hasPointerCapture(x.pointerId)&&y.releasePointerCapture(x.pointerId),x.button===0&&x.ctrlKey===!1&&x.pointerType==="mouse"&&(m(x),x.preventDefault())}),onKeyDown:at(i.onKeyDown,x=>{const y=f.current!=="";!(x.ctrlKey||x.altKey||x.metaKey)&&x.key.length===1&&h(x.key),!(y&&x.key===" ")&&cTt.includes(x.key)&&(m(),x.preventDefault())})})})});Txe.displayName=Axe;var Mxe="SelectValue",Pxe=b.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:i,children:s,placeholder:a="",...l}=t,c=ap(Mxe,n),{onValueNodeHasChildrenChange:u}=c,d=s!==void 0,f=Pn(e,c.onValueNodeChange);return ts(()=>{u(d)},[u,d]),o.jsx($o.span,{...l,ref:f,style:{pointerEvents:"none"},children:Zxe(c.value)?o.jsx(o.Fragment,{children:a}):s})});Pxe.displayName=Mxe;var mTt="SelectIcon",Oxe=b.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...i}=t;return o.jsx($o.span,{"aria-hidden":!0,...i,ref:e,children:r||"▼"})});Oxe.displayName=mTt;var gTt="SelectPortal",Rxe=t=>o.jsx(Sg,{asChild:!0,...t});Rxe.displayName=gTt;var cg="SelectContent",Ixe=b.forwardRef((t,e)=>{const n=ap(cg,t.__scopeSelect),[r,i]=b.useState();if(ts(()=>{i(new DocumentFragment)},[]),!n.open){const s=r;return s?wl.createPortal(o.jsx(Dxe,{scope:t.__scopeSelect,children:o.jsx(WP.Slot,{scope:t.__scopeSelect,children:o.jsx("div",{children:t.children})})}),s):null}return o.jsx(Lxe,{...t,ref:e})});Ixe.displayName=cg;var Rl=10,[Dxe,op]=Q0(cg),xTt="SelectContentImpl",yTt=kxe("SelectContent.RemoveScroll"),Lxe=b.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:s,onPointerDownOutside:a,side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:m,hideWhenDetached:x,avoidCollisions:y,...g}=t,w=ap(cg,n),[v,N]=b.useState(null),[S,_]=b.useState(null),j=Pn(e,K=>N(K)),[A,C]=b.useState(null),[k,M]=b.useState(null),I=GP(n),[R,E]=b.useState(!1),P=b.useRef(!1);b.useEffect(()=>{if(v)return jT(v)},[v]),ST();const O=b.useCallback(K=>{const[ee,...V]=I().map($=>$.ref.current),[J]=V.slice(-1),Y=document.activeElement;for(const $ of K)if($===Y||($==null||$.scrollIntoView({block:"nearest"}),$===ee&&S&&(S.scrollTop=0),$===J&&S&&(S.scrollTop=S.scrollHeight),$==null||$.focus(),document.activeElement!==Y))return},[I,S]),L=b.useCallback(()=>O([A,v]),[O,A,v]);b.useEffect(()=>{R&&L()},[R,L]);const{onOpenChange:T,triggerPointerDownPosRef:D}=w;b.useEffect(()=>{if(v){let K={x:0,y:0};const ee=J=>{var Y,$;K={x:Math.abs(Math.round(J.pageX)-(((Y=D.current)==null?void 0:Y.x)??0)),y:Math.abs(Math.round(J.pageY)-((($=D.current)==null?void 0:$.y)??0))}},V=J=>{K.x<=10&&K.y<=10?J.preventDefault():v.contains(J.target)||T(!1),document.removeEventListener("pointermove",ee),D.current=null};return D.current!==null&&(document.addEventListener("pointermove",ee),document.addEventListener("pointerup",V,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ee),document.removeEventListener("pointerup",V,{capture:!0})}}},[v,T,D]),b.useEffect(()=>{const K=()=>T(!1);return window.addEventListener("blur",K),window.addEventListener("resize",K),()=>{window.removeEventListener("blur",K),window.removeEventListener("resize",K)}},[T]);const[F,q]=eye(K=>{const ee=I().filter(Y=>!Y.disabled),V=ee.find(Y=>Y.ref.current===document.activeElement),J=tye(ee,K,V);J&&setTimeout(()=>J.ref.current.focus())}),B=b.useCallback((K,ee,V)=>{const J=!P.current&&!V;(w.value!==void 0&&w.value===ee||J)&&(C(K),J&&(P.current=!0))},[w.value]),z=b.useCallback(()=>v==null?void 0:v.focus(),[v]),H=b.useCallback((K,ee,V)=>{const J=!P.current&&!V;(w.value!==void 0&&w.value===ee||J)&&M(K)},[w.value]),W=r==="popper"?lF:$xe,G=W===lF?{side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:m,hideWhenDetached:x,avoidCollisions:y}:{};return o.jsx(Dxe,{scope:n,content:v,viewport:S,onViewportChange:_,itemRefCallback:B,selectedItem:A,onItemLeave:z,itemTextRefCallback:H,focusSelectedItem:L,selectedItemText:k,position:r,isPositioned:R,searchRef:F,children:o.jsx(kS,{as:yTt,allowPinchZoom:!0,children:o.jsx(jS,{asChild:!0,trapped:w.open,onMountAutoFocus:K=>{K.preventDefault()},onUnmountAutoFocus:at(i,K=>{var ee;(ee=w.trigger)==null||ee.focus({preventScroll:!0}),K.preventDefault()}),children:o.jsx(_g,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:K=>K.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:o.jsx(W,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:K=>K.preventDefault(),...g,...G,onPlaced:()=>E(!0),ref:j,style:{display:"flex",flexDirection:"column",outline:"none",...g.style},onKeyDown:at(g.onKeyDown,K=>{const ee=K.ctrlKey||K.altKey||K.metaKey;if(K.key==="Tab"&&K.preventDefault(),!ee&&K.key.length===1&&q(K.key),["ArrowUp","ArrowDown","Home","End"].includes(K.key)){let J=I().filter(Y=>!Y.disabled).map(Y=>Y.ref.current);if(["ArrowUp","End"].includes(K.key)&&(J=J.slice().reverse()),["ArrowUp","ArrowDown"].includes(K.key)){const Y=K.target,$=J.indexOf(Y);J=J.slice($+1)}setTimeout(()=>O(J)),K.preventDefault()}})})})})})})});Lxe.displayName=xTt;var vTt="SelectItemAlignedPosition",$xe=b.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...i}=t,s=ap(cg,n),a=op(cg,n),[l,c]=b.useState(null),[u,d]=b.useState(null),f=Pn(e,j=>d(j)),h=GP(n),p=b.useRef(!1),m=b.useRef(!0),{viewport:x,selectedItem:y,selectedItemText:g,focusSelectedItem:w}=a,v=b.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&u&&x&&y&&g){const j=s.trigger.getBoundingClientRect(),A=u.getBoundingClientRect(),C=s.valueNode.getBoundingClientRect(),k=g.getBoundingClientRect();if(s.dir!=="rtl"){const Y=k.left-A.left,$=C.left-Y,fe=j.left-$,ce=j.width+fe,ve=Math.max(ce,A.width),X=window.innerWidth-Rl,de=eZ($,[Rl,Math.max(Rl,X-ve)]);l.style.minWidth=ce+"px",l.style.left=de+"px"}else{const Y=A.right-k.right,$=window.innerWidth-C.right-Y,fe=window.innerWidth-j.right-$,ce=j.width+fe,ve=Math.max(ce,A.width),X=window.innerWidth-Rl,de=eZ($,[Rl,Math.max(Rl,X-ve)]);l.style.minWidth=ce+"px",l.style.right=de+"px"}const M=h(),I=window.innerHeight-Rl*2,R=x.scrollHeight,E=window.getComputedStyle(u),P=parseInt(E.borderTopWidth,10),O=parseInt(E.paddingTop,10),L=parseInt(E.borderBottomWidth,10),T=parseInt(E.paddingBottom,10),D=P+O+R+T+L,F=Math.min(y.offsetHeight*5,D),q=window.getComputedStyle(x),B=parseInt(q.paddingTop,10),z=parseInt(q.paddingBottom,10),H=j.top+j.height/2-Rl,W=I-H,G=y.offsetHeight/2,K=y.offsetTop+G,ee=P+O+K,V=D-ee;if(ee<=H){const Y=M.length>0&&y===M[M.length-1].ref.current;l.style.bottom="0px";const $=u.clientHeight-x.offsetTop-x.offsetHeight,fe=Math.max(W,G+(Y?z:0)+$+L),ce=ee+fe;l.style.height=ce+"px"}else{const Y=M.length>0&&y===M[0].ref.current;l.style.top="0px";const fe=Math.max(H,P+x.offsetTop+(Y?B:0)+G)+V;l.style.height=fe+"px",x.scrollTop=ee-H+x.offsetTop}l.style.margin=`${Rl}px 0`,l.style.minHeight=F+"px",l.style.maxHeight=I+"px",r==null||r(),requestAnimationFrame(()=>p.current=!0)}},[h,s.trigger,s.valueNode,l,u,x,y,g,s.dir,r]);ts(()=>v(),[v]);const[N,S]=b.useState();ts(()=>{u&&S(window.getComputedStyle(u).zIndex)},[u]);const _=b.useCallback(j=>{j&&m.current===!0&&(v(),w==null||w(),m.current=!1)},[v,w]);return o.jsx(wTt,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:p,onScrollButtonChange:_,children:o.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:N},children:o.jsx($o.div,{...i,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});$xe.displayName=vTt;var bTt="SelectPopperPosition",lF=b.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:i=Rl,...s}=t,a=qP(n);return o.jsx(MS,{...a,...s,ref:e,align:r,collisionPadding:i,style:{boxSizing:"border-box",...s.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)"}})});lF.displayName=bTt;var[wTt,q8]=Q0(cg,{}),cF="SelectViewport",Fxe=b.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...i}=t,s=op(cF,n),a=q8(cF,n),l=Pn(e,s.onViewportChange),c=b.useRef(0);return o.jsxs(o.Fragment,{children:[o.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}),o.jsx(WP.Slot,{scope:n,children:o.jsx($o.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:at(i.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:h}=a;if(h!=null&&h.current&&f){const p=Math.abs(c.current-d.scrollTop);if(p>0){const m=window.innerHeight-Rl*2,x=parseFloat(f.style.minHeight),y=parseFloat(f.style.height),g=Math.max(x,y);if(g<m){const w=g+p,v=Math.min(m,w),N=w-v;f.style.height=v+"px",f.style.bottom==="0px"&&(d.scrollTop=N>0?N:0,f.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});Fxe.displayName=cF;var Uxe="SelectGroup",[_Tt,STt]=Q0(Uxe),NTt=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=ys();return o.jsx(_Tt,{scope:n,id:i,children:o.jsx($o.div,{role:"group","aria-labelledby":i,...r,ref:e})})});NTt.displayName=Uxe;var zxe="SelectLabel",Bxe=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=STt(zxe,n);return o.jsx($o.div,{id:i.id,...r,ref:e})});Bxe.displayName=zxe;var KE="SelectItem",[jTt,Vxe]=Q0(KE),Hxe=b.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:i=!1,textValue:s,...a}=t,l=ap(KE,n),c=op(KE,n),u=l.value===r,[d,f]=b.useState(s??""),[h,p]=b.useState(!1),m=Pn(e,w=>{var v;return(v=c.itemRefCallback)==null?void 0:v.call(c,w,r,i)}),x=ys(),y=b.useRef("touch"),g=()=>{i||(l.onValueChange(r),l.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 o.jsx(jTt,{scope:n,value:r,disabled:i,textId:x,isSelected:u,onItemTextChange:b.useCallback(w=>{f(v=>v||((w==null?void 0:w.textContent)??"").trim())},[]),children:o.jsx(WP.ItemSlot,{scope:n,value:r,disabled:i,textValue:d,children:o.jsx($o.div,{role:"option","aria-labelledby":x,"data-highlighted":h?"":void 0,"aria-selected":u&&h,"data-state":u?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...a,ref:m,onFocus:at(a.onFocus,()=>p(!0)),onBlur:at(a.onBlur,()=>p(!1)),onClick:at(a.onClick,()=>{y.current!=="mouse"&&g()}),onPointerUp:at(a.onPointerUp,()=>{y.current==="mouse"&&g()}),onPointerDown:at(a.onPointerDown,w=>{y.current=w.pointerType}),onPointerMove:at(a.onPointerMove,w=>{var v;y.current=w.pointerType,i?(v=c.onItemLeave)==null||v.call(c):y.current==="mouse"&&w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:at(a.onPointerLeave,w=>{var v;w.currentTarget===document.activeElement&&((v=c.onItemLeave)==null||v.call(c))}),onKeyDown:at(a.onKeyDown,w=>{var N;((N=c.searchRef)==null?void 0:N.current)!==""&&w.key===" "||(uTt.includes(w.key)&&g(),w.key===" "&&w.preventDefault())})})})})});Hxe.displayName=KE;var bw="SelectItemText",Wxe=b.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:i,...s}=t,a=ap(bw,n),l=op(bw,n),c=Vxe(bw,n),u=pTt(bw,n),[d,f]=b.useState(null),h=Pn(e,g=>f(g),c.onItemTextChange,g=>{var w;return(w=l.itemTextRefCallback)==null?void 0:w.call(l,g,c.value,c.disabled)}),p=d==null?void 0:d.textContent,m=b.useMemo(()=>o.jsx("option",{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:x,onNativeOptionRemove:y}=u;return ts(()=>(x(m),()=>y(m)),[x,y,m]),o.jsxs(o.Fragment,{children:[o.jsx($o.span,{id:c.textId,...s,ref:h}),c.isSelected&&a.valueNode&&!a.valueNodeHasChildren?wl.createPortal(s.children,a.valueNode):null]})});Wxe.displayName=bw;var Gxe="SelectItemIndicator",qxe=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return Vxe(Gxe,n).isSelected?o.jsx($o.span,{"aria-hidden":!0,...r,ref:e}):null});qxe.displayName=Gxe;var uF="SelectScrollUpButton",Kxe=b.forwardRef((t,e)=>{const n=op(uF,t.__scopeSelect),r=q8(uF,t.__scopeSelect),[i,s]=b.useState(!1),a=Pn(e,r.onScrollButtonChange);return ts(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollTop>0;s(u)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),i?o.jsx(Xxe,{...t,ref:a,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});Kxe.displayName=uF;var dF="SelectScrollDownButton",Yxe=b.forwardRef((t,e)=>{const n=op(dF,t.__scopeSelect),r=q8(dF,t.__scopeSelect),[i,s]=b.useState(!1),a=Pn(e,r.onScrollButtonChange);return ts(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)<u;s(d)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),i?o.jsx(Xxe,{...t,ref:a,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});Yxe.displayName=dF;var Xxe=b.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...i}=t,s=op("SelectScrollButton",n),a=b.useRef(null),l=GP(n),c=b.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return b.useEffect(()=>()=>c(),[c]),ts(()=>{var d;const u=l().find(f=>f.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[l]),o.jsx($o.div,{"aria-hidden":!0,...i,ref:e,style:{flexShrink:0,...i.style},onPointerDown:at(i.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(r,50))}),onPointerMove:at(i.onPointerMove,()=>{var u;(u=s.onItemLeave)==null||u.call(s),a.current===null&&(a.current=window.setInterval(r,50))}),onPointerLeave:at(i.onPointerLeave,()=>{c()})})}),CTt="SelectSeparator",Qxe=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return o.jsx($o.div,{"aria-hidden":!0,...r,ref:e})});Qxe.displayName=CTt;var fF="SelectArrow",kTt=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=qP(n),s=ap(fF,n),a=op(fF,n);return s.open&&a.position==="popper"?o.jsx(PS,{...i,...r,ref:e}):null});kTt.displayName=fF;var ETt="SelectBubbleInput",Jxe=b.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const i=b.useRef(null),s=Pn(r,i),a=Moe(e);return b.useEffect(()=>{const l=i.current;if(!l)return;const c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(a!==e&&d){const f=new Event("change",{bubbles:!0});d.call(l,e),l.dispatchEvent(f)}},[a,e]),o.jsx($o.select,{...n,style:{...Boe,...n.style},ref:s,defaultValue:e})});Jxe.displayName=ETt;function Zxe(t){return t===""||t===void 0}function eye(t){const e=dc(t),n=b.useRef(""),r=b.useRef(0),i=b.useCallback(a=>{const l=n.current+a;e(l),function c(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>c(""),1e3))}(l)},[e]),s=b.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return b.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,s]}function tye(t,e,n){const i=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,s=n?t.indexOf(n):-1;let a=ATt(t,Math.max(s,0));i.length===1&&(a=a.filter(u=>u!==n));const c=a.find(u=>u.textValue.toLowerCase().startsWith(i.toLowerCase()));return c!==n?c:void 0}function ATt(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var TTt=Exe,nye=Txe,MTt=Pxe,PTt=Oxe,OTt=Rxe,rye=Ixe,RTt=Fxe,iye=Bxe,sye=Hxe,ITt=Wxe,DTt=qxe,aye=Kxe,oye=Yxe,lye=Qxe;
4949const Tr=TTt,Vr=MTt,yr=b.forwardRef(({className:t,children:e,...n},r)=>o.jsxs(nye,{ref:r,className:ne("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,o.jsx(PTt,{asChild:!0,children:o.jsx(ms,{className:"h-4 w-4 opacity-50"})})]}));yr.displayName=nye.displayName;const cye=b.forwardRef(({className:t,...e},n)=>o.jsx(aye,{ref:n,className:ne("flex cursor-default items-center justify-center py-1",t),...e,children:o.jsx(Kc,{className:"h-4 w-4"})}));cye.displayName=aye.displayName;const uye=b.forwardRef(({className:t,...e},n)=>o.jsx(oye,{ref:n,className:ne("flex cursor-default items-center justify-center py-1",t),...e,children:o.jsx(ms,{className:"h-4 w-4"})}));uye.displayName=oye.displayName;const vr=b.forwardRef(({className:t,children:e,position:n="popper",...r},i)=>o.jsx(OTt,{children:o.jsxs(rye,{ref:i,className:ne("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",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...r,children:[o.jsx(cye,{}),o.jsx(RTt,{className:ne("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),o.jsx(uye,{})]})}));vr.displayName=rye.displayName;const LTt=b.forwardRef(({className:t,...e},n)=>o.jsx(iye,{ref:n,className:ne("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...e}));LTt.displayName=iye.displayName;const Ht=b.forwardRef(({className:t,children:e,...n},r)=>o.jsxs(sye,{ref:r,className:ne("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[o.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(DTt,{children:o.jsx(Sn,{className:"h-4 w-4"})})}),o.jsx(ITt,{children:e})]}));Ht.displayName=sye.displayName;const $Tt=b.forwardRef(({className:t,...e},n)=>o.jsx(lye,{ref:n,className:ne("-mx-1 my-1 h-px bg-muted",t),...e}));$Tt.displayName=lye.displayName;function tZ({currentPage:t,totalItems:e,pageSize:n,onPageChange:r,onPageSizeChange:i,pageSizeOptions:s=[10,25,50],showPageSizeSelector:a=!0,className:l}){const c=Math.ceil(e/n),u=e===0?0:(t-1)*n+1,d=Math.min(t*n,e),f=t>1,h=t<c,p=()=>{const m=[];if(c<=7)for(let x=1;x<=c;x++)m.push(x);else{m.push(1),t>3&&m.push("ellipsis");const x=Math.max(2,t-1),y=Math.min(c-1,t+1);for(let g=x;g<=y;g++)m.push(g);t<c-2&&m.push("ellipsis"),c>1&&m.push(c)}return m};return e===0?null:o.jsxs("div",{className:ne("flex items-center gap-4",a?"justify-between":"justify-end",l),children:[a&&i&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:"Show per page"}),o.jsxs(Tr,{value:String(n),onValueChange:m=>i(Number(m)),children:[o.jsx(yr,{className:"w-[70px] h-8",children:o.jsx(Vr,{})}),o.jsx(vr,{children:s.map(m=>o.jsx(Ht,{value:String(m),children:m},m))})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:[u,"-",d," of ",e]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(le,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>r(t-1),disabled:!f,children:o.jsx(wd,{className:"h-4 w-4"})}),c<=7?p().map((m,x)=>m==="ellipsis"?o.jsx("span",{className:"px-2 text-muted-foreground",children:"..."},`ellipsis-${x}`):o.jsx(le,{variant:m===t?"default":"outline",size:"icon",className:"h-8 w-8",onClick:()=>r(m),children:m},m)):p().map((m,x)=>m==="ellipsis"?o.jsx("span",{className:"px-1 text-muted-foreground text-sm",children:"..."},`ellipsis-${x}`):o.jsx(le,{variant:m===t?"default":"ghost",size:"sm",className:"h-8 min-w-[32px] px-2",onClick:()=>r(m),children:m},m)),o.jsx(le,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>r(t+1),disabled:!h,children:o.jsx(Ga,{className:"h-4 w-4"})})]})]})]})}
4949const FTt={light:"",dark:".dark"},dye=b.createContext(null);function fye(){const t=b.useContext(dye);if(!t)throw new Error("useChart must be used within a <ChartContainer />");return t}const hye=b.forwardRef(({id:t,className:e,children:n,config:r,...i},s)=>{const a=b.useId(),l=`chart-${t||a.replace(/:/g,"")}`;return o.jsx(dye.Provider,{value:{config:r},children:o.jsxs("div",{"data-chart":l,ref:s,className:ne("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",e),...i,children:[o.jsx(UTt,{id:l,config:r}),o.jsx(Qi,{children:n})]})})});hye.displayName="Chart";const UTt=({id:t,config:e})=>{const n=Object.entries(e).filter(([,r])=>r.theme||r.color);return n.length?o.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(FTt).map(([r,i])=>`
4950${i} [data-chart=${t}] {
4951${n.map(([s,a])=>{var c;const l=((c=a.theme)==null?void 0:c[r])||a.color;return l?`  --color-${s}: ${l};`:null}).join(`
4952`)}
4953}
4954`).join(`
4955`)}}):null},zTt=Bn,pye=b.forwardRef(({active:t,payload:e,className:n,indicator:r="dot",hideLabel:i=!1,hideIndicator:s=!1,label:a,labelFormatter:l,labelClassName:c,formatter:u,color:d,nameKey:f,labelKey:h},p)=>{const{config:m}=fye(),x=b.useMemo(()=>{var S;if(i||!(e!=null&&e.length))return null;const[g]=e,w=`${h||g.dataKey||g.name||"value"}`,v=hF(m,g,w),N=!h&&typeof a=="string"?((S=m[a])==null?void 0:S.label)||a:v==null?void 0:v.label;return l?o.jsx("div",{className:ne("font-medium",c),children:l(N,e)}):N?o.jsx("div",{className:ne("font-medium",c),children:N}):null},[a,l,e,i,c,m,h]);if(!t||!(e!=null&&e.length))return null;const y=e.length===1&&r!=="dot";return o.jsxs("div",{ref:p,className:ne("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",n),children:[y?null:x,o.jsx("div",{className:"grid gap-1.5",children:e.map((g,w)=>{var _;const v=`${f||g.name||g.dataKey||"value"}`,N=hF(m,g,v),S=d||g.color||((_=g.payload)==null?void 0:_.fill);return o.jsx("div",{className:ne("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",r==="dot"&&"items-center"),children:u&&(g==null?void 0:g.value)!==void 0&&g.name?u(g.value,g.name,g,w,g.payload):o.jsxs(o.Fragment,{children:[N!=null&&N.icon?o.jsx(N.icon,{}):!s&&o.jsx("div",{className:ne("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":r==="dot","w-1":r==="line","w-0 border-[1.5px] border-dashed bg-transparent":r==="dashed","my-0.5":y&&r==="dashed"}),style:{"--color-bg":S,"--color-border":S}}),o.jsxs("div",{className:ne("flex flex-1 justify-between leading-none",y?"items-end":"items-center"),children:[o.jsxs("div",{className:"grid gap-1.5",children:[y?x:null,o.jsx("span",{className:"text-muted-foreground",children:(N==null?void 0:N.label)||g.name})]}),g.value&&o.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:g.value.toLocaleString()})]})]})},g.dataKey)})})]})});pye.displayName="ChartTooltip";const BTt=cd,mye=b.forwardRef(({className:t,hideIcon:e=!1,payload:n,verticalAlign:r="bottom",nameKey:i},s)=>{const{config:a}=fye();return n!=null&&n.length?o.jsx("div",{ref:s,className:ne("flex items-center justify-center gap-4",r==="top"?"pb-3":"pt-3",t),children:n.map(l=>{const c=`${i||l.dataKey||"value"}`,u=hF(a,l,c);return o.jsxs("div",{className:ne("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[u!=null&&u.icon&&!e?o.jsx(u.icon,{}):o.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:l.color}}),u==null?void 0:u.label]},l.value)})}):null});mye.displayName="ChartLegend";function hF(t,e,n){if(typeof e!="object"||e===null)return;const r="payload"in e&&typeof e.payload=="object"&&e.payload!==null?e.payload:void 0;let i=n;return n in e&&typeof e[n]=="string"?i=e[n]:r&&n in r&&typeof r[n]=="string"&&(i=r[n]),i in t?t[i]:t[n]}const j3=["brand","comp1","comp2","comp3","comp4","comp5","comp6","comp7","comp8","comp9"];function VTt(){const{companyId:t,queryId:e}=Gr(),n=Nr(),{companies:r}=Ri(),i=r.find(me=>me.id===t),s=(i==null?void 0:i.brandName)||"Your Brand",[a,l]=b.useState(null),[c,u]=b.useState([]),[d,f]=b.useState([]),[h,p]=b.useState(!0),[m,x]=b.useState("all"),[y,g]=b.useState("leaderboard"),w=Ig(),[v,N]=b.useState("visibility"),[S,_]=b.useState("desc"),[j,A]=b.useState(1),C=7,[k,M]=b.useState(1),[I,R]=b.useState(10),[E,P]=b.useState(!1),[O,L]=b.useState(1),T=10,[D,F]=b.useState(!1),q=()=>{const me=window.innerWidth>=1024,Fe=!E;P(Fe),me&&F(Fe)},B=()=>{const me=window.innerWidth>=1024,Fe=!D;F(Fe),me&&P(Fe)},{lastRankingUpdate:z,lastUpdateTimestamp:H}=V1(),W=b.useRef(!0),{competitorInfoMap:G,aliasToMainMap:K}=b.useMemo(()=>{const me=new Map,Fe=new Map;for(const He of d)if(me.set(He.name.toLowerCase(),{id:He.id,name:He.name,website:He.website,faviconUrl:He.faviconUrl||He.logoUrl,
4955source:He.source,description:He.description,isFavorite:He.isFavorite??!1}),He.aliases)for(const Ye of He.aliases)Fe.set(Ye.name.toLowerCase(),He.name),me.set(Ye.name.toLowerCase(),{id:He.id,name:He.name,website:He.website,faviconUrl:He.faviconUrl||He.logoUrl,source:He.source,description:He.description,isFavorite:He.isFavorite??!1});return{competitorInfoMap:me,aliasToMainMap:Fe}},[d]),ee=me=>G.get(me.toLowerCase())||{id:null,name:me,website:null,faviconUrl:null,source:void 0,description:null,isFavorite:!1},V=me=>K.get(me.toLowerCase())||me;b.useEffect(()=>{t&&e&&J()},[t,e]),b.useEffect(()=>{if(W.current){W.current=!1;return}(z==null?void 0:z.queryId)===e&&H>0&&J(!0)},[H,e]);const J=async(me=!1)=>{try{me||p(!0);const[Fe,He,Ye]=await Promise.all([Ce.get(`/companies/${t}/queries/${e}`),Ce.get(`/companies/${t}/queries/${e}/rankings`),Ce.get(`/companies/${t}/competitors`)]);l(Fe),u(He),f(Ye)}catch(Fe){me||ge.error(Fe.message||"Failed to load query details")}finally{me||p(!1)}},Y=async()=>{if(!(!a||!t))try{await Ce.patch(`/companies/${t}/queries/${e}`,{isActive:!a.isActive}),l({...a,isActive:!a.isActive}),ge.success(`Query ${a.isActive?"paused":"activated"}`)}catch(me){ge.error(me.message||"Failed to update query")}},$=async()=>{if(!(!a||!t))try{await Ce.patch(`/companies/${t}/queries/${e}`,{dynamicRuns:!a.dynamicRuns}),l({...a,dynamicRuns:!a.dynamicRuns}),ge.success(`Dynamic runs ${a.dynamicRuns?"disabled":"enabled"}`)}catch(me){ge.error(me.message||"Failed to update query settings")}},fe=async(me,Fe,He)=>{He.stopPropagation();const Ye=!Fe;f(d.map(Nt=>Nt.id===me?{...Nt,isFavorite:Ye}:Nt));try{await Ce.patch(`/companies/${t}/competitors/${me}`,{isFavorite:Ye}),ge.success(Ye?"Added to favorites":"Removed from favorites")}catch(Nt){f(d.map(qt=>qt.id===me?{...qt,isFavorite:!Ye}:qt)),ge.error(Nt.message||"Failed to update favorite")}},[ce,ve]=b.useState(!1),[X,de]=b.useState(!1),[Te,Pe]=b.useState(!1),[se,U]=b.useState(""),[Q,oe]=b.useState(!1),_e=Jk(me=>me.getQueryStatus(e||"")),ye=_e==="started"||_e==="analyzing",[re,he]=b.useState(null);b.useEffect(()=>{(async()=>{if(t)try{const Fe=await Ce.get(`/companies/${t}/llms`);he(Fe.limits.current)}catch{he(0)}})()},[t]);const pe=async()=>{if(!(!a||!t||ce)){ve(!0),de(!1);try{const me=await Ce.post(`/companies/${t}/queries/${e}/manual-run`);ge.success(`Manual run started! ${me.tokenCost} tokens used for ${me.llmCount} LLMs.`)}catch(me){ge.error(me.message||"Failed to start manual run")}finally{ve(!1)}}},je=()=>{a&&(U(a.promptText),Pe(!0))},ae=()=>{Pe(!1),U("")},we=async()=>{if(!a||!t||!se.trim())return;const me=se.trim();if(me===a.promptText){ae();return}oe(!0);try{await Ce.patch(`/companies/${t}/queries/${e}`,{promptText:me}),l({...a,promptText:me}),Pe(!1),U(""),ge.success("Prompt updated successfully")}catch(Fe){ge.error(Fe.message||"Failed to update prompt")}finally{oe(!1)}},Ie=()=>{const me=new Set;return c.filter(Fe=>me.has(Fe.llmProviderId)?!1:(me.add(Fe.llmProviderId),!0)).map(Fe=>Fe.llmProvider)},Ue=b.useMemo(()=>{const me=m==="all"?c:c.filter(ke=>ke.llmProviderId===m),Fe=s.toLowerCase(),He=new Map;for(const ke of me)for(const Ee of ke.competitorsMentioned){if(Ee.rankPosition===null||Ee.rankPosition===void 0)continue;const Ae=Ee.normalizedName||Ee.name,qe=V(Ae);qe.toLowerCase()!==Fe&&He.set(qe,(He.get(qe)||0)+1)}const Ye=Array.from(He.entries()).sort((ke,Ee)=>Ee[1]-ke[1]).slice(0,9).map(([ke])=>ke),Nt=[s,...Ye],qt={},Jt={};Nt.forEach((ke,Ee)=>{const Ae=j3[Ee];qt[ke]=Ae,Jt[Ae]=ke});const ea=[...me].sort((ke,Ee)=>new Date(ke.createdAt).getTime()-new Date(Ee.createdAt).getTime()),hn=[];let sn=[],Jn=null;for(const ke of ea){const Ee=new Date(ke.createdAt).getTime();Jn===null||Ee-Jn>5*60*1e3?(sn.length>0&&hn.push({timestamp:sn[0].createdAt,rankings:sn}),sn=[ke],Jn=Ee):sn.push(ke)}sn.length>0&&hn.push({timestamp:sn[0].createdAt,rankings:sn});const sr=Date.now()+24*60*60*1e3,Cs=hn.filter(ke=>new Date(ke.timestamp).getTime()<=sr).slice(-7).map(ke=>{const Ee=new Date(ke.timestamp),Ae=Ee.toLocaleDateString("en-US",{month:"short",day:"numeric"}),qe=Ee.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit"}),st={date:`${Ae} ${qe}`,timestamp:ke.timestamp},it=new Map;for(const lt of ke.rankings){const ht=qt[s];ht&&lt.isMentioned&&lt.rankPosition!==null&&(it.has(ht)||it.set(ht,[]),it.get(ht).push(lt.rankPosition));for(const At of lt.competitorsMentioned){const pt=At.normalizedName||At.name,xn=V(pt);if(xn.toLowerCase()===Fe||!Ye.includes(xn))continue;const Fn=qt[xn];Fn&&At.rankPosition!==null&&At.rankPosition!==void 0&&(it.has(Fn)||it.set(Fn,[]),it.get(Fn).push(At.rankPosition))}}for(const[lt,ht]of it)if(ht.length>0){const At=ht.reduce((pt,xn)=>pt+xn,0)/ht.length;st[lt]=Math.round(At*10)/10}return st}),en={},Z=[];Nt.forEach((ke,Ee)=>{const Ae=j3[Ee];en[Ae]={label:ke,color:`var(--chart-${Ee+1})`};const qe=Ee===0;let st=null;qe?st=null:st=ee(ke).faviconUrl;const it={1:"hsl(var(--chart-1))",2:"hsl(var(--chart-2))",3:"hsl(var(--chart-3))",4:"hsl(var(--chart-4))",5:"hsl(var(--chart-5))"};Z.push({key:Ae,name:ke,faviconUrl:st,color:it[Ee+1]||"hsl(var(--primary))"})});const Se=j3.slice(0,Nt.length);return{chartData:Cs,chartKeys:Se,chartConfig:en,keyToEntity:Jt,entityToKey:qt,chartEntities:Z}},[c,m,s,V,ee]),Oe=()=>{const me=new Map;for(const He of c)for(const Ye of He.competitorsMentioned){const Nt=Ye.normalizedName||Ye.name,qt=V(Nt),Jt=me.get(qt)||{name:qt,totalMentions:0,avgRank:null,avgSentiment:null,recommendedCount:0,rankSum:0,rankCount:0,sentimentSum:0,sentimentCount:0};Jt.totalMentions++,Ye.rankPosition!==void 0&&Ye.rankPosition!==null&&(Jt.rankSum+=Ye.rankPosition,Jt.rankCount++),Ye.sentimentScore!==void 0&&(Jt.sentimentSum+=Ye.sentimentScore,Jt.sentimentCount++),Ye.isRecommended&&Jt.recommendedCount++,me.set(qt,Jt)}return Array.from(me.values()).map(He=>({...He,avgRank:He.rankCount>0?Math.round(He.rankSum/He.rankCount*10)/10:null,avgSentiment:He.sentimentCount>0?Math.round(He.sentimentSum/He.sentimentCount):null,visibility:Math.round(He.totalMentions/c.length*100)})).sort((He,Ye)=>Ye.totalMentions-He.totalMentions)},ie=()=>{if(c.length===0)return null;const me=new Map;
4955for(const Z of c){const Se=me.get(Z.llmProviderId);(!Se||new Date(Z.createdAt)>new Date(Se.createdAt))&&me.set(Z.llmProviderId,Z)}const Fe=Array.from(me.values()),He=Fe.filter(Z=>Z.isMentioned),Ye=Math.round(He.length/Fe.length*100),Nt=He.filter(Z=>Z.rankPosition!==null),qt=Nt.length>0?Math.round(Nt.reduce((Z,Se)=>Z+(Se.rankPosition||0),0)/Nt.length*10)/10:null,Jt=He.filter(Z=>Z.sentimentScore!==null),ea=Jt.length>0?Math.round(Jt.reduce((Z,Se)=>Z+(Se.sentimentScore||0),0)/Jt.length):null,hn=c.reduce((Z,Se)=>Z+Se.sourceCount,0),sn=new Map;for(const Z of c){const Se=new Date(Z.createdAt).toISOString().split("T")[0];let ke=sn.get(Se);ke||(ke={rank:[],runs:0,sources:0},sn.set(Se,ke)),ke.runs++,ke.sources+=Z.sourceCount||0,Z.isMentioned&&Z.rankPosition!==null&&ke.rank.push(Z.rankPosition)}const Jn=Array.from(sn.entries()).sort((Z,Se)=>Z[0].localeCompare(Se[0])).slice(-30),sr=(Z,Se)=>[...Array(Math.max(0,Se-Z.length)).fill({value:0}),...Z],ar=sr(Jn.map(([,Z])=>({value:Z.rank.length>0?Z.rank.reduce((Se,ke)=>Se+ke,0)/Z.rank.length:null})),30),as=sr(Jn.map(([,Z])=>({value:Z.runs})),30),Cs=sr(Jn.map(([,Z])=>({value:Z.sources})),30),en=Z=>{const Se=Z.filter(it=>it.value!==null).map(it=>it.value);if(Se.length<2)return null;const ke=Math.floor(Se.length/2),Ee=Se.slice(0,ke),Ae=Se.slice(ke),qe=Ee.reduce((it,lt)=>it+lt,0)/Ee.length,st=Ae.reduce((it,lt)=>it+lt,0)/Ae.length;return qe===0?null:Math.round((st-qe)/qe*100)};return{totalRuns:c.length,mentionRate:Ye,avgRank:qt,avgSentiment:ea,llmCount:Fe.length,sourcesCount:hn,rankHistory:ar,runsHistory:as,sourcesHistory:Cs,rankTrend:en(ar),runsTrend:en(as),sourcesTrend:en(Cs)}},De=Ie(),Ve=ie(),xe=Oe(),{chartData:$e,chartKeys:ue,chartConfig:Ne,chartEntities:Le}=Ue,tt=b.useMemo(()=>Le.map((me,Fe)=>({...me,faviconUrl:Fe===0?(i==null?void 0:i.logoUrl)||null:me.faviconUrl})),[Le,i==null?void 0:i.logoUrl]),St=me=>{v===me?_(S==="asc"?"desc":"asc"):(N(me),_(me==="avgRank"?"asc":"desc"))},rt=me=>v===me&&S==="asc"?Kc:ms,vt=b.useMemo(()=>[...xe].sort((me,Fe)=>{let He=0;switch(v){case"name":He=me.name.localeCompare(Fe.name);break;case"visibility":He=me.visibility-Fe.visibility;break;case"totalMentions":He=me.totalMentions-Fe.totalMentions;break;case"avgRank":const Ye=me.avgRank??1/0,Nt=Fe.avgRank??1/0;He=Ye-Nt;break;case"avgSentiment":const qt=me.avgSentiment??-1,Jt=Fe.avgSentiment??-1;He=qt-Jt;break;
4955case"recommendedCount":He=me.recommendedCount-Fe.recommendedCount;break}return S==="asc"?He:-He}),[xe,v,S]);return h?o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Prompt Detail",noIndex:!0}),o.jsx("div",{className:"flex h-64 items-center justify-center",children:o.jsx(Me,{className:"h-8 w-8 animate-spin text-primary"})})]}):a?o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Prompt Detail",noIndex:!0}),o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"flex items-center justify-between py-3 border-b bg-background px-6 sticky top-0 z-10",children:[o.jsxs(le,{variant:"outline",size:"sm",onClick:()=>n(-1),children:[o.jsx(Ii,{className:"mr-1 h-4 w-4"}),"Back"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(le,{variant:"outline",size:"sm",onClick:()=>n(`/company/${t}/prompts/${e}/studio`),children:[o.jsx(pr,{className:"h-4 w-4"}),"Open in Studio"]}),o.jsx(le,{variant:"outline",size:"sm",onClick:()=>de(!0),disabled:ce||ye||re===0,children:ce||ye?o.jsxs(o.Fragment,{children:[o.jsx(Me,{className:"mr-2 h-4 w-4 animate-spin"}),"Running..."]}):o.jsxs(o.Fragment,{children:[o.jsx(bo,{className:"h-4 w-4"}),"Run Manually"]})}),o.jsx(le,{variant:"outline",size:"sm",onClick:Y,children:a.isActive?o.jsxs(o.Fragment,{children:[o.jsx(Kse,{className:"h-4 w-4"}),"Pause"]}):o.jsxs(o.Fragment,{children:[o.jsx(H1,{className:"h-4 w-4"}),"Activate"]})})]})]}),o.jsxs("div",{className:"flex-1 flex flex-col overflow-y-auto",children:[o.jsxs("div",{className:"space-y-2 border-b p-6",children:[Te?o.jsxs("div",{className:"space-y-3",children:[o.jsx(dl,{value:se,onChange:me=>U(me.target.value),placeholder:"Enter prompt text...",className:"text-lg min-h-[80px] resize-none",autoFocus:!0}),o.jsxs("div",{className:"flex items-center justify-end gap-2 border rounded-lg bg-muted/50 mb-5 p-3",children:[o.jsxs(le,{size:"xs",onClick:we,disabled:Q||!se.trim(),children:[Q?o.jsx(Me,{className:"h-4 w-4 animate-spin"}):o.jsx(Sn,{className:"size-3"}),"Save"]}),o.jsxs(le,{size:"xs",variant:"outline",onClick:ae,disabled:Q,children:[o.jsx(mr,{className:"size-3"}),"Cancel"]})]})]}):o.jsxs("div",{className:"flex items-start gap-2 group",children:[o.jsx("h1",{className:"text-2xl flex-1",children:a.promptText}),o.jsx(le,{variant:"ghost",size:"icon",className:"h-8 w-8 opacity-0 group-hover:opacity-100 transition-opacity shrink-0 mt-1",onClick:je,title:"Edit prompt",children:o.jsx(cv,{className:"h-4 w-4"})})]}),o.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-sm text-muted-foreground",children:[ye&&o.jsxs(Ge,{variant:"outline",className:"gap-1 border-primary text-primary animate-pulse",children:[o.jsx(Me,{className:"h-3 w-3 animate-spin"}),_e==="analyzing"?"Analyzing":"Running"]}),o.jsx(Ge,{variant:a.isActive?"default":"secondary",children:a.isActive?"Active":"Paused"}),o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx(vT,{className:"h-4 w-4"}),"Created ",new Date(a.createdAt).toLocaleDateString()]}),a.lastRunAt&&o.jsxs("span",{children:["Last run: ",bl(a.lastRunAt,w)]}),a.isActive&&a.lastRunAt&&o.jsxs("span",{className:"text-primary",children:["Next run: ",wme(new Date(new Date(a.lastRunAt).getTime()+24*60*60*1e3),w)]})]})]}),o.jsx(ur,{open:X,onOpenChange:de,children:o.jsxs(tr,{children:[o.jsxs(dr,{children:[o.jsxs(fr,{className:"flex items-center gap-2",children:[o.jsx(bo,{className:"h-5 w-5 text-primary"}),"Run Query Manually"]}),o.jsx(hr,{children:"You're about to run this query outside of the daily schedule."})]}),o.jsxs("div",{className:"py-4 space-y-4",children:[o.jsxs("div",{className:"rounded-lg border bg-muted/50 p-4",children:[o.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Query:"}),o.jsx("p",{className:"text-sm font-medium",children:a==null?void 0:a.promptText})]}),o.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg border",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(SS,{className:"h-6 w-6 text-muted-foreground"}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"Cost"}),o.jsxs("p",{className:"text-lg font-semibold",children:[re," tokens"]})]})]}),o.jsxs("div",{className:"text-right",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"Running across"}),o.jsxs("p",{className:"font-medium",children:[re," LLM",re!==1?"s":""]})]})]}),o.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"1 token per LLM model. Tokens are deducted immediately."})]}),o.jsxs(Pr,{children:[o.jsx(le,{variant:"outline",onClick:()=>de(!1),children:"Cancel"}),o.jsx(le,{onClick:pe,disabled:ce,children:ce?o.jsxs(o.Fragment,{children:[o.jsx(Me,{className:"mr-2 h-4 w-4 animate-spin"}),"Running..."]}):o.jsxs(o.Fragment,{children:[o.jsx(bo,{className:"h-4 w-4"}),"Run Now (",re??0," tokens)"]})})]})]})}),Ve&&o.jsxs("div",{className:"grid gap-[1px] bg-border border-b md:grid-cols-5",children:[o.jsxs(Ct,{className:"flex flex-col",children:[o.jsx(Lt,{className:"flex flex-row items-center justify-between pb-2",children:o.jsx($t,{className:"text-sm font-medium text-muted-foreground",children:"Mention Rate"})}),o.jsx(Et,{className:"flex flex-1 items-center",children:(()=>{const me=Ve.mentionRate;return o.jsx(nr,{value:me,size:"lg",variant:"percentage",tooltipTitle:`${me}
4955% of mentions found`})})()})]}),o.jsxs(Ct,{className:"relative overflow-hidden",children:[o.jsx(Lt,{className:"flex flex-row items-center justify-between pb-2",children:o.jsx($t,{className:"text-sm font-medium text-muted-foreground",children:"Avg. Rank"})}),o.jsxs(Et,{className:"pb-0",children:[o.jsxs("div",{className:"flex items-baseline gap-2",children:[o.jsx("div",{className:"text-2xl font-bold",children:Ve.avgRank!==null?`#${Ve.avgRank}`:"—"}),Ve.rankTrend!==null&&o.jsxs("span",{className:ne("text-xs font-medium",Ve.rankTrend<0?"text-success":Ve.rankTrend>0?"text-destructive":"text-muted-foreground"),children:[Ve.rankTrend>0?"+":"",Ve.rankTrend,"%"]})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"When mentioned"})]}),o.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-10",children:o.jsx(Qi,{width:"100%",height:"100%",children:o.jsxs(Dh,{data:Ve.rankHistory.filter(me=>me.value!==null),children:[o.jsx(Bn,{cursor:!1,content:({active:me,payload:Fe})=>me&&Fe&&Fe.length?o.jsx("div",{className:"rounded-lg border bg-background px-2 py-1 shadow-sm",children:o.jsx("span",{className:"text-xs font-medium",children:Fe[0].value})}):null}),o.jsx(Po,{type:"monotone",dataKey:"value",stroke:"var(--primary)",strokeWidth:1.5,dot:!1})]})})})]}),o.jsxs(Ct,{className:"flex flex-col",children:[o.jsx(Lt,{className:"flex flex-row items-center justify-between pb-2",children:o.jsx($t,{className:"text-sm font-medium text-muted-foreground",children:"Brand Sentiment"})}),o.jsxs(Et,{className:"flex flex-1 flex-col justify-center gap-2",children:[o.jsx(xa,{value:Ve.avgSentiment??0,size:"lg",fullWidth:!0,tooltipTitle:`Avg. sentiment of ${Ve.avgSentiment??0} based on ${Ve.totalRuns} run${Ve.totalRuns!==1?"s":""}`}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:[Ve.avgSentiment??0," / 100"]})]})]}),o.jsxs(Ct,{className:"relative overflow-hidden",children:[o.jsx(Lt,{className:"flex flex-row items-center justify-between pb-2",children:o.jsx($t,{className:"text-sm font-medium text-muted-foreground",children:"Total Runs"})}),o.jsxs(Et,{className:"pb-0",children:[o.jsxs("div",{className:"flex items-baseline gap-2",children:[o.jsx("div",{className:"text-2xl font-bold",children:Ve.totalRuns}),Ve.runsTrend!==null&&o.jsxs("span",{className:ne("text-xs font-medium",Ve.runsTrend>0?"text-success":Ve.runsTrend<0?"text-destructive":"text-muted-foreground"),children:[Ve.runsTrend>0?"+":"",Ve.runsTrend,"%"]})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"All time"})]}),o.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-10",children:o.jsx(Qi,{width:"100%",height:"100%",children:o.jsxs(Lh,{data:Ve.runsHistory,children:[o.jsx(Bn,{cursor:!1,content:({active:me,payload:Fe})=>me&&Fe&&Fe.length?o.jsx("div",{className:"rounded-lg border bg-background px-2 py-1 shadow-sm",children:o.jsxs("span",{className:"text-xs font-medium",children:[Fe[0].value," runs"]})}):null}),o.jsx(qa,{dataKey:"value",fill:"var(--primary)",radius:[2,2,0,0]})]})})})]}),o.jsxs(Ct,{className:"relative overflow-hidden",children:[o.jsx(Lt,{className:"flex flex-row items-center justify-between pb-2",children:o.jsx($t,{className:"text-sm font-medium text-muted-foreground",children:"Sources"})}),o.jsxs(Et,{className:"pb-0",children:[o.jsxs("div",{className:"flex items-baseline gap-2",children:[o.jsx("div",{className:"text-2xl font-bold",children:Ve.sourcesCount}),Ve.sourcesTrend!==null&&o.jsxs("span",{className:ne("text-xs font-medium",Ve.sourcesTrend>0?"text-success":Ve.sourcesTrend<0?"text-destructive":"text-muted-foreground"),children:[Ve.sourcesTrend>0?"+":"",Ve.sourcesTrend,"%"]})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Citations found"})]}),o.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-10",children:o.jsx(Qi,{width:"100%",height:"100%",children:o.jsxs(Lh,{data:Ve.sourcesHistory,children:[o.jsx(Bn,{cursor:!1,content:({active:me,payload:Fe})=>me&&Fe&&Fe.length?o.jsx("div",{className:"rounded-lg border bg-background px-2 py-1 shadow-sm",children:o.jsxs("span",{className:"text-xs font-medium",children:[Fe[0].value," sources"]})}):null}),o.jsx(qa,{dataKey:"value",fill:"var(--primary)",radius:[2,2,0,0]})]})})})]})]}),o.jsxs("div",{className:"grid border-b gap-[1px] bg-border lg:grid-cols-5 items-stretch",children:[o.jsxs(Ct,{className:"pt-0 lg:col-span-3 flex flex-col bg-background",children:[o.jsxs(Lt,{className:"flex items-center gap-2 space-y-0 border-b py-2 sm:flex-row",children:[o.jsx("div",{className:"grid flex-1 gap-1",children:o.jsx($t,{children:"Rank map"})}),o.jsxs(Tr,{value:m,onValueChange:x,children:[o.jsx(yr,{className:"hidden w-[180px] rounded-lg sm:ml-auto sm:flex","aria-label":"Select LLM",children:o.jsx(Vr,{placeholder:"All models"})}),o.jsxs(vr,{className:"rounded-xl",children:[o.jsx(Ht,{value:"all",className:"rounded-lg",children:"All models"}),De.map(me=>o.jsx(Ht,{value:me.id,className:"rounded-lg",children:me.displayName},me.id))]})]}),o.jsxs("div",{className:"flex items-center gap-1 rounded-lg border p-1",children:[o.jsx(le,{variant:y==="leaderboard"?"secondary":"ghost",size:"sm",className:"h-7 px-2",onClick:()=>g("leaderboard"),children:o.jsx(bTe,{className:"h-4 w-4"})}),o.jsx(le,{variant:y==="line"?"secondary":"ghost",size:"sm",className:"h-7 px-2",onClick:()=>g("line"),children:o.jsx(fTe,{className:"h-4 w-4"})})]})]}),o.jsx(Et,{className:"px-2 pt-4 sm:px-6 sm:pt-6",children:$e.length>0&&ue.length>0?y==="leaderboard"?o.jsx(eTt,{data:$e,entities:tt}):o.jsx(hye,{config:Ne,className:"aspect-auto h-[300px] w-full",children:o.jsxs(Dh,{data:$e,margin:{left:0,right:0},children:[o.jsx(fd,{vertical:!1}
4955),o.jsx(No,{dataKey:"date",tickLine:!1,axisLine:!1,tickMargin:8,minTickGap:32,padding:{left:20,right:20},color:"var(--text-foreground)"}),o.jsx(jo,{reversed:!0,domain:[0,me=>Math.max(me+1,5)],tickLine:!1,axisLine:!1,tickMargin:8,tickFormatter:me=>me>=1?`#${Math.round(me)}`:""}),o.jsx(zTt,{cursor:!1,content:o.jsx(pye,{labelFormatter:(me,Fe)=>{var Ye,Nt;const He=(Nt=(Ye=Fe==null?void 0:Fe[0])==null?void 0:Ye.payload)==null?void 0:Nt.timestamp;return He?new Date(He).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}):me},indicator:"dot",formatter:(me,Fe)=>{const He=Ne[Fe];return o.jsxs("div",{className:"flex w-full items-center gap-2",children:[o.jsx("div",{className:"h-2.5 w-2.5 shrink-0 rounded-[2px]",style:{backgroundColor:He==null?void 0:He.color}}),o.jsx("span",{className:"flex-1 text-muted-foreground",children:(He==null?void 0:He.label)||Fe}),o.jsxs("span",{className:"font-mono font-medium tabular-nums text-foreground",children:["#",me]})]})}})}),ue.map((me,Fe)=>o.jsx(Po,{dataKey:me,type:"monotone",stroke:`var(--color-${me})`,strokeWidth:Fe===0?2.5:1.5,dot:{r:4,fill:`var(--color-${me})`,strokeWidth:0},activeDot:{r:6,fill:`var(--color-${me})`,strokeWidth:0},connectNulls:!1},me)),o.jsx(BTt,{content:o.jsx(mye,{})})]})}):o.jsx("div",{className:"flex h-[300px] flex-col items-center justify-center rounded-lg border border-dashed gap-3",children:ye?o.jsxs(o.Fragment,{children:[o.jsx(Me,{className:"h-8 w-8 animate-spin text-primary"}),o.jsx("p",{className:"text-muted-foreground",children:_e==="analyzing"?"Analyzing responses...":"Running query against LLMs..."}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Results will appear here when complete"})]}):o.jsx("p",{className:"text-muted-foreground",children:"No ranking data yet. Run the query to see results."})})})]}),xe.length>0?o.jsxs(Ct,{className:"lg:col-span-2 flex flex-col bg-background",children:[o.jsx(Lt,{className:"flex gap-2 space-y-0 border-b py-5",children:o.jsx($t,{children:"Competitor Performance"})}),o.jsxs(Et,{className:"p-0",children:[o.jsx("div",{className:"overflow-x-auto",children:o.jsxs("table",{className:"w-full card-table",children:[o.jsx("thead",{className:"bg-muted/50 h-12 border-b",children:o.jsxs("tr",{children:[o.jsx("th",{className:"w-10 px-2"}),o.jsx("th",{className:"px-4 text-left text-xs font-medium text-muted-foreground whitespace-nowrap cursor-pointer hover:text-foreground transition-colors",onClick:()=>St("name"),children:o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("span",{className:ne(v==="name"&&"text-foreground font-bold"),children:"Competitor"}),(()=>{const me=rt("name");return o.jsx(me,{className:ne("h-3 w-3",v==="name"?"text-foreground":"text-muted-foreground/50")})})()]})}),o.jsx("th",{className:"px-4 text-center text-xs font-medium text-muted-foreground whitespace-nowrap cursor-pointer hover:text-foreground transition-colors",onClick:()=>St("visibility"),children:o.jsxs("div",{className:"flex items-center justify-center gap-1",children:[o.jsx("span",{className:ne(v==="visibility"&&"text-foreground font-bold"),children:"SoV"}),(()=>{const me=rt("visibility");return o.jsx(me,{className:ne("h-3 w-3",v==="visibility"?"text-foreground":"text-muted-foreground/50")})})()]})}),o.jsx("th",{className:"px-4 text-center text-xs font-medium text-muted-foreground whitespace-nowrap cursor-pointer hover:text-foreground transition-colors",onClick:()=>St("avgRank"),children:o.jsxs("div",{className:"flex items-center justify-center gap-1",children:[o.jsx("span",{className:ne(v==="avgRank"&&"text-foreground font-bold"),children:"Rank"}),(()=>{const me=rt("avgRank");return o.jsx(me,{className:ne("h-3 w-3",v==="avgRank"?"text-foreground":"text-muted-foreground/50")})})()]})}),o.jsx("th",{className:"px-4 text-center text-xs font-medium text-muted-foreground whitespace-nowrap cursor-pointer hover:text-foreground transition-colors",onClick:()=>St("avgSentiment"),children:o.jsxs("div",{className:"flex items-center justify-center gap-1",children:[o.jsx("span",{className:ne(v==="avgSentiment"&&"text-foreground font-bold"),children:"Sentiment"}),(()=>{const me=rt("avgSentiment");return o.jsx(me,{className:ne("h-3 w-3",v==="avgSentiment"?"text-foreground":"text-muted-foreground
4955/50")})})()]})})]})}),o.jsx("tbody",{className:"divide-y divide-border",children:vt.slice((j-1)*C,j*C).map(me=>{const Fe=ee(me.name);return o.jsxs("tr",{className:"hover:bg-accent/50 cursor-pointer",onClick:()=>Fe.id&&n(`/company/${t}/competitors/${Fe.id}`),children:[o.jsx("td",{className:"px-2 py-3 whitespace-nowrap",children:Fe.id&&o.jsx(le,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:He=>fe(Fe.id,Fe.isFavorite,He),children:o.jsx(wm,{className:ne("h-4 w-4",Fe.isFavorite?"fill-yellow-500 text-yellow-500":"text-muted-foreground")})})}),o.jsx("td",{className:"px-4 py-3 whitespace-nowrap",children:o.jsx(R5,{name:me.name,website:Fe.website,faviconUrl:Fe.faviconUrl,source:Fe.source,description:Fe.description,showName:!0,size:"md"})}),o.jsx("td",{className:"px-4 py-3 text-center whitespace-nowrap",children:o.jsx(nr,{value:me.visibility,size:"md",variant:"percentage",className:"mx-auto"})}),o.jsx("td",{className:"px-4 py-3 text-center whitespace-nowrap",children:me.avgRank!==null?o.jsx(nr,{value:me.avgRank,size:"md",variant:"rank",className:"mx-auto"}):o.jsx("span",{className:"text-muted-foreground",children:"—"})}),o.jsx("td",{className:"px-4 py-3 text-center whitespace-nowrap",children:me.avgSentiment!==null?o.jsx(xa,{value:me.avgSentiment,size:"md",className:"justify-center",tooltipTitle:`Avg. sentiment of ${me.avgSentiment} based on ${me.totalMentions} mention${me.totalMentions!==1?"s":""}`}):o.jsx("span",{className:"text-muted-foreground",children:"—"})})]},me.name)})})]})}),vt.length>7&&o.jsx("div",{className:"p-4 pt-0 border-t",children:o.jsx(tZ,{currentPage:j,totalItems:vt.length,pageSize:C,onPageChange:me=>A(me),showPageSizeSelector:!1,className:"mt-4"})})]})]}):ye&&c.length===0?o.jsxs(Ct,{className:"lg:col-span-2 flex flex-col bg-background",children:[o.jsxs(Lt,{className:"border-b",children:[o.jsx($t,{children:"Competitor Performance"}),o.jsx(hh,{children:"Aggregated stats for each competitor"})]}),o.jsx(Et,{children:o.jsxs("div",{className:"flex h-48 flex-col items-center justify-center rounded-lg border border-dashed gap-3",children:[o.jsx(Me,{className:"h-8 w-8 animate-spin text-primary"}),o.jsx("p",{className:"text-muted-foreground",children:_e==="analyzing"?"Analyzing competitor mentions...":"Waiting for results..."}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Competitor data will appear here when complete"})]})})]}):null]}),o.jsxs("div",{className:"grid border-b gap-[1px] bg-border lg:grid-cols-2 items-stretch",children:[c.length>0&&(()=>{const me=new Map;c.forEach(Ye=>{Ye.sources.forEach(Nt=>{const qt=me.get(Nt.url);qt?(qt.count++,Ye.isMentioned&&(qt.brandMentioned=!0)):me.set(Nt.url,{url:Nt.url,title:Nt.title,count:1,brandMentioned:Ye.isMentioned})})});const Fe=Array.from(me.values()).sort((Ye,Nt)=>Nt.count-Ye.count),He=Fe.slice((k-1)*I,k*I);return o.jsxs(Ct,{className:"flex flex-col bg-background",children:[o.jsx(Lt,{className:"cursor-pointer hover:bg-accent/50 transition-colors border-b",onClick:q,children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("div",{className:"space-y-1",children:o.jsxs($t,{className:"flex items-center gap-2",children:["Top Sources",o.jsx(Ge,{variant:"outline",className:"ml-2",children:Fe.length})]})}),E?o.jsx(Kc,{className:"h-5 w-5 text-muted-foreground"}):o.jsx(ms,{className:"h-5 w-5 text-muted-foreground"})]})}),E&&o.jsx(Et,{className:"p-0",children:Fe.length===0?o.jsx("div",{className:"flex h-32 items-center justify-center rounded-lg border border-dashed m-6",children:o.jsx("p",{className:"text-muted-foreground",children:"No sources found in responses yet."})}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"overflow-x-auto",children:o.jsxs("table",{className:"w-full card-table",children:[o.jsx("thead",{className:"bg-muted/50 h-12 border-b",children:o.jsxs("tr",{children:[o.jsx("th",{className:"px-4 text-left text-xs font-medium text-muted-foreground whitespace-nowrap",children:"Source"}),o.jsx("th",{className:"px-4 text-center text-xs font-medium text-muted-foreground whitespace-nowrap",children:"Times Referred"}),o.jsx("th",{className:"px-4 text-center text-xs font-medium text-muted-foreground whitespace-nowrap",children:"Brand Mentioned"}),o.jsx("th",{className:"px-2 text-right text-xs font-medium text-muted-foreground whitespace-nowrap",children:"Actions"})]})}),o.jsx("tbody",{className:"divide-y divide-border",children:He.map((Ye,Nt)=>{let qt="";try{qt=new URL(Ye.url).hostname.replace("www.","")}catch{qt=Ye.url}return o.jsxs("tr",{className:"hover:bg-accent/50",children:[o.jsx("td",{className:"px-4 py-3",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"flex h-8 w-8 min-w-[32px] items-center justify-center rounded bg-muted overflow-hidden shrink-0",children:o.jsx("img",{src:`https://www.google.com/s2/favicons?domain=${qt}&sz=32`,alt:"",className:"h-6 w-6 object-contain",onError:Jt=>{Jt.currentTarget.style.display="none"}})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"font-medium text-sm truncate",children:Ye.title||qt}),o.jsx("p",{className:"text-xs text-muted-foreground truncate",children:qt})]})]})}),o.jsx("td",{className:"px-4 py-3 text-center whitespace-nowrap",children:o.jsx(Ge,{variant:"secondary",children:Ye.count})}),o.jsx("td",{className:"px-4 py-3 text-center whitespace-nowrap",children:Ye.brandMentioned?o.jsx(Ge,{variant:"default",children:"Yes"}):o.jsx(Ge,{variant:"outline",children:"No"})}),o.jsx("td",{className:"px-2 py-3 whitespace-nowrap",children:o.jsxs("div",{className:"flex items-center gap-1 w-full justify-end",children:[o.jsxs(le,{variant:"outline",size:"sm",className:"h-8 text-xs",onClick:Jt=>{Jt.stopPropagation(),n(`/company/${t}/sources/${encodeURIComponent(Ye.url)}`)},children:[o.jsx(STe,{className:"h-3 w-3 mr-1"}),"Open flow"]}),o.jsx("a",{href:Ye.url,target:"_blank",rel:"noopener noreferrer",onClick:Jt=>Jt.stopPropagation(),children:o.jsx(le,{variant:"outline",size:"icon",className:"h-8 text-xs",children:o.jsx(Wr,{className:"h-3 w-3"})})})]})})]},`${Ye.url}-${Nt}`)})})]})}),Fe.length>10&&o.jsx("div",{className:"p-4 border-t",children:o.jsx(tZ,{currentPage:k,totalItems:Fe.length,pageSize:I,onPageChange:Ye=>
4955M(Ye),onPageSizeChange:Ye=>{R(Ye),M(1)}})})]})})]})})(),o.jsxs(Ct,{className:"flex flex-col bg-background",children:[o.jsx(Lt,{className:"cursor-pointer hover:bg-accent/50 transition-colors border-b",onClick:B,children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("div",{className:"space-y-1",children:o.jsxs($t,{className:"flex items-center gap-2",children:["Run History",o.jsx(Ge,{variant:"outline",className:"ml-2",children:c.length})]})}),D?o.jsx(Kc,{className:"h-5 w-5 text-muted-foreground"}):o.jsx(ms,{className:"h-5 w-5 text-muted-foreground"})]})}),D&&o.jsx(Et,{className:"p-0",children:c.length>0?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"overflow-x-auto",children:o.jsxs("table",{className:"w-full card-table",children:[o.jsx("thead",{className:"bg-muted/50 h-12 border-b",children:o.jsxs("tr",{children:[o.jsx("th",{className:"px-4 text-left text-xs font-medium text-muted-foreground whitespace-nowrap",children:"Date"}),o.jsx("th",{className:"px-4 text-left text-xs font-medium text-muted-foreground whitespace-nowrap",children:"LLM"}),o.jsx("th",{className:"px-4 text-center text-xs font-medium text-muted-foreground whitespace-nowrap",children:"Rank"}),o.jsx("th",{className:"px-4 text-center text-xs font-medium text-muted-foreground whitespace-nowrap",children:"Sentiment"}),o.jsx("th",{className:"px-4 text-left text-xs font-medium text-muted-foreground whitespace-nowrap",children:"Competitors"})]})}),o.jsx("tbody",{className:"divide-y divide-border",children:c.slice((O-1)*T,O*T).map(me=>o.jsxs("tr",{className:"hover:bg-accent/50 cursor-pointer transition-colors",onClick:()=>n(`/company/${t}/prompts/${e}/studio?run=${me.id}`),children:[o.jsx("td",{className:"px-4 py-3 text-xs text-muted-foreground whitespace-nowrap",title:new Date(me.createdAt).toLocaleString(),children:bl(me.createdAt,w)}),o.jsx("td",{className:"px-4 py-3 whitespace-nowrap",children:o.jsxs("div",{className:"flex items-center gap-2",children:[me.isMentioned?o.jsx("div",{className:"flex h-4 w-4 items-center justify-center rounded-full bg-primary/20 text-primary shrink-0",children:o.jsx("span",{className:"text-[10px]",children:"✓"})}):o.jsx("div",{className:"flex h-4 w-4 items-center justify-center rounded-full bg-muted text-muted-foreground shrink-0",children:o.jsx("span",{className:"text-[10px]",children:"—"})}),me.llmProvider.logoUrl?o.jsx(Hn,{src:me.llmProvider.logoUrl,alt:"",className:"h-5 w-5 min-w-[20px] rounded object-contain"}):o.jsx("div",{className:"flex h-5 w-5 min-w-[20px] items-center justify-center rounded bg-muted text-xs",children:me.llmProvider.name.charAt(0)}),o.jsx("span",{className:"text-sm",children:me.llmProvider.displayName})]})}),o.jsx("td",{className:"px-4 py-3 text-center whitespace-nowrap",children:me.isMentioned&&me.rankPosition!==null?o.jsx(nr,{value:me.rankPosition,size:"md",variant:"rank",className:"mx-auto"}):o.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),o.jsx("td",{className:"px-4 py-3 text-center whitespace-nowrap",children:me.isMentioned&&me.sentimentScore!==null?o.jsx(xa,{value:me.sentimentScore,size:"md",className:"justify-center",tooltipTitle:`Sentiment score of ${me.sentimentScore}`}):o.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),o.jsx("td",{className:"px-4 py-3 whitespace-nowrap",children:me.competitorsMentioned.length>0?o.jsx(I5,{competitors:me.competitorsMentioned.map(Fe=>{const He=Fe.normalizedName||Fe.name,Ye=G.get(He.toLowerCase())||G.get(Fe.name.toLowerCase());return{name:(Ye==null?void 0:Ye.name)||He,id:(Ye==null?void 0:Ye.id)||void 0,originalName:Fe.name!==Fe.normalizedName?Fe.name:void 0,website:(Ye==null?void 0:Ye.website)||null,faviconUrl:(Ye==null?void 0:Ye.faviconUrl)||null,source:Ye==null?void 0:Ye.source,description:Ye==null?void 0:Ye.de
4955scription}}),max:4,size:"sm",totalCount:me.competitorsMentioned.length,companyId:t}):o.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})})]},me.id))})]})}),c.length>T&&o.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-t",children:[o.jsxs("p",{className:"text-sm text-muted-foreground",children:["Showing ",(O-1)*T+1," to ",Math.min(O*T,c.length)," of ",c.length," runs"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(le,{variant:"outline",size:"sm",onClick:()=>L(me=>Math.max(1,me-1)),disabled:O===1,children:o.jsx(Ga,{className:"h-4 w-4 rotate-180"})}),o.jsxs("span",{className:"text-sm",children:["Page ",O," of ",Math.ceil(c.length/T)]}),o.jsx(le,{variant:"outline",size:"sm",onClick:()=>L(me=>Math.min(Math.ceil(c.length/T),me+1)),disabled:O===Math.ceil(c.length/T),children:o.jsx(Ga,{className:"h-4 w-4"})})]})]})]}):o.jsx("div",{className:"flex h-32 items-center justify-center rounded-lg border border-dashed m-6",children:o.jsx("p",{className:"text-muted-foreground",children:"No results yet. Wait for the first run to complete."})})})]})]}),o.jsx(Ct,{className:"bg-background border-b",children:o.jsx(Lt,{className:"border-b",children:o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx($t,{className:"flex items-center gap-2 text-base",children:"Dynamic Runs"}),o.jsx(hh,{children:"Optimized prompt rotation for varied results."})]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(et,{htmlFor:"dynamic-runs",className:"text-sm text-muted-foreground",children:a!=null&&a.dynamicRuns?"Enabled":"Disabled"}),o.jsx(Zi,{id:"dynamic-runs",checked:(a==null?void 0:a.dynamicRuns)??!1,onCheckedChange:$})]})]})})})]})]})]}):o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Prompt Detail",noIndex:!0}),o.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-4",children:[o.jsx("p",{className:"text-muted-foreground",children:"Query not found"}),o.jsxs(le,{variant:"outline",onClick:()=>n(-1),children:[o.jsx(Ii,{className:"h-4 w-4"}),"Go Back"]})]})]})}function oi(t){if(!t)return"";try{const e=t.startsWith("http://")||t.startsWith("https://")?t:`https://${t}`;return new URL(e).hostname.replace(/^www\./,"").toLowerCase()}catch{return t.replace(/^(https?:\/\/)?(www\.)?/,"").split("/")[0].toLowerCase()}}function Bx(t){return t?t.startsWith("http://")||t.startsWith("https://")?t:`https://${t}`:""}function nZ({indexes:t,references:e,onHover:n,onLeave:r,onClick:i,hoveredRef:s,focusedRef:a}){if(!t||t.length===0)return null;const l=[...new Set(t)].sort((c,u)=>c-u);return o.jsx("span",{className:"inline-flex items-center gap-0.5 ml-0.5",children:l.map(c=>{const u=e.find(h=>h.index===c);if(!u)return null;const d=s===c,f=a===c;return o.jsxs(Ft,{children:[o.jsx(Ut,{asChild:!0,children:o.jsx("button",{className:ne("inline-flex items-center justify-center min-w-[1.25rem] h-5 px-1 text-[10px] font-medium rounded transition-all",f&&"bg-blue-500 text-white ring-1 ring-blue-500",d&&!f&&"bg-blue-500/30 text-blue-700",!d&&!f&&"bg-blue-500/10 text-blue-600 hover:bg-blue-500/20"),onMouseEnter:()=>n(c),onMouseLeave:r,onClick:()=>i(c),children:c+1})}),o.jsxs(zt,{side:"top",className:"max-w-xs",children:[o.jsx("p",{className:"font-medium text-xs",children:u.title}),u.snippet&&o.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:u.snippet}),o.jsx("p",{className:"text-[10px] text-blue-500 mt-1",children:oi(u.link)})]})]},c)})})}function HTt({block:t,references:e,onRefHover:n,onRefLeave:r,onRefClick:i,hoveredRef:s,focusedRef:a,highlightText:l}){var u,d;const c=t.reference_indexes&&t.reference_indexes.length>0?o.jsx(nZ,{indexes:t.reference_indexes,references:e,onHover:n,onLeave:r,onClick:i,hoveredRef:s,focusedRef:a}):null;switch(t.type){case"heading":return o.jsxs("h3",{className:"text-base font-semibold mt-4 mb-2 first:mt-0",children:[l(t.snippet||""),c]});case"paragraph":return o.jsxs("p",{className:"mb-3 last:mb-0 leading-relaxed",children:[l(t.snippet||""),c]});case"list":return o.jsxs("ul",{className:"mb-3 space-y-1.5 list-none",children:[(u=t.list)==null?void 0:u.map((f,h)=>o.jsxs("li",{className:"flex items-start gap-2",children:[o.jsx("span",{className:"text-primary mt-1.5 text-xs",children:"•"}),o.jsxs("span",{className:"flex-1",children:[l(f.snippet||""),f.reference_indexes&&f.reference_indexes.length>0&&o.jsx(nZ,{indexes:f.reference_indexes,references:e,onHover:n,onLeave:r,onClick:i,hoveredRef:s,focusedRef:a})]})]},h)),c&&!t.list&&c]});case"code_block":return o.jsx("div",{className:"mb-3",children:o.jsxs("div",{className:"bg-muted rounded-lg overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 bg-muted/80 border-b text-xs text-muted-foreground",children:[o.jsx("span",{children:t.language||"code"}),c]}),o.jsx("pre",{className:"p-3 overflow-x-auto text-xs",children:o.jsx("code",{children:t.code})})]})});case"table":return!t.table||t.table.length===0?null:o.jsxs("div",{className:"mb-3 overflow-x-auto",children:[o.jsxs("table",{className:"w-full text-sm border-collapse",children:[o.jsx("thead",{children:o.jsx("tr",{className:"bg-muted/50",children:(d=t.table[0])==null?void 0:d.map((f,h)=>o.jsx("th",{className:"px-3 py-2 text-left font-semibold text-xs border-b",children:l(f)}
4955,h))})}),o.jsx("tbody",{children:t.table.slice(1).map((f,h)=>o.jsx("tr",{className:"border-b last:border-0",children:f.map((p,m)=>o.jsx("td",{className:"px-3 py-2 text-xs",children:l(p)},m))},h))})]}),c]});default:return t.snippet?o.jsxs("p",{className:"mb-3",children:[l(t.snippet),c]}):null}}function WTt({references:t,hoveredRefIndex:e,focusedRefIndex:n,onRefHover:r,onRefLeave:i,onRefClick:s}){return!t||t.length===0?null:o.jsxs("div",{className:"mt-4 pt-4 border-t",children:[o.jsxs("h4",{className:"text-xs font-semibold text-muted-foreground mb-3 flex items-center gap-2",children:[o.jsx(To,{className:"h-3.5 w-3.5"}),"References (",t.length,")"]}),o.jsx("div",{className:"grid gap-3",children:t.map(a=>{const l=oi(a.link),c=a.link.replace(/^https?:\/\//,"").replace(/^www\./,"").split("#")[0],u=e===a.index,d=n===a.index;return o.jsxs("div",{"data-reference-index":a.index,className:ne("rounded-lg p-3 transition-all cursor-pointer",d&&"bg-blue-500/10 ring-2 ring-blue-500",u&&!d&&"bg-muted/70",!u&&!d&&"bg-muted/30 hover:bg-muted/50"),onMouseEnter:()=>r(a.index),onMouseLeave:i,onClick:()=>s(a.index),children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[o.jsx("div",{className:"h-4 w-4 shrink-0 rounded overflow-hidden bg-background",children:o.jsx("img",{src:`https://www.google.com/s2/favicons?domain=${l}&sz=32`,alt:"",className:"h-full w-full object-contain"})}),o.jsx("span",{className:"text-[11px] text-muted-foreground truncate flex-1",children:a.source||l}),o.jsx(Ge,{variant:"secondary",className:ne("text-[10px] h-5 px-1.5 shrink-0",d&&"bg-blue-500 text-white"),children:a.index+1})]}),o.jsx("a",{href:Bx(a.link),target:"_blank",rel:"noopener noreferrer",onClick:f=>f.stopPropagation(),className:"text-sm font-medium text-blue-600 hover:underline line-clamp-2 mb-0.5 block",children:a.title}),o.jsx("p",{className:"text-[11px] text-green-700 truncate mb-1",children:c.length>60?c.substring(0,60)+"...":c}),a.snippet&&o.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2 leading-relaxed",children:a.snippet})]},`ref-${a.index}`)})})]})}function GTt(){var pe,je;const{companyId:t,queryId:e}=Gr(),n=Nr(),[r,i]=N0(),{companies:s}=Ri(),a=s.find(ae=>ae.id===t),l=(a==null?void 0:a.brandName)||"Your Brand",c=(a==null?void 0:a.logoUrl)||null,[u,d]=b.useState(null),[f,h]=b.useState([]),[p,m]=b.useState([]),[x,y]=b.useState(!0),g=r.get("run"),[w,v]=b.useState(null),[N,S]=b.useState(null),[_,j]=b.useState(null),[A,C]=b.useState(null),[k,M]=b.useState(null),[I,R]=b.useState(null),[E,P]=b.useState(""),O=b.useRef(null),L=b.useRef(null),T=b.useRef(null),D=b.useRef(null),F=b.useRef(null),q=r.get("competitor"),[B,z]=b.useState([]),[H,W]=b.useState(0),{competitorInfoMap:G,aliasToMainMap:K}=b.useMemo(()=>{const ae=new Map,we=new Map;for(const Ie of p)if(ae.set(Ie.name.toLowerCase(),{id:Ie.id,name:Ie.name,website:Ie.website,faviconUrl:Ie.faviconUrl||Ie.logoUrl}),Ie.aliases)for(const Ue of Ie.aliases)we.set(Ue.name.toLowerCase(),Ie.name),ae.set(Ue.name.toLowerCase(),{id:Ie.id,name:Ie.name,website:Ie.website,faviconUrl:Ie.faviconUrl||Ie.logoUrl});return{competitorInfoMap:ae,aliasToMainMap:we}},[p]),ee=ae=>G.get(ae.toLowerCase())||{id:null,name:ae,website:null,faviconUrl:null},V=ae=>K.get(ae.toLowerCase())||ae;b.useEffect(()=>{t&&e&&J()},[t,e]);const J=async()=>{try{y(!0);const[ae,we,Ie]=await Promise.all([Ce.get(`/companies/${t}/queries/${e}`),Ce.get(`/companies/${t}/queries/${e}/rankings`),Ce.get(`/companies/${t}/competitors`)]);d(ae),h(we),m(Ie),!g&&we.length>0&&i({run:we[0].id})}catch(ae){ge.error(ae.message||"Failed to load studio data")}finally{y(!1)}},Y=b.useMemo(()=>g?f.find(ae=>ae.id===g)||f[0]||null:f[0]||null,[g,f]),$=b.useMemo(()=>{if(!E.trim())return f;const ae=E.toLowerCase();return f.filter(we=>we.llmProvider.displayName.toLowerCase().includes(ae)||new Date(we.createdAt).toLocaleDateString().includes(ae))},[f,E]),fe=b.useMemo(()=>{if(!Y)return[];const ae=new Set,we=Y.competitorsMentioned.map(Ie=>{const Ue=Ie.normalizedName||Ie.name,Oe=V(Ue);if(ae.has(Oe.toLowerCase()))return null;ae.add(Oe.toLowerCase());const ie=ee(Ue)||ee(Ie.name),De=Ie.normalizedName&&Ie.name.toLowerCase()!==Ie.normalizedName.toLowerCase();return{originalName:Ie.name,normalizedName:Ie.normalizedName,wasNormalized:De,rankPosition:Ie.rankPosition,sentimentScore:Ie.sentimentScore,sentimentLabel:Ie.sentimentLabel,isRecommended:Ie.isRecommended,id:ie.id,name:Oe,website:ie.website,faviconUrl:ie.faviconUrl,isBrand:!1}}
4955).filter(Boolean);if(Y.isMentioned&&l&&!ae.has(l.toLowerCase())){const Ie={originalName:l,rankPosition:Y.rankPosition,sentimentScore:Y.sentimentScore??void 0,sentimentLabel:Y.sentimentLabel??void 0,isRecommended:!0,id:null,name:l,website:(a==null?void 0:a.website)||null,faviconUrl:c,isBrand:!0};if(Y.rankPosition){const Ue=we.findIndex(Oe=>Oe.rankPosition&&Oe.rankPosition>Y.rankPosition);Ue===-1?we.push(Ie):we.splice(Ue,0,Ie)}else we.push(Ie)}return we},[Y,G,K,l,a,c]),ce=b.useMemo(()=>{if(!Y)return new Set;const ae=new Set;for(const we of Y.sources){const Ie=oi(we.url);Ie&&ae.add(Ie)}return ae},[Y]),ve=b.useCallback((ae,we)=>{if(!L.current||!O.current)return;const Ie=ae==="competitor"?`[data-highlight-competitor="${we}"]`:`[data-highlight-source="${we}"]`,Ue=L.current.querySelectorAll(Ie);if(Ue.length===0)return;const Oe=Ue[0],ie=O.current,De=ie.getBoundingClientRect(),Ve=Oe.getBoundingClientRect();if(!(Ve.top>=De.top&&Ve.bottom<=De.bottom)){const $e=Ve.top-De.top-100+ie.scrollTop;ie.scrollTo({top:$e,behavior:"smooth"})}},[]),X=b.useCallback(()=>{if(!L.current||!O.current)return;const ae=L.current;W(ae.scrollHeight);const we=N||w,Ie=A||_;if(!we&&!Ie){z([]);return}const Ue=[];we&&ae.querySelectorAll(`[data-highlight-competitor="${we}"]`).forEach(ie=>{const De=ie.offsetTop;Ue.push({top:De,type:"competitor"})}),Ie&&ae.querySelectorAll(`[data-highlight-source="${Ie}"]`).forEach(ie=>{const De=ie.offsetTop;Ue.push({top:De,type:"source"})}),z(Ue)},[N,w,A,_]);b.useEffect(()=>{X()},[X,Y]);const de=b.useCallback(ae=>{if(!T.current)return;const we=T.current.querySelector(`[data-sidebar-competitor="${ae}"]`);we&&we.scrollIntoView({behavior:"smooth",block:"center"})},[]),Te=b.useCallback(ae=>{if(!D.current)return;const we=D.current.querySelector(`[data-sidebar-source="${ae}"]`);we&&we.scrollIntoView({behavior:"smooth",block:"center"})},[]),Pe=b.useCallback(ae=>{if(!F.current)return;const we=F.current.querySelector(`[data-sidebar-run="${ae}"]`);we&&we.scrollIntoView({behavior:"smooth",block:"center"})},[]);b.useEffect(()=>{g&&f.length>0&&setTimeout(()=>Pe(g),100)},[g,f.length,Pe]),b.useEffect(()=>{if(q&&Y&&!x){const ae=decodeURIComponent(q),we=V(ae);S(we),setTimeout(()=>{ve("competitor",we),de(we)},200)}},[q,Y,x]);const se=b.useCallback(ae=>{const we=N===ae?null:ae;S(we),we&&setTimeout(()=>ve("competitor",ae),50)},[N,ve]),U=b.useCallback(ae=>{var Ie;const we=A===ae?null:ae;if(C(we),(Ie=Y==null?void 0:Y.structuredResponse)!=null&&Ie.references){const Ue=oi(ae),Oe=Y.structuredResponse.references.find(ie=>oi(ie.link)===Ue||ie.link.includes(Ue));if(Oe){R(we?Oe.index:null),we&&setTimeout(()=>{const ie=document.querySelector(`[data-reference-index="${Oe.index}"]`);ie&&ie.scrollIntoView({behavior:"smooth",block:"center"})},50);return}}we&&setTimeout(()=>ve("source",ae),50)},[A,ve,Y]),Q=b.useCallback(ae=>{const we=N===ae?null:ae;S(we),we&&setTimeout(()=>de(ae),50)},[N,de]),oe=b.useCallback(ae=>{const we=A===ae?null:ae;C(we),we&&setTimeout(()=>Te(ae),50)},[A,Te]),_e=b.useCallback(ae=>{if(!ae)return ae;const we=fe.map(me=>me.name),Ie=fe.filter(me=>me.originalName&&me.originalName!==me.name).map(me=>me.originalName),Ue=fe.flatMap(me=>{var He;const Fe=p.find(Ye=>
4955Ye.name===me.name);return((He=Fe==null?void 0:Fe.aliases)==null?void 0:He.map(Ye=>Ye.name))||[]}),Oe=[...new Set([...we,...Ie,...Ue])],ie=Array.from(ce),De=l.toLowerCase(),Ve=me=>me.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),xe=me=>me.split(".").map(Ve).join("\\s*\\.\\s*"),$e=ie.map(me=>`https?://(?:www\\.\\s*)?${xe(me)}[^\\s]*`),ue=ie.map(me=>`www\\s*\\.\\s*${xe(me)}[^\\s]*`),Ne=ie.sort((me,Fe)=>Fe.length-me.length).map(me=>xe(me)),Le=Oe.sort((me,Fe)=>Fe.length-me.length).map(me=>`\\b${Ve(me)}\\b`),tt=`\\b${Ve(l)}\\b`,St=[...$e,...ue,...Ne,...tt?[tt]:[],...Le];if(St.length===0)return ae;const rt=new RegExp(`(${St.join("|")})`,"gi");return ae.split(rt).map((me,Fe)=>{const He=me.toLowerCase(),Ye=me.replace(/\s*\.\s*/g,".").toLowerCase();if(/^https?:\/\//i.test(me)||/^www\s*\./i.test(me)){const hn=Y==null?void 0:Y.sources.find(sn=>{const Jn=oi(sn.url);return Jn&&Ye.includes(Jn)});if(hn){const sn=hn.url,Jn=_===sn,sr=A===sn,ar=hn.context||hn.title,as=o.jsxs("a",{href:Bx(sn),target:"_blank",rel:"noopener noreferrer","data-highlight-source":sn,className:ne("px-1 rounded cursor-pointer transition-all duration-200 highlight-marker inl
4955ine-flex items-center gap-1",sr&&"bg-blue-500 !text-white ring-2 ring-blue-500 ring-offset-2",Jn&&!sr&&"bg-blue-500/30",!Jn&&!sr&&"bg-blue-500/10"),onMouseEnter:()=>j(sn),onMouseLeave:()=>j(null),children:[me,o.jsx(Wr,{className:"h-3 w-3 inline-block opacity-70"})]});return ar?o.jsxs(Ft,{children:[o.jsx(Ut,{asChild:!0,children:as}),o.jsx(zt,{side:"top",className:"max-w-xs",children:o.jsx("p",{className:"text-xs line-clamp-3",children:ar})})]},Fe):o.jsx("span",{children:as},Fe)}}if(ce.has(Ye)||Array.from(ce).some(hn=>Ye.includes(hn))){const hn=Y==null?void 0:Y.sources.find(Cs=>{const en=oi(Cs.url);return en&&(Ye===en||Ye.includes(en))}),sn=(hn==null?void 0:hn.url)||"",Jn=_===sn,sr=A===sn,ar=(hn==null?void 0:hn.context)||(hn==null?void 0:hn.title),as=o.jsxs("a",{href:Bx(sn),target:"_blank",rel:"noopener noreferrer","data-highlight-source":sn,className:ne("px-1 rounded cursor-pointer transition-all duration-200 highlight-marker inline-flex items-center gap-1",sr&&"bg-blue-500 !text-white ring-2 ring-blue-500 ring-offset-2",Jn&&!sr&&"bg-blue-500/30",!Jn&&!sr&&"bg-blue-500/10"),onMouseEnter:()=>hn&&j(sn),onMouseLeave:()=>j(null),children:[me,o.jsx(Wr,{className:"h-3 w-3 inline-block opacity-70"})]});return ar?o.jsxs(Ft,{children:[o.jsx(Ut,{asChild:!0,children:as}),o.jsx(zt,{side:"top",className:"max-w-xs",children:o.jsx("p",{className:"text-xs line-clamp-3",children:ar})})]},Fe):o.jsx("span",{children:as},Fe)}if(Oe.some(hn=>hn.toLowerCase()===He)||He===De){const hn=He===De,sn=fe.find(Ee=>Ee.originalName&&Ee.originalName.toLowerCase()===He),Jn=sn&&sn.wasNormalized,sr=hn?l:we.find(Ee=>Ee.toLowerCase()===He)||Ie.find(Ee=>Ee.toLowerCase()===He)||Ue.find(Ee=>Ee.toLowerCase()===He),ar=sr?V((sn==null?void 0:sn.normalizedName)||sr):me,as=w===ar,Cs=N===ar,en=fe.find(Ee=>Ee.name.toLowerCase()===ar.toLowerCase()),Z=[];if(Jn&&sn&&Z.push(`Normalized to "${sn.normalizedName}"`),en!=null&&en.isBrand&&Z.push("Your Brand"),en!=null&&en.rankPosition&&Z.push(`Rank #${en.rankPosition}`),en!=null&&en.sentimentLabel){const Ee=en.sentimentScore!==void 0?`${en.sentimentLabel} (${en.sentimentScore}%)`:en.sentimentLabel;Z.push(Ee)}en!=null&&en.isRecommended&&!(en!=null&&en.isBrand)&&Z.push("Recommended");const Se=Z.length>0?Z.join(" • "):null,ke=o.jsxs("span",{"data-highlight-competitor":ar,className:ne("px-1 rounded cursor-pointer transition-all duration-200 highlight-marker inl
4955ine-flex items-center gap-0.5",Cs&&"bg-primary text-primary-foreground ring-2 ring-primary ring-offset-2",as&&!Cs&&"bg-primary/30",!as&&!Cs&&"bg-primary/10"),onMouseEnter:()=>v(ar),onMouseLeave:()=>v(null),onClick:()=>Q(ar),children:[me,Jn&&o.jsx(xr,{className:"h-3 w-3 inline-block opacity-70"})]});return Se?o.jsxs(Ft,{children:[o.jsx(Ut,{asChild:!0,children:ke}),o.jsx(zt,{side:"top",className:"max-w-xs",children:o.jsx("p",{className:"text-xs",children:Se})})]},Fe):o.jsx("span",{children:ke},Fe)}return me})},[fe,Y,w,N,_,A,p,ce,l,Q,oe]),ye=b.useCallback(ae=>{if(!ae||!Y)return null;const we=oi(ae);if(!we)return null;for(const Ie of Y.sources){const Ue=oi(Ie.url),Oe=Ie.originalUrl?oi(Ie.originalUrl):null;if(Ue===we||Oe===we||ae.includes(Ue))return Ie}return null},[Y]),re=({content:ae})=>o.jsx(WT,{remarkPlugins:[v6],components:{p:({children:we})=>o.jsx("p",{className:"mb-4 last:mb-0",children:he(we)}),li:({children:we})=>o.jsx("li",{className:"mb-1",children:he(we)}),strong:({children:we})=>o.jsx("strong",{className:"font-semibold",children:he(we)}),em:({children:we})=>o.jsx("em",{className:"italic",children:he(we)}),a:({href:we,children:Ie})=>{const Ue=we?ye(we):null;if(Ue){const Oe=Ue.url,ie=_===Oe,De=A===Oe;return o.jsxs(Ft,{children:[o.jsx(Ut,{asChild:!0,children:o.jsxs("a",{href:Bx(we||""),target:"_blank",rel:"noopener noreferrer","data-highlight-source":Oe,className:ne("px-1 rounded cursor-pointer transition-all duration-200 highlight-marker inl
4955ine-flex items-center gap-1",De&&"bg-blue-500 !text-white ring-2 ring-blue-500 ring-offset-2",ie&&!De&&"bg-blue-500/30",!ie&&!De&&"bg-blue-500/10 text-blue-600"),onMouseEnter:()=>j(Oe),onMouseLeave:()=>j(null),onClick:Ve=>{Ve.preventDefault(),oe(Oe),window.open(Bx(we||""),"_blank")},children:[Ie,o.jsx(Wr,{className:"h-3 w-3 inline-block opacity-70"})]})}),o.jsxs(zt,{side:"top",className:"max-w-xs",children:[o.jsx("p",{className:"font-medium text-xs",children:Ue.title||oi(Oe)}),Ue.context&&o.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:Ue.context})]})]})}return o.jsx("a",{href:we,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline",children:Ie})},table:({children:we})=>o.jsx("div",{className:"my-4 overflow-x-auto",children:o.jsx("table",{className:"w-full text-sm !my-0",children:we})}),thead:({children:we})=>o.jsx("thead",{className:"bg-muted/50 border-b",children:we}),tbody:({children:we})=>o.jsx("tbody",{className:"divide-y",children:we}),tr:({children:we})=>o.jsx("tr",{className:"hover:bg-muted/30 transition-colors",children:we}),th:({children:we})=>o.jsx("th",{className:"px-3 py-2 text-left font-semibold text-xs whitespace-nowrap",children:he(we)}),td:({children:we})=>o.jsx("td",{className:"px-3 py-2 text-xs",children:he(we)})},children:ae}),he=ae=>typeof ae=="string"?_e(ae):Array.isArray(ae)?ae.map((we,Ie)=>o.jsx("span",{children:he(we)},Ie)):ae;return x?o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Query Studio",noIndex:!0}),o.jsx("div",{className:"flex h-screen items-center justify-center",children:o.jsx(Me,{className:"h-8 w-8 animate-spin text-primary"})})]}):u?o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Query Studio",noIndex:!0}),o.jsx(on,{delayDuration:200,children:o.jsxs("div",{className:"flex h-[calc(100vh-64px)] overflow-hidden",children:[o.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[o.jsx("div",{className:"border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60 px-6",children:o.jsxs("div",{className:"flex items-center justify-between h-[49px]",children:[o.jsxs("div",{className:"flex items-center gap-3 h-full pr-3",children:[o.jsxs(le,{variant:"outline",size:"sm",onClick:()=>n(`/company/${t}/prompts/${e}`),children:[o.jsx(Ii,{className:"mr-1 h-4 w-4"}),"Back"]}),o.jsx("div",{className:"h-full w-px bg-border"}),o.jsx("h1",{className:"text-lg font-semibold line-clamp-1",children:"Studio View"})]}),Y&&o.jsxs("div",{className:"flex items-center h-full gap-3",children:[o.jsx("div",{className:"h-full w-px bg-border"}),Y.llmProvider.logoUrl?o.jsx(Hn,{src:Y.llmProvider.logoUrl,alt:"",className:"h-6 w-6 min-w-6 rounded object-contain"}):o.jsx("div",{className:"flex h-6 w-6 min-w-6 items-center justify-center rounded bg-muted text-xs",children:Y.llmProvider.name.charAt(0)})]})]})}),o.jsxs("div",{ref:O,className:"flex-1 overflow-y-auto relative",children:[o.jsxs("div",{ref:L,className:"max-w-4xl mx-auto py-8 px-6 pr-10 space-y-6",children:[o.jsxs("div",{className:"flex gap-4",children:[o.jsx("div",{className:"shrink-0",children:o.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-muted border overflow-hidden",children:c?o.jsx("img",{src:c,alt:"",className:"h-full w-full object-contain"}):o.jsx(Az,{className:"h-5 w-5 text-muted-foreground"})})}),o.jsxs("div",{className:"flex-1 space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"font-semibold",children:l}),o.jsx("span",{className:"text-xs text-muted-foreground",children:"You"})]}),o.jsx("div",{className:"rounded-2xl rounded-tl-none bg-muted p-4",children:o.jsx("p",{className:"text-sm",children:(Y==null?void 0:Y.promptUsed)||u.promptText})})]})]}),Y&&o.jsxs("div",{className:"flex gap-4",children:[o.jsx("div",{className:"shrink-0",children:o.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-primary/10 border overflow-hidden",children:Y.llmProvider.logoUrl?o.jsx(Hn,{src:Y.llmProvider.logoUrl,alt:"",className:"h-6 w-6 object-contain"}):o.jsx(ga,{className:"h-5 w-5 text-primary"})})}),o.jsxs("div",{className:"flex-1 space-y-2 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"font-semibold",children:Y.llmProvider.displayName}),o.jsx("span",{className:"text-xs text-muted-foreground",children:"AI"}),Y.isMentioned&&o.jsx(Ge,{variant:"default",className:"text-xs",children:"Mentioned"}),Y.rankPosition!==null&&o.jsxs(Ge,{variant:"outline",className:"text-xs",children:["Rank #",Y.rankPosition]})]}),o.jsx("div",{className:"rounded-2xl rounded-tl-none bg-card border p-4",children:(pe=Y.structuredResponse)!=null&&pe.textBlocks&&Y.structuredResponse.textBlocks.length>0?o.jsxs("div",{className:"text-sm",children:[Y.structuredResponse.textBlocks.map((ae,we)=>{var Ie;return o.jsx(HTt,{block:ae,references:((Ie=Y.structuredResponse)==null?void 0:Ie.references)||[],onRefHover:Ue=>{var ie,De;M(Ue);const Oe=(De=(ie=Y.structuredResponse)==null?void 0:ie.references)==null?void 0:De.find(Ve=>Ve.index===Ue);if(Oe){const Ve=oi(Oe.link),xe=Y.sources.find($e=>oi($e.url)===Ve);xe&&j(xe.url)}},onRefLeave:()=>{M(null),j(null)},onRefClick:Ue=>{var ie,De;R(I===Ue?null:Ue);const Oe=(De=(ie=Y.structuredResponse)==null?void 0:ie.references)==null?void 0:De.find(Ve=>Ve.index===Ue);if(Oe){const Ve=oi(Oe.link),xe=Y.sources.find($e=>oi($e.url)===Ve);xe&&C(A===xe.url?null:xe.url)}},hoveredRef:k,focusedRef:I,highlightText:_e},we)}),((je=Y.structuredResponse)==null?void 0:je.references)&&Y.structuredResponse.references.length>0&&o.jsx(WTt,{references:Y.structuredResponse.references,hoveredRefIndex:k,focusedRefIndex:I,onRefHover:ae=>{var Ie,Ue;M(ae);const we=(Ue=(Ie=Y.structuredResponse)==null?void 0:Ie.references)==null?void 0:Ue.find(Oe=>Oe.index===ae);if(we){const Oe=oi(we.link),ie=Y.sources.find(De=>oi(De.url)===Oe);ie&&j(ie.url)}},onRefLeave:()=>{M(null),j(null)},onRefClick:ae=>{var Ie,Ue;R(I===ae?null:ae);const we=(Ue=(Ie=Y.structuredResponse)==null?void 0:Ie.references)==null?void 0:Ue.find(Oe=>Oe.index===ae);if(we){const Oe=oi(we.link),ie=Y.sources.find(De=>oi(De.url)===Oe);ie&&C(A===ie.url?null:ie.url)}}})]}):Y.rawResponse?o.jsx("div",{className:"prose-markdown text-sm",children:o.jsx(re,{content:Y.rawResponse})}):o.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No response content available for this run."})}),o.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx(vT,{className:"h-3 w-3"}
4955),new Date(Y.createdAt).toLocaleString()]}),o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx(uc,{className:"h-3 w-3"}),Y.competitorsMentioned.length," competitors"]}),o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx(iu,{className:"h-3 w-3"}),Y.sources.length," sources"]})]})]})]}),!Y&&o.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[o.jsx(ga,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),o.jsx("p",{children:"No runs available yet."}),o.jsx("p",{className:"text-sm",children:"Wait for the query to run or trigger a manual run."})]})]}),o.jsx("div",{className:"absolute right-2 top-0 w-[5px] bg-muted/30 rounded-full pointer-events-none",style:{height:H||"100%"},children:B.length>0&&H>0&&B.map((ae,we)=>{const Ie=ae.top/H*100;return o.jsx("div",{className:ne("absolute left-1/2 -translate-x-1/2 w-2 h-2 rounded-full transition-all duration-200",ae.type==="competitor"?N?"bg-primary":"bg-primary/60":A?"bg-blue-500":"bg-blue-500/60"),style:{top:`${Ie}%`}},we)})})]})]}),o.jsxs("div",{className:"w-80 border-l bg-muted/30 flex flex-col h-full",children:[o.jsxs("div",{className:"h-1/3 flex flex-col",children:[o.jsx("h3",{className:"h-[50px] shrink-0 font-medium text-sm bg-card px-6 py-0 flex items-center gap-2 border-b",children:"Recent Runs"}),o.jsxs("div",{ref:F,className:"flex-1 overflow-y-auto",children:[o.jsx("div",{className:"px-4 py-3",children:o.jsxs("div",{className:"relative",children:[o.jsx(Xa,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(gt,{placeholder:"Search runs...",value:E,onChange:ae=>P(ae.target.value),className:"pl-8 h-8 text-sm"})]})}),o.jsxs("div",{children:[$.slice(0,20).map(ae=>o.jsxs("button",{"data-sidebar-run":ae.id,onClick:()=>i({run:ae.id,...q?{competitor:q}:{}}),className:ne("w-full flex items-center gap-2 px-6 py-3 text-left text-sm transition-colors border-t",(Y==null?void 0:Y.id)===ae.id?"bg-muted text-foreground":"hover:bg-accent"),children:[ae.llmProvider.logoUrl?o.jsx(Hn,{src:ae.llmProvider.logoUrl,alt:"",className:ne("h-6 w-6 rounded-full object-contain bg-accent shrink-0 border p-1",(Y==null?void 0:Y.id)===ae.id&&"border-primary")}):o.jsx("div",{className:ne("flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-background border text-xs",(Y==null?void 0:Y.id)===ae.id&&"border-primary"),children:ae.llmProvider.name.charAt(0)}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-medium truncate text-xs",children:ae.llmProvider.displayName}),o.jsx("p",{className:ne("text-[10px] truncate",(Y==null?void 0:Y.id)===ae.id?"text-foreground/70":"text-muted-foreground"),children:bl(ae.createdAt,new Date)})]}),ae.isMentioned&&o.jsx(Ge,{variant:(Y==null?void 0:Y.id)===ae.id?"secondary":"default",className:"text-[10px] h-5 px-1.5",children:o.jsx(Sn,{className:"h-3 w-3"})})]},ae.id)),$.length===0&&o.jsx("p",{className:"text-xs text-muted-foreground text-center py-4",children:"No runs found"})]})]})]}),o.jsxs("div",{className:"h-1/3 flex flex-col",children:[o.jsxs("h3",{className:"h-[50px] shrink-0 text-sm bg-card font-medium px-6 py-0 flex items-center gap-2 justify-between border-y",children:[o.jsx("span",{className:"flex gap-2 items-center",children:"Competitors"}),fe.length>0&&o.jsx(Ge,{variant:"outline",className:"text-xs",children:fe.length})]}),o.jsx("div",{ref:T,className:"flex-1 overflow-y-auto",children:o.jsxs("div",{className:"",children:[fe.map(ae=>o.jsxs("button",{"data-sidebar-competitor":ae.name,onMouseEnter:()=>v(ae.name),onMouseLeave:()=>v(null),onClick:()=>se(ae.name),className:ne("w-full flex items-center gap-2 px-6 py-3 text-left text-sm transition-all border-b last:border-b-none",N===ae.name&&"bg-muted",w===ae.name&&N!==ae.name&&"bg-muted",w!==ae.name&&N!==ae.name&&"hover:bg-accent"),children:[o.jsx("div",{className:ne("h-6 w-6 shrink-0 rounded-full bg-muted border overflow-hidden",N===ae.name&&"border-primary"),children:ae.faviconUrl&&o.jsx("img",{src:ae.faviconUrl,alt:"",className:"h-full w-full object-contain"})}),o.jsx("div",{className:"flex-1 min-w-0",children:o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("p",{className:"font-medium truncate text-xs",children:ae.name}),ae.isBrand&&o.jsx(Ge,{variant:"secondary",className:"text-[9px] h-4 px-1 shrink-0",children:"You"}),ae.wasNormalized&&!ae.isBrand&&o.jsxs(Ft,{children:[o.jsx(Ut,{asChild:!0,children:o.jsx(xr,{className:ne("h-3 w-3 shrink-0 cursor-help text-muted-foreground")})}),o.jsx(zt,{side:"left",className:"max-w-[250px]",children:o.jsxs("p",{className:"text-xs",children:[o.jsxs("span",{className:"font-medium",children:['"',ae.originalName,'"']})," was normalized to"," ",o.jsxs("span",{className:"font-medium",children:['"',ae.n
4955ormalizedName,'"']})," for consistency"]})})]})]})}),ae.rankPosition!==void 0&&ae.rankPosition!==null&&o.jsxs(Ge,{variant:N===ae.name?"secondary":"outline",className:"text-[10px] h-5 px-1.5",children:["#",ae.rankPosition]})]},ae.name)),fe.length===0&&o.jsx("p",{className:"text-xs text-muted-foreground text-center py-4",children:"No competitors found in this run"})]})})]}),o.jsxs("div",{className:"h-1/3 flex flex-col border-t",children:[o.jsxs("h3",{className:"h-[50px] shrink-0 font-medium text-sm bg-card px-6 py-0 flex items-center gap-2 justify-between border-b",children:[o.jsx("span",{className:"flex gap-2 items-center",children:"Sources"}),Y&&Y.sources.length>0&&o.jsx(Ge,{variant:"outline",className:"text-xs",children:Y.sources.length})]}),o.jsx("div",{ref:D,className:"flex-1 overflow-y-auto",children:o.jsxs("div",{className:"",children:[Y==null?void 0:Y.sources.map((ae,we)=>{var De;const Ie=oi(ae.url);let Ue=null;if((De=Y.structuredResponse)!=null&&De.references){const Ve=oi(ae.url),xe=Y.structuredResponse.references.find($e=>oi($e.link)===Ve||$e.link.includes(Ve));xe&&(Ue=xe.index)}const Oe=A===ae.url||Ue!==null&&I===Ue,ie=_===ae.url||Ue!==null&&k===Ue;return o.jsxs("button",{"data-sidebar-source":ae.url,onMouseEnter:()=>{j(ae.url),Ue!==null&&M(Ue)},onMouseLeave:()=>{j(null),M(null)},onClick:()=>U(ae.url),className:ne("w-full flex items-center gap-2 px-6 py-3 text-left text-sm transition-all border-b last:border-b-none",Oe&&"bg-muted",ie&&!Oe&&"bg-muted",!ie&&!Oe&&"hover:bg-accent"),children:[o.jsx("div",{className:ne("h-6 w-6 shrink-0 rounded-full bg-muted border overflow-hidden",Oe&&"border-primary"),children:o.jsx("img",{src:`https://www.google.com/s2/favicons?domain=${Ie}&sz=32`,alt:"",className:"h-full w-full object-contain"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-medium truncate text-xs",children:ae.title||Ie||ae.url}),o.jsx("p",{className:ne("text-[10px] truncate",Oe?"text-foreground/70":"text-muted-foreground"),children:ae.context||Ie})]}),o.jsx("a",{href:Bx(ae.url),target:"_blank",rel:"noopener noreferrer",onClick:Ve=>Ve.stopPropagation(),className:"p-1 rounded hover:bg-accent transition-colors text-muted-foreground",children:o.jsx(Wr,{className:"h-3 w-3"})})]},`${ae.url}-${we}`)}),(!Y||Y.sources.length===0)&&o.jsx("p",{className:"text-xs text-muted-foreground text-center py-4",children:"No sources found in this run"})]})})]})]})]})})]}):o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Query Studio",noIndex:!0}),o.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-4",children:[o.jsx("p",{className:"text-muted-foreground",children:"Query not found"}),o.jsxs(le,{variant:"outline",onClick:()=>n(-1),children:[o.jsx(Ii,{className:"h-4 w-4"}),"Go Back"]})]})]})}function pF({options:t,value:e,onValueChange:n,placeholder:r="Select...",searchPlaceholder:i="Search...",emptyText:s="No results found.",className:a,disabled:l=!1}){const[c,u]=b.useState(!1),d=t.find(f=>f.value===e);return o.jsxs(ou,{open:c,onOpenChange:u,children:[o.jsx(lu,{asChild:!0,children:o.jsxs(le,{variant:"outline",role:"combobox","aria-expanded":c,className:ne("w-full justify-between",a),disabled:l,children:[o.jsx("span",{className:"truncate",children:d?d.label:r}),o.jsx(bg,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),o.jsx(pc,{className:"w-[--radix-popover-trigger-width] p-0",align:"start",children:o.jsxs(Kh,{children:[o.jsx(Yh,{placeholder:i}),o.jsxs(zz,{children:[o.jsx(Xh,{children:s}),o.jsx(_d,{children:t.map(f=>o.jsxs(Sd,{value:f.label,onSelect:()=>{n==null||n(f.value===e?"":f.value),u(!1)},children:[o.jsx(Sn,{className:ne("mr-2 h-4 w-4 shrink-0",e===f.value?"opacity-100":"opacity-0")}),o.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"truncate",children:f.label}),f.badge&&o.jsx(Ge,{variant:"secondary",className:"text-xs shrink-0",children:f.badge})]}),f.description&&o.jsx("span",{className:"text-xs text-muted-foreground truncate",children:f.description})]})]},f.value))})]})]})})]})}function qTt(){const{companyId:t}=Gr(),e=Nr(),n=Ig(),[r,i]=b.useState([]),[s,a]=b.useState(!0),[l,c]=b.useState(!1),[u,d]=b.useState(!1),[f,h]=b.useState(""),[p,m]=b.useState(new Set),[x,y]=b.useState(!1),[g,w]=b.useState("visibility"),[v,N]=b.useState("desc"),[S,_]=b.useState({name:"",website:"",country:""}),[j,A]=b.useState(!1),[C,k]=b.useState(null),[M,I]=b.useState(""),[R,E]=b.useState(!1),[P,O]=b.useState(null),[L,T]=b.useState(!1),[D,F]=b.useState(!1),{profile:q}=Rr(),[B,z]=b.useState(!1),[H,W]=b.useState(""),[G,K]=b.useState(!1),[ee,V]=b.useState(1),J=10;b.useEffect(()=>{t&&Y()},[t]);const Y=async()=>{try{a(!0);const ie=await Ce.get(`/companies/${t}/competitors`);i(ie)}catch(ie){ge.error(ie.message||"Failed to fetch competitors")}finally{a(!1)}},$=async()=>
4955{if(!S.name.trim()){ge.error("Please enter a competitor name");return}d(!0);try{const ie=await Ce.post(`/companies/${t}/competitors`,{name:S.name.trim(),website:S.website.trim()||void 0,country:S.country.trim()||void 0});i([ie,...r]),_({name:"",website:"",country:""}),c(!1),ge.success("Competitor added successfully")}catch(ie){ge.error(ie.message||"Failed to add competitor")}finally{d(!1)}},fe=async ie=>{try{await Ce.patch(`/companies/${t}/competitors/${ie.id}`,{isHidden:!0}),i(r.filter(De=>De.id!==ie.id)),ge.success(`"${ie.name}" marked as not a competitor`)}catch(De){ge.error(De.message||"Failed to update competitor")}},ce=async(ie,De)=>{De.stopPropagation();const Ve=!ie.isFavorite;i(r.map(xe=>xe.id===ie.id?{...xe,isFavorite:Ve}:xe));try{await Ce.patch(`/companies/${t}/competitors/${ie.id}`,{isFavorite:Ve}),ge.success(Ve?`"${ie.name}" added to favorites`:`"${ie.name}" removed from favorites`)}catch(xe){i(r.map($e=>$e.id===ie.id?{...$e,isFavorite:!Ve}:$e)),ge.error(xe.message||"Failed to update competitor")}},ve=async ie=>{if(confirm("Are you sure you want to delete this competitor?"))try{await Ce.delete(`/companies/${t}/competitors/${ie}`),i(r.filter(De=>De.id!==ie)),ge.success("Competitor deleted")}catch(De){ge.error(De.message||"Failed to delete competitor")}},X=async()=>{if(p.size!==0){y(!0);try{await Promise.all(Array.from(p).map(De=>Ce.patch(`/companies/${t}/competitors/${De}`,{isHidden:!0}))),i(r.filter(De=>!p.has(De.id)));const ie=p.size;m(new Set),ge.success(`${ie} competitor${ie!==1?"s":""} marked as not competitors`)}catch(ie){ge.error(ie.message||"Failed to hide competitors")}finally{y(!1)}}},de=ie=>{k(ie),I(""),A(!0)},Te=async()=>{if(!(!C||!M)){d(!0);try{await Ce.post(`/companies/${t}/competitors/${C.id}/merge`,{targetCompetitorId:M}),ge.success(`Merged "${C.name}" into another competitor`),A(!1),k(null),I(""),Y()}catch(ie){ge.error(ie.message||"Failed to merge competitor")}finally{d(!1)}}},Pe=()=>{W(""),z(!0)},se=async()=>{if(!(p.size===0||!H)){K(!0);try{await Promise.all(Array.from(p).map(De=>Ce.post(`/companies/${t}/competitors/${De}/merge`,{targetCompetitorId:H})));const ie=p.size;ge.success(`Merged ${ie} competitor${ie!==1?"s":""} successfully`),z(!1),W(""),m(new Set),Y()}catch(ie){ge.error(ie.message||"Failed to merge competitors")}finally{K(!1)}}},U=b.useMemo(()=>r.filter(ie=>p.has(ie.id)).map(ie=>ie.name),[r,p]),Q=async()=>{if(t){F(!0);try{const ie=await Ce.get(`/companies/${t}/competitors/auto-merge/cost`);O(ie)}catch(ie){ge.error(ie.message||"Failed to get auto-merge cost"),O(null)}finally{F(!1)}}},oe=async()=>{if(!(!t||!P)){T(!0);try{const ie=await Ce.post(`/companies/${t}/competitors/auto-merge`);ie.mergesPerformed>0?ge.success(`Auto-merge complete! ${ie.mergesPerformed} competitors merged.`):ie.suggestionsFound===0?ge.info("No duplicate competitors found. Your list looks clean!"):ge.info("Analysis complete but no merges were performed."),E(!1),Y()}catch(ie){ge.error(ie.message||"Failed to auto-merge competitors")}finally{T(!1)}}},_e=ie=>{m(ie?new Set(pe.map(De=>De.id)):new Set)},ye=(ie,De)=>{const Ve=new Set(p);De?Ve.add(ie):Ve.delete(ie),m(Ve)},{favoriteCompetitors:re,regularCompetitors:he}=b.useMemo(()=>{const ie=r.filter($e=>$e.name.toLowerCase().includes(f.toLowerCase())),De=($e,ue)=>{var Le,tt,St,rt,vt,me,Fe,He;let Ne=0;switch(g){case"name":Ne=$e.name.localeCompare(ue.name);break;case"visibility":Ne=(((Le=$e.stats)==null?void 0:Le.visibility)??0)-(((tt=ue.stats)==null?void 0:tt.visibility)??0);break;case"avgRank":const Ye=((St=$e.stats)==null?void 0:St.avgRank)??1/0,Nt=((rt=ue.stats)==null?void 0:rt.avgRank)??1/0;Ne=Ye-Nt;break;case"sentiment":const qt=((vt=$e.stats)==null?void 0:vt.avgSentiment)??0,Jt=((me=ue.stats)==null?void 0:me.avgSentiment)??0;Ne=qt-Jt;break;case"mentions":Ne=(((Fe=$e.stats)==null?void 0:Fe.mentionCount)??0)-(((He=ue.stats)==null?void 0:He.mentionCount)??0);break;case"lastFound":const ea=$e.lastMentionedAt?new Date($e.lastMentionedAt).getTime():0,hn=ue.lastMentionedAt?new Date(ue.lastMentionedAt).getTime():0;Ne=ea-hn;break}return v==="asc"?Ne:-Ne},Ve=ie.filter($e=>$e.isFavorite).sort(De),xe=ie.filter($e=>!$e.isFavorite).sort(De);return{favoriteCompetitors:Ve,regularCompetitors:xe}},[r,f,g,v]),pe=b.useMemo(()=>[...re,...he],[re,he]),je=Math.ceil(he.length/J),ae=b.useMemo(()=>{const ie=(ee-1)*J;return he.slice(ie,ie+J)},[he,ee,J]);b.useMemo(()=>{V(1)},[f]);const we=ie=>{g===ie?N(v==="asc"?"desc":"asc"):(w(ie),N("asc"))},Ie=pe.length>0&&p.size===pe.length,Ue=p.size>0&&p.size<pe.length,Oe=ie=>g===ie&&v==="asc"?Kc:ms;return o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Competitors",noIndex:!0}),o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4 py-3 border-b bg-background px-6 sticky top-0 z-10",children:[o.jsxs("div",{className:"relative flex-1 max-w-md",children:[o.jsx(Xa,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),o.jsx(gt,{placeholder:"Search competitors...",value:f,onChange:ie=>h(ie.target.value),className:"pl-9 h-9"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(le,{variant:"outline",size:"sm",onClick:()=>e(`/company/${t}/competitors/hidden`),children:[o.jsx(bz,{className:"h-3.5 w-3.5"}),"Archived"]}),o.jsxs(le,{variant:"outline",size:"sm",onClick:()=>{Q(),E(!0)},children:[o.jsx(pr,{className:"h-3.5 w-3.5"}),"Auto merge"]}),o.jsxs(le,{size:"sm",onClick:()=>c(!0),children:[o.jsx(yi,{className:"h-3.5 w-3.5"}),"Add new"]})]})]}),o.jsxs("div",{className:"flex flex-1 flex-col",children:[p.size>0&&o.jsxs("div",{className:"flex items-center gap-3 px-6 h-12 border-b",children:[o.jsxs("span",{className:"text-sm font-medium",children:[p.size," selected"]}),o.jsxs(le,{variant:"outline",size:"sm",onClick:Pe,disabled:x||G,children:[o.jsx(fw,{className:"h-4 w-4"}),"Merge ",p.size," into..."]}),o.jsxs(le,{variant:"outline",size:"sm",onClick:X,disabled:x||G,children:[x?o.jsx(Me,{className:"h-4 w-4 animate-spin"}):o.jsx(Dse,{className:"h-4 w-4"}),"Hide Selected"]}),o.jsx(le,{variant:"outline",size:"sm",onClick:()=>m(new Set),className:"ml-auto",children:"Clear selection"})]}),s?o.jsx("div",{className:"flex h-full flex-1 items-center justify-center",children:o.jsx(Me,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.length===0?o.jsx("div",{className:"flex h-full flex-1 items-center justify-center",children:o.jsxs("div",{className:"text-center max-w-md",children:[o.jsx("h3",{className:"mt-4 text-xl font-semibold",children:"No competitors yet"}),o.jsx("p",{className:"mt-2 text-muted-foreground",children:"Competitors will be automatically discovered when queries run. You can also add them manually."}),o.jsxs(le,{className:"mt-6",onClick:()=>c(!0),children:[o.jsx(yi,{className:"h-4 w-4"}),"Add Competitor"]})]})}):o.jsxs(o.Fragment,{children:[re.length>0&&o.jsxs("div",{className:"border-b",children:[o.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground px-6 h-12 border-b",children:[o.jsx(wm,{className:"h-4 w-4 fill-yellow-500 text-yellow-500"}),"Favorites (",re.length,")"]}),o.jsx("div",{className:"overflow-hidden",children:o.jsx("div",{className:"overflow-x-auto",children:o.jsxs("table",{className:"w-full card-table",children:[o.jsx("thead",{className:"h-12 border-b",children:o.jsxs("tr",{children:[o.jsx("th",{className:"w-12 max-w-12",children:o.jsx(Yr,{checked:Ie,indeterminate:Ue,onChange:ie=>_e(ie.target.checked)})}),o.jsx("th",{className:"w-10 max-w-10 text-center"}),o.jsx("th",{className:"px-3 text-left text-xs font-medium text-muted-foreground tracking-wider whitespace-nowrap cursor-pointer hover:text-foreground transition-colors",onClick:()=>we("name"),children:o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("span",{className:ne(g==="name"&&"text-foreground font-bold"),children:"Competitor"}),(()=>{const ie=Oe("name");return o.jsx(ie,{className:ne("h-3 w-3",g==="name"?"text-foreground":"text-muted-foreground
4955/50")})})()]})}),o.jsx("th",{className:"px-3 text-center text-xs font-medium text-muted-foreground tracking-wider whitespace-nowrap cursor-pointer hover:text-foreground transition-colors",onClick:()=>we("avgRank"),children:o.jsxs("div",{className:"flex items-center justify-center gap-1",children:[o.jsx("span",{className:ne(g==="avgRank"&&"text-foreground font-bold"),children:"Avg. Rank"}),(()=>{const ie=Oe("avgRank");return o.jsx(ie,{className:ne("h-3 w-3",g==="avgRank"?"text-foreground":"text-muted-foreground/50")})})()]})}),o.jsx("th",{className:"px-3 text-center text-xs font-medium text-muted-foreground tracking-wider whitespace-nowrap cursor-pointer hover:text-foreground transition-colors",onClick:()=>we("sentiment"),children:o.jsxs("div",{className:"flex items-center justify-center gap-1",children:[o.jsx("span",{className:ne(g==="sentiment"&&"text-foreground font-bold"),children:"Sentiment"}),(()=>{const ie=Oe("sentiment");return o.jsx(ie,{className:ne("h-3 w-3",g==="sentiment"?"text-foreground":"text-muted-foreground/50")})})()]})}),o.jsx("th",{className:"px-3 text-left text-xs font-medium text-muted-foreground tracking-wider whitespace-nowrap",children:"Website"}),o.jsx("th",{className:"px-3 text-left text-xs font-medium text-muted-foreground tracking-wider whitespace-nowrap cursor-pointer hover:text-foreground transition-colors",onClick:()=>we("lastFound"),children:o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("span",{className:ne(g==="lastFound"&&"text-foreground font-bold"),children:"Last Found"}),(()=>{const ie=Oe("lastFound");return o.jsx(ie,{className:ne("h-3 w-3",g==="lastFound"?"text-foreground":"text-muted-foreground/50")})})()]})}),o.jsx("th",{className:"w-10 max-w-10"})]})}),o.jsx("tbody",{className:"divide-y divide-border",children:re.map(ie=>{var De,Ve,xe,$e,ue;return o.jsxs("tr",{className:"h-12 hover:bg-accent/50 transition-colors",children:[o.jsx("td",{className:"w-12 max-w-12 text-center whitespace-nowrap",children:o.jsx(Yr,{checked:p.has(ie.id),onChange:Ne=>ye(ie.id,Ne.target.checked)})}),o.jsx("td",{className:"w-10 max-w-10 text-center whitespace-nowrap",children:o.jsx(le,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:Ne=>ce(ie,Ne),children:o.jsx(wm,{className:ne("h-4 w-4",ie.isFavorite?"fill-yellow-500 text-yellow-500":"text-muted-foreground")})})}),o.jsx("td",{className:"px-3 text-left whitespace-nowrap",children:o.jsxs("button",{className:"flex items-center gap-3 hover:opacity-80 transition-opacity text-left",onClick:()=>e(`/company/${t}/competitors/${ie.id}`),children:[o.jsx(nr,{value:((De=ie.stats)==null?void 0:De.visibility)??0,size:"sm",variant:"percentage",className:"shrink-0"}),o.jsx(ul,{name:ie.name,logoUrl:ie.faviconUrl||ie.logoUrl,website:ie.website,size:"lg",source:ie.source,description:ie.description}),o.jsxs("div",{className:"flex flex-col max-w-[200px]",children:[o.jsx("span",{className:"font-medium hover:underline truncate",children:ie.name}),ie.aliases&&ie.aliases.length>0&&o.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:[ie.aliases.slice(0,2).map(Ne=>Ne.name).join(", "),ie.aliases.length>2&&` +${ie.aliases.length-2}`]})]})]})}),o.jsx("td",{className:"px-3 text-center whitespace-nowrap",children:((Ve=ie.stats)==null?void 0:Ve.avgRank)!==null&&((xe=ie.stats)==null?void 0:xe.avgRank)!==void 0?o.jsx(nr,{value:ie.stats.avgRank,size:"md",variant:"rank",className:"mx-auto"}):o.jsx("span",{className:"text-sm text-muted-foreground",children:"—"})}),o.jsx("td",{className:"px-3 text-center whitespace-nowrap",children:(($e=ie.stats)==null?void 0:$e.avgSentiment)!==null&&((ue=ie.stats)==null?void 0:ue.avgSentiment)!==void 0?o.jsx(xa,{value:ie.stats.avgSentiment,size:"md",className:"justify-center",tooltipTitle:`Avg. sentiment of ${ie.stats.avgSentiment} based on ${ie.stats.mentionCount} mention${ie.stats.mentionCount!==1?"s":""}`}):o.jsx("span",{className:"text-sm text-muted-foreground",children:"—"})}),o.jsx("td",{className:"px-3 text-left whitespace-nowrap",children:ie.website?o.jsx("a",{href:ie.website.startsWith("http")?ie.website:`https://${ie.website}`,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary hover:underline",children:(()=>{try{return new URL(ie.website.startsWith("http")?ie.website:`https://${ie.website}`).hostname.replace(/^www\./,"")}catch{return ie.website.replace(/^(https?:\/\/)?(www\.)?/,"").split("/")[0]}})()}):o.jsx("span",{className:"text-sm text-muted-foreground",children:"—"})}),o.jsx("td",{className:"px-3 text-left whitespace-nowrap",children:o.jsx("span",{className:"text-sm text-muted-foreground",children:ie.lastMentionedAt?bl(ie.lastMentionedAt,n):"—"})}),o.jsx("td",{className:"w-10 text-center whitespace-nowrap",children:o.jsxs(gc,{children:[o.jsx(xc,{asChild:!0,children:o.jsx(le,{variant:"outline",size:"icon",className:"h-8 w-8",children:o.jsx(ru,{className:"h-4 w-4"})})}
4955),o.jsxs(vl,{align:"end",children:[o.jsxs(lr,{onClick:()=>de(ie),children:[o.jsx(fw,{className:"h-4 w-4"})," Merge Into..."]}),o.jsx(Ad,{}),o.jsxs(lr,{onClick:()=>fe(ie),children:[o.jsx(cH,{className:"h-4 w-4"})," Mark Not a Competitor"]}),o.jsxs(lr,{onClick:()=>ve(ie.id),className:"text-destructive focus:text-destructive",children:[o.jsx(Yi,{className:"mr-2 h-4 w-4"})," Delete"]})]})]})})]},ie.id)})})]})})})]}),he.length>0&&o.jsxs("div",{className:"border-b",children:[re.length>0&&o.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground px-6 h-12 border-b",children:[o.jsx(uc,{className:"h-4 w-4"}),"All Competitors (",he.length,")"]}),o.jsx("div",{className:"overflow-hidden",children:o.jsxs("div",{className:"overflow-x-auto",children:[o.jsxs("table",{className:"w-full card-table",children:[o.jsx("thead",{className:"h-12 border-b",children:o.jsxs("tr",{children:[o.jsx("th",{className:"w-12 max-w-12",children:re.length===0&&o.jsx(Yr,{checked:Ie,indeterminate:Ue,onChange:ie=>_e(ie.target.checked)})}),o.jsx("th",{className:"w-10 max-w-10 text-center"}),o.jsx("th",{className:"px-3 text-left text-xs font-medium text-muted-foreground tracking-wider whitespace-nowrap cursor-pointer hover:text-foreground transition-colors",onClick:()=>we("name"),children:o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("span",{className:ne(g==="name"&&"text-foreground font-bold"),children:"Competitor"}),(()=>{const ie=Oe("name");return o.jsx(ie,{className:ne("h-3 w-3",g==="name"?"text-foreground":"text-muted-foreground/50")})})()]})}),o.jsx("th",{className:"px-3 text-center text-xs font-medium text-muted-foreground tracking-wider whitespace-nowrap cursor-pointer hover:text-foreground transition-colors",onClick:()=>we("avgRank"),children:o.jsxs("div",{className:"flex items-center justify-center gap-1",children:[o.jsx("span",{className:ne(g==="avgRank"&&"text-foreground font-bold"),children:"Avg. Rank"}),(()=>{const ie=Oe("avgRank");return o.jsx(ie,{className:ne("h-3 w-3",g==="avgRank"?"text-foreground":"text-muted-foreground/50")})})()]})}),o.jsx("th",{className:"px-3 text-center text-xs font-medium text-muted-foreground tracking-wider whitespace-nowrap cursor-pointer hover:text-foreground transition-colors",onClick:()=>we("sentiment"),children:o.jsxs("div",{className:"flex items-center justify-center gap-1",children:[o.jsx("span",{className:ne(g==="sentiment"&&"text-foreground font-bold"),children:"Sentiment"}),(()=>{const ie=Oe("sentiment");return o.jsx(ie,{className:ne("h-3 w-3",g==="sentiment"?"text-foreground":"text-muted-foreground/50")})})()]})}),o.jsx("th",{className:"px-3 text-left text-xs font-medium text-muted-foreground tracking-wider whitespace-nowrap",children:"Website"}),o.jsx("th",{className:"px-3 text-left text-xs font-medium text-muted-foreground tracking-wider whitespace-nowrap cursor-pointer hover:text-foreground transition-colors",onClick:()=>we("lastFound"),children:o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("span",{className:ne(g==="lastFound"&&"text-foreground font-bold"),children:"Last Found"}),(()=>{const ie=Oe("lastFound");return o.jsx(ie,{className:ne("h-3 w-3",g==="lastFound"?"text-foreground":"text-muted-foreground/50")})})()]})}),o.jsx("th",{className:"w-10 max-w-10"})]})}),o.jsx("tbody",{className:"divide-y divide-border",children:ae.map(ie=>{var De,Ve,xe,$e,ue;return o.jsxs("tr",{className:"h-12 hover:bg-accent/50 transition-colors",children:[o.jsx("td",{className:"w-12 max-w-12 text-center whitespace-nowrap",children:o.jsx(Yr,{checked:p.has(ie.id),onChange:Ne=>ye(ie.id,Ne.target.checked)})}),o.jsx("td",{className:"w-10 max-w-10 text-center whitespace-nowrap",children:o.jsx(le,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:Ne=>ce(ie,Ne),children:o.jsx(wm,{className:ne("h-4 w-4",ie.isFavorite?"fill-yellow-500 text-yellow-500":"text-muted-foreground")})})}),o.jsx("td",{className:"px-3 text-left whitespace-nowrap",children:o.jsxs("button",{className:"flex items-center gap-3 hover:opacity-80 transition-opacity text-left",onClick:()=>e(`/company/${t}/competitors/${ie.id}`),children:[o.jsx(nr,{value:((De=ie.stats)==null?void 0:De.visibility)??0,size:"sm",variant:"percentage",className:"shrink-0"}),o.jsx(ul,{name:ie.name,logoUrl:ie.faviconUrl||ie.logoUrl,website:ie.website,size:"lg",source:ie.source,description:ie.description}),o.jsxs("div",{className:"flex flex-col max-w-[200px]",children:[o.jsx("span",{className:"font-medium hover:underline truncate",children:ie.name}),ie.aliases&&ie.aliases.length>0&&o.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:[ie.aliases.slice(0,2).map(Ne=>Ne.name).join(", "),ie.aliases.length>2&&` +${ie.aliases.length-2}`]})]})]})}),o.jsx("td",{className:"px-3 text-center whitespace-nowrap",children:((Ve=ie.stats)==null?void 0:Ve.avgRank)!==null&&((xe=ie.stats)==null?void 0:xe.avgRank)!==void 0?o.jsx(nr,{value:ie.stats.avgRank,size:"md",variant:"rank",className:"mx-auto"}):o.jsx("span",{className:"text-sm text-muted-foreground",children:"—"})}),o.jsx("td",{className:"px-3 text-center whitespace-nowrap",children:(($e=ie.stats)==null?void 0:$e.avgSentiment)!==null&&((ue=ie.stats)==null?void 0:ue.avgSentiment)!==void 0?o.jsx(xa,{value:ie.stats.avgSentiment,size:"md",className:"justify-center",tooltipTitle:`Avg. sentiment of ${ie.stats.avgSentiment} based on ${ie.stats.mentionCount} mention${ie.stats.mentionCount!==1?"s":""}`}):o.jsx("span",{className:"text-sm text-muted-foreground",children:"—"})}),o.jsx("td",{className:"px-3 text-left whitespace-nowrap",children:ie.website?o.jsx("a",{href:ie.website.startsWith("http")?ie.website:`https://${ie.website}`,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary hover:underline",children:(()=>{try{return new URL(ie.website.startsWith("http")?ie.website:`https://${ie.website}`).hostname.replace(/^www\./,"")}catch{return ie.website.replace(/^(https?:\/\/)?(www\.)?/,"").split("/")[0]}})()}):o.jsx("span",{className:"text-sm text-muted-foreground",children:"—"})}),o.jsx("td",{className:"px-3 text-left whitespace-nowrap",children:o.jsx("span",{className:"text-sm text-muted-foreground",children:ie.lastMentionedAt?bl(ie.lastMentionedAt,n):"—"})}),o.jsx("td",{className:"w-10 text-center whitespace-nowrap",children:o.jsxs(gc,{children:[o.jsx(xc,{asChild:!0,children:o.jsx(le,{variant:"outline",size:"icon",className:"h-8 w-8",children:o.jsx(ru,{className:"h-4 w-4"})})}
4955),o.jsxs(vl,{align:"end",children:[o.jsxs(lr,{onClick:()=>de(ie),children:[o.jsx(fw,{className:"h-4 w-4"})," Merge Into..."]}),o.jsx(Ad,{}),o.jsxs(lr,{onClick:()=>fe(ie),children:[o.jsx(cH,{className:"h-4 w-4"})," Mark Not a Competitor"]}),o.jsxs(lr,{onClick:()=>ve(ie.id),className:"text-destructive focus:text-destructive",children:[o.jsx(Yi,{className:"mr-2 h-4 w-4"})," Delete"]})]})]})})]},ie.id)})})]}),je>1&&o.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-t",children:[o.jsxs("p",{className:"text-sm text-muted-foreground",children:["Showing ",(ee-1)*J+1," to ",Math.min(ee*J,he.length)," of ",he.length," competitors"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(le,{variant:"outline",size:"sm",onClick:()=>V(ie=>Math.max(1,ie-1)),disabled:ee===1,children:o.jsx(wd,{className:"h-4 w-4"})}),o.jsxs("span",{className:"text-sm",children:["Page ",ee," of ",je]}),o.jsx(le,{variant:"outline",size:"sm",onClick:()=>V(ie=>Math.min(je,ie+1)),disabled:ee===je,children:o.jsx(Ga,{className:"h-4 w-4"})})]})]})]})})]})]}),o.jsx(ur,{open:l,onOpenChange:c,children:o.jsxs(tr,{children:[o.jsxs(dr,{children:[o.jsx(fr,{children:"Add Competitor"}),o.jsx(hr,{children:"Manually add a competitor to track alongside your brand"})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{htmlFor:"name",children:"Company Name *"}),o.jsx(gt,{id:"name",placeholder:"e.g., Acme Corp",value:S.name,onChange:ie=>_({...S,name:ie.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{htmlFor:"website",children:"Website"}),o.jsx(gt,{id:"website",placeholder:"e.g., acme.com",value:S.website,onChange:ie=>_({...S,website:ie.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{htmlFor:"country",children:"Country"}),o.jsx(gt,{id:"country",placeholder:"e.g., United States",value:S.country,onChange:ie=>_({...S,country:ie.target.value})})]})]}),o.jsxs(Pr,{children:[o.jsx(le,{variant:"outline",onClick:()=>c(!1),children:"Cancel"}),o.jsxs(le,{onClick:$,disabled:u||!S.name.trim(),children:[u&&o.jsx(Me,{className:"h-4 w-4 animate-spin"}),"Add Competitor"]})]})]})}),o.jsx(ur,{open:j,onOpenChange:ie=>{A(ie),ie||(I(""),k(null))},children:o.jsxs(tr,{children:[o.jsxs(dr,{children:[o.jsx(fr,{children:"Merge Competitor"}),o.jsxs(hr,{children:['Merge "',C==null?void 0:C.name,'" into another competitor. This will combine mention counts and track both names as the same company.']})]}),o.jsx("div",{className:"space-y-4 py-4",children:o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{children:"Merge Into"}),o.jsx(pF,{options:r.filter(ie=>ie.id!==(C==null?void 0:C.id)).sort((ie,De)=>ie.name.localeCompare(De.name)).map(ie=>{var De;return{value:ie.id,label:ie.name,description:`${ie.totalMentions} mentions${ie.website?` • ${ie.website}`:""}`,badge:(De=ie.aliases)!=null&&De.length?`${ie.aliases.length} alias${ie.aliases.length!==1?"es":""}`:void 0}}),value:M,onValueChange:I,placeholder:"Search for a competitor...",searchPlaceholder:"Type to search...",emptyText:"No matching competitors found."}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:['After merging, "',C==null?void 0:C.name,'" will become an alias of the selected competitor.']})]})}),o.jsxs(Pr,{children:[o.jsx(le,{variant:"outline",onClick:()=>A(!1),children:"Cancel"}),o.jsxs(le,{onClick:Te,disabled:u||!M,children:[u&&o.jsx(Me,{className:"h-4 w-4 animate-spin"}),"Merge"]})]})]})}),o.jsx(ur,{open:B,onOpenChange:ie=>{G||(z(ie),ie||W(""))},children:o.jsxs(tr,{children:[o.jsxs(dr,{children:[o.jsxs(fr,{className:"flex items-center gap-2",children:[o.jsx(fw,{className:"h-5 w-5 text-primary"}),"Merge ",p.size," Competitors"]}),o.jsx(hr,{children:"Merge the selected competitors into a single target competitor. All mentions will be combined."})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{children:"Competitors to merge"}),o.jsx("div",{className:"flex flex-wrap gap-1.5 p-3 rounded-lg border bg-muted/50 max-h-32 overflow-y-auto",children:U.map(ie=>o.jsx(Ge,{variant:"secondary",className:"text-xs",children:ie},ie))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{children:"Merge Into"}),o.jsx(pF,{options:r.filter(ie=>!p.has(ie.id)).sort((ie,De)=>ie.name.localeCompare(De.name)).map(ie=>{var De;return{value:ie.id,label:ie.name,description:`${ie.totalMentions} mentions${ie.website?` • ${ie.website}`:""}`,badge:(De=ie.aliases)!=null&&De.length?`${ie.aliases.length} alias${ie.aliases.length!==1?"es":""}`:void 0}}),value:H,onValueChange:W,placeholder:"Search for a competitor...",searchPlaceholder:"Type to search...",emptyText:"No matching competitors found."}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:["After merging, all ",p.size," selected competitors will become aliases of the target competitor."]})]})]}),o.jsxs(Pr,{children:[o.jsx(le,{variant:"outline",onClick:()=>z(!1),disabled:G,children:"Cancel"}),o.jsxs(le,{onClick:se,disabled:G||!H,children:[G&&o.jsx(Me,{className:"h-4 w-4 animate-spin"}),"Merge ",p.size," Competitors"]})]})]})}),o.jsx(ur,{open:R,onOpenChange:ie=>{L||E(ie)},children:o.jsx(tr,{children:L?o.jsxs("div",{className:"flex flex-col items-center justify-center py-12 gap-4",children:[o.jsxs("div",{className:"relative",children:[o.jsx(pr,{className:"h-8 w-8 text-primary animate-pulse"}),o.jsx(Me,{className:"h-16 w-16 animate-spin text-primary/30 absolute -top-4 -left-4"})]}),o.jsxs("div",{className:"text-center space-y-2",children:[o.jsx("h3",{className:"font-semibold text-lg",children:"Analyzing Competitors"}),o.jsxs("p",{className:"text-muted-foreground text-sm max-w-xs",children:["AI is scanning ",(P==null?void 0:P.competitorCount)??0," competitors for potential duplicates. This may take a minute..."]})]})]}):o.jsxs(o.Fragment,{children:[o.jsxs(dr,{children:[o.jsxs(fr,{className:"flex items-center gap-2",children:[o.jsx(pr,{className:"h-5 w-5 text-primary"}),"AI Auto-Merge"]}),o.jsx(hr,{children:"Use AI to automatically identify and merge duplicate competitors. The AI will analyze competitor names, websites, and patterns to find matches."})]}),o.jsx("div",{className:"space-y-4 py-4",children:D?o.jsx("div",{className:"flex items-center justify-center py-8",children:o.jsx(Me,{className:"h-8 w-8 animate-spin text-primary"})}):P?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg border",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(SS,{className:"h-6 w-6 text-muted-foreground"}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"Cost"}),o.jsxs("p",{className:"text-lg font-semibold",children:[P.tokenCost," tokens"]})]})]}),o.jsxs("div",{className:"text-right",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"Analyzing"}),o.jsxs("p",{className:"font-medium",children:[P.competitorCount," competitors"]})]})]}),o.jsxs("div",{className:"rounded-lg border p-3 bg-muted/50",children:[o.jsxs("p",{className:"text-sm",children:[o.jsx("strong",{children:"How it works:"})," The AI will scan all your competitors and identify potential duplicates based on:"]}),o.jsxs("ul",{className:"text-sm text-muted-foreground mt-2 space-y-1",children:[o.jsx("li",{children:'• Name variations (e.g., "Microsoft" vs "Microsoft Corp")'}),o.jsx("li",{children:'• Regional variations (e.g., "Atea" vs "Atea Danmark")'}),o.jsx("li",{children:"• Common misspellings or abbreviations"}),o.jsx("li",{children:"• Parent/subsidiary relationships"})]})]}),q&&q.tokenBalance<P.tokenCost&&o.jsx("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-3",children:o.jsxs("p",{className:"text-sm text-destructive",children:["Insufficient tokens. You have ",q.tokenBalance," tokens but need ",P.tokenCost,"."]})})]}):o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Failed to calculate cost. Please try again."})}),o.jsxs(Pr,{children:[o.jsx(le,{variant:"outline",onClick:()=>E(!1),children:"Cancel"}),o.jsxs(le,{onClick:oe,disabled:L||!P||D||(q?q.tokenBalance<P.tokenCost:!0),children:[o.jsx(pr,{className:"h-4 w-4"}),"Start Auto-Merge (",(P==null?void 0:P.tokenCost)??0," tokens)"]})]})]})})})]})]})]})}function KTt(){const{companyId:t}=Gr(),e=Nr(),n=Ig(),[r,i]=b.useState([]),[s,a]=b.useState(!0),[l,c]=b.useState(""),[u,d]=b.useState(new Set),[f,h]=b.useState(!1);b.useEffect(()=>{t&&p()},[t]);const p=async()=>{try{a(!0);const _=await Ce.get(`/companies/${t}/competitors?includeHidden=true`);i(_.filter(j=>j.isHidden))}catch(_){ge.error(_.message||"Failed to fetch competitors")}finally{a(!1)}},m=async _=>{try{await Ce.patch(`/companies/${t}/competitors/${_.id}`,{isHidden:!1}),ge.success(`"${_.name}" restored`),p()}catch(j){ge.error(j.message||"Failed to restore competitor")}},x=async _=>{try{await Ce.delete(`/companies/${t}/competitors/${_}`),ge.success("Competitor deleted"),p()}catch(j){ge.error(j.message||"Failed to delete competitor")}},y=async()=>
4955{if(u.size!==0){h(!0);try{await Promise.all(Array.from(u).map(_=>Ce.patch(`/companies/${t}/competitors/${_}`,{isHidden:!1}))),ge.success(`${u.size} competitors restored`),d(new Set),p()}catch(_){ge.error(_.message||"Failed to restore competitors")}finally{h(!1)}}},g=r.filter(_=>{var j;return _.name.toLowerCase().includes(l.toLowerCase())||((j=_.website)==null?void 0:j.toLowerCase().includes(l.toLowerCase()))}),w=_=>{d(_?new Set(g.map(j=>j.id)):new Set)},v=(_,j)=>{const A=new Set(u);j?A.add(_):A.delete(_),d(A)},N=g.length>0&&u.size===g.length,S=u.size>0&&u.size<g.length;return s?o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Hidden Competitors",noIndex:!0}),o.jsx("div",{className:"flex h-96 items-center justify-center",children:o.jsx(Me,{className:"h-8 w-8 animate-spin text-primary"})})]}):o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Hidden Competitors",noIndex:!0}),o.jsxs("div",{className:"space-y-6",children:[o.jsx("div",{className:"flex items-center justify-between",children:o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsxs(le,{variant:"ghost",size:"sm",onClick:()=>e(`/company/${t}/competitors`),children:[o.jsx(Ii,{className:"h-4 w-4"}),"Back"]}),o.jsxs("div",{children:[o.jsx("h1",{className:"text-3xl font-bold",children:"Hidden Competitors"}),o.jsx("p",{className:"mt-1 text-muted-foreground",children:'Companies marked as "not a competitor"'})]})]})}),o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsxs("div",{className:"relative flex-1 max-w-sm",children:[o.jsx(Xa,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),o.jsx(gt,{placeholder:"Search hidden competitors...",value:l,onChange:_=>c(_.target.value),className:"pl-9"})]}),u.size>0&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(Ge,{variant:"secondary",children:[u.size," selected"]}),o.jsxs(le,{variant:"outline",size:"sm",onClick:y,disabled:f,children:[f&&o.jsx(Me,{className:"mr-2 h-4 w-4 animate-spin"}),o.jsx(Eh,{className:"h-4 w-4"}),"Restore Selected"]})]})]}),g.length===0?o.jsx("div",{className:"flex h-96 items-center justify-center rounded-lg border border-dashed",children:o.jsxs("div",{className:"text-center max-w-md",children:[o.jsx(uc,{className:"mx-auto h-16 w-16 text-muted-foreground/50"}),o.jsx("h3",{className:"mt-4 text-xl font-semibold",children:"No hidden competitors"}),o.jsx("p",{className:"mt-2 text-muted-foreground",children:'Companies you mark as "not a competitor" will appear here.'})]})}):o.jsx("div",{className:"rounded-lg border overflow-hidden",children:o.jsx("div",{className:"overflow-x-auto",children:o.jsxs("table",{className:"w-full card-table",children:[o.jsx("thead",{className:"bg-muted/50",children:o.jsxs("tr",{children:[o.jsx("th",{className:"w-10 px-4",children:o.jsx(Yr,{checked:N,indeterminate:S,onChange:_=>w(_.target.checked)})}),o.jsx("th",{className:"px-4 text-left text-xs font-medium text-muted-foreground tracking-wider whitespace-nowrap",children:"Competitor"}),o.jsx("th",{className:"px-4 text-center text-xs font-medium text-muted-foreground tracking-wider whitespace-nowrap",children:"Mentions"}),o.jsx("th",{className:"px-4 text-left text-xs font-medium text-muted-foreground tracking-wider whitespace-nowrap",children:"Website"}),o.jsx("th",{className:"px-4 text-left text-xs font-medium text-muted-foreground tracking-wider whitespace-nowrap",children:"Last Found"}),o.jsx("th",{className:"px-4 w-10"})]})}),o.jsx("tbody",{className:"divide-y divide-border",children:g.map(_=>o.jsxs("tr",{className:"hover:bg-accent/50 transition-colors opacity-60",children:[o.jsx("td",{className:"px-4 py-3 whitespace-nowrap",children:o.jsx(Yr,{checked:u.has(_.id),onChange:j=>v(_.id,j.target.checked)})}),o.jsx("td",{className:"px-4 py-3 whitespace-nowrap",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(ul,{name:_.name,logoUrl:_.faviconUrl||_.logoUrl,website:_.website,size:"lg",source:_.source,description:_.description}),o.jsxs("div",{className:"flex flex-col",children:[o.jsx("span",{className:"font-medium",children:_.name}),_.aliases&&_.aliases.length>0&&o.jsxs("span",{className:"text-xs text-muted-foreground",children:[_.aliases.slice(0,2).map(j=>j.name).join(", "),_.aliases.length>2&&` +${_.aliases.length-2}`]})]})]})}),o.jsx("td",{className:"px-4 py-3 text-center whitespace-nowrap",children:o.jsx("span",{className:"font-medium",children:_.totalMentions})}),o.jsx("td",{className:"px-4 py-3 whitespace-nowrap",children:_.website?o.jsx("a",{href:_.website.startsWith("http")?_.website:`https://${_.website}`,target:"_blank",rel:"noopener noreferrer",className:"block text-sm text-primary hover:underline max-w-32 truncate text-ellipsis",children:_.website.replace(/^https?:\/\//,"")}):o.jsx("span",{className:"text-muted-foreground",children:"—"})}),o.jsx("td",{className:"px-4 py-3 whitespace-nowrap text-sm text-muted-foreground",children:_.lastMentionedAt?bl(_.lastMentionedAt,n):"—"}),o.jsx("td",{className:"px-4 py-3 whitespace-nowrap",children:o.jsxs(gc,{children:[o.jsx(xc,{asChild:!0,children:o.jsx(le,{variant:"ghost",size:"icon",className:"h-8 w-8",children:o.jsx(ru,{className:"h-4 w-4"})})}
4955),o.jsxs(vl,{align:"end",children:[o.jsxs(lr,{onClick:()=>m(_),children:[o.jsx(Eh,{className:"h-4 w-4"})," Restore"]}),o.jsxs(lr,{onClick:()=>x(_.id),className:"text-destructive focus:text-destructive",children:[o.jsx(Yi,{className:"mr-2 h-4 w-4"})," Delete Permanently"]})]})]})})]},_.id))})]})})}),r.length>0&&o.jsxs("div",{className:"text-sm text-muted-foreground",children:[g.length," hidden competitor",g.length!==1?"s":""]})]})]})}function YTt(){var B,z,H,W,G,K,ee,V,J,Y;const{companyId:t,competitorId:e}=Gr(),n=Nr(),r=Ig(),[i,s]=b.useState(null),[a,l]=b.useState([]),[c,u]=b.useState(!0),[d,f]=b.useState(!1),[h,p]=b.useState(""),[m,x]=b.useState(!1),[y,g]=b.useState(!1),[w,v]=b.useState(""),[N,S]=b.useState(!1),[_,j]=b.useState(null),[A,C]=b.useState(1),k=10;b.useEffect(()=>{t&&e&&(M(),I())},[t,e]);const M=async()=>{try{u(!0);const $=await Ce.get(`/companies/${t}/competitors/${e}`);s($)}catch($){ge.error($.message||"Failed to fetch competitor"),n(`/company/${t}/competitors`)}finally{u(!1)}},I=async()=>{try{const $=await Ce.get(`/companies/${t}/competitors`);l($)}catch($){console.error("Failed to fetch competitors for merge:",$)}},R=async()=>{if(i)try{await Ce.patch(`/companies/${t}/competitors/${e}`,{isHidden:!0}),ge.success(`"${i.name}" archived`),n(`/company/${t}/competitors`)}catch($){ge.error($.message||"Failed to update competitor")}},E=async()=>{if(!(!i||!h)){x(!0);try{await Ce.post(`/companies/${t}/competitors/${h}/merge`,{aliasId:i.id}),ge.success(`"${i.name}" merged successfully`),n(`/company/${t}/competitors/${h}`)}catch($){ge.error($.message||"Failed to merge competitor")}finally{x(!1),f(!1)}}},P=async()=>{if(!(!i||!w.trim())){x(!0);try{await Ce.post(`/companies/${t}/competitors/${e}/aliases`,{name:w.trim()}),ge.success(`Alias "${w.trim()}" added`),v(""),g(!1),M()}catch($){ge.error($.message||"Failed to add alias")}finally{x(!1)}}},O=async()=>{if(_){x(!0);try{await Ce.delete(`/companies/${t}/competitors/${e}/aliases/${_.id}`),ge.success(`Alias "${_.name}" removed`),j(null),S(!1),M()}catch($){ge.error($.message||"Failed to remove alias")}finally{x(!1)}}},L=$=>{j($),S(!0)},T=b.useMemo(()=>{const $=Array(30).fill({value:0}),fe={visibility:$,rank:$.map(()=>({value:null})),sentiment:$.map(()=>({value:null})),mentions:$};return i!=null&&i.sparklines?i.sparklines:fe},[i==null?void 0:i.sparklines]),D=b.useMemo(()=>a.filter($=>$.id!==e).sort(($,fe)=>$.name.localeCompare(fe.name)).map($=>{var fe;return{value:$.id,label:$.name,description:$.website||void 0,badge:(fe=$.aliases)!=null&&fe.length?`${$.aliases.length} alias${$.aliases.length!==1?"es":""}`:void 0}}),[a,e]),F=b.useMemo(()=>{if(!(i!=null&&i.mentions))return[];const $=(A-1)*k;return i.mentions.slice($,$+k)},[i==null?void 0:i.mentions,A,k]),q=b.useMemo(()=>i!=null&&i.mentions?Math.ceil(i.mentions.length/k):0,[i==null?void 0:i.mentions,k]);return c?o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Competitor",noIndex:!0}),o.jsx("div",{className:"flex h-96 items-center justify-center",children:o.jsx(Me,{className:"h-8 w-8 animate-spin text-primary"})})]}):i?o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:`${i.name} - Competitor`,noIndex:!0}),o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4 py-3 border-b bg-background px-6 sticky top-0 z-10",children:[o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsxs(le,{variant:"outline",size:"sm",onClick:()=>n(`/company/${t}/competitors`),children:[o.jsx(Ii,{className:"mr-1 h-4 w-4"}),"Back"]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(ul,{name:i.name,logoUrl:i.faviconUrl||i.logoUrl,website:i.website,size:"lg",source:i.source,description:i.description}),o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("h1",{className:"text-lg font-semibold",children:i.name}),i.isHidden&&o.jsx(Ge,{variant:"outline",children:"Archived"})]}),i.aliases&&i.aliases.length>0&&o.jsxs("p",{className:"text-xs text-muted-foreground",children:["Also known as: ",i.aliases.slice(0,2).map($=>$.name).join(", "),i.aliases.length>2&&` +${i.aliases.length-2}`]})]})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[i.website&&o.jsx(le,{variant:"outline",size:"sm",asChild:!0,children:o.jsxs("a",{href:i.website.startsWith("http")?i.website:`https://${i.website}`,target:"_blank",rel:"noopener noreferrer",children:[o.jsx(To,{className:"h-4 w-4"}),"Website"]})}),o.jsxs(le,{variant:"outline",size:"sm",onClick:()=>f(!0),children:[o.jsx(fw,{className:"h-4 w-4"}),"Merge"]}),o.jsxs(le,{variant:"outline",size:"sm",onClick:R,children:[o.jsx(bz,{className:"h-4 w-4"}),"Archive"]})]})]}),o.jsxs("div",{className:"flex-1 flex flex-col overflow-y-auto",children:[o.jsxs("div",{className:"grid gap-[1px] bg-border border-b sm:grid-cols-2 lg:grid-cols-4",children:[o.jsxs(Ct,{className:"relative overflow-hidden bg-background",children:[o.jsxs(Lt,{className:"flex flex-row items-center justify-between pb-2",children:[o.jsx($t,{className:"text-sm font-medium text-muted-foreground",children:"Visibility"}),o.jsx(Eh,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Et,{className:"pb-12",children:[o.jsxs("div",{className:ne("text-2xl font-bold",(((B=i.stats)==null?void 0:B.visibility)??0)>50&&"text-success",(((z=i.stats)==null?void 0:z.visibility)??0)<=50&&(((H=i.stats)==null?void 0:H.visibility)??0)>20&&"text-warning",(((W=i.stats)==null?void 0:W.visibility)??0)<=20&&"text-muted-foreground"),children:[((G=i.stats)==null?void 0:G.visibility)??0,"%"]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"of all query runs"})]}),o.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-10",children:o.jsx(Qi,{width:"100%",height:"100%",children:o.jsxs(Lh,{data:T.visibility,children:[o.jsx(Bn,{cursor:!1,content:({active:$,payload:fe})=>$&&fe&&fe.length?o.jsx("div",{className:"rounded-lg border bg-background px-2 py-1 shadow-sm",children:o.jsxs("span",{className:"text-xs font-medium",children:[fe[0].value,"%"]})}):null}),o.jsx(qa,{dataKey:"value",fill:"var(--primary)",radius:[2,2,0,0]})]})})})]}),o.jsxs(Ct,{className:"relative overflow-hidden bg-background",children:[o.jsxs(Lt,{className:"flex flex-row items-center justify-between pb-2",children:[o.jsx($t,{className:"text-sm font-medium text-muted-foreground",children:"Average Rank"}),o.jsx(Lse,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Et,{className:"pb-12",children:[o.jsx("div",{className:"text-2xl font-bold",children:((K=i.stats)==null?void 0:K.avgRank)!==null&&((ee=i.stats)==null?void 0:ee.avgRank)!==void 0?`#${i.stats.avgRank}`:"—"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"when mentioned"})]}),o.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-10",children:o.jsx(Qi,{width:"100%",height:"100%",children:o.jsxs(Dh,{data:T.rank,children:[o.jsx(Bn,{cursor:!1,content:({active:$,payload:fe})=>$&&fe&&fe.length&&fe[0].value!==null?o.jsx("div",{className:"rounded-lg border bg-background px-2 py-1 shadow-sm",children:o.jsx("span",{className:"text-xs font-medium",children:fe[0].value})}):null}),o.jsx(Po,{type:"monotone",dataKey:"value",stroke:"var(--primary)",strokeWidth:1.5,dot:!1,connectNulls:!1})]})})})]}),o.jsxs(Ct,{className:"bg-background",children:[o.jsxs(Lt,{className:"flex flex-row items-center justify-between pb-2",children:[o.jsx($t,{className:"text-sm font-medium text-muted-foreground",children:"Avg. Sentiment"}),o.jsx(ITe,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Et,{className:"flex flex-col gap-2",children:[o.jsx(xa,{value:((V=i.stats)==null?void 0:V.avgSentiment)??0,size:"lg",fullWidth:!0,tooltipTitle:`Sentiment score of ${((J=i.stats)==null?void 0:J.avgSentiment)??0} based on ${i.totalMentions} mention${i.totalMentions!==1?"s":""}`}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:[((Y=i.stats)==null?void 0:Y.avgSentiment)??0," / 100"]})]})]}),o.jsxs(Ct,{className:"relative overflow-hidden bg-background",children:[o.jsxs(Lt,{className:"flex flex-row items-center justify-between pb-2",children:[o.jsx($t,{className:"text-sm font-medium text-muted-foreground",children:"Total Mentions"}),o.jsx(Ud,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Et,{className:"pb-12",children:[o.jsx("div",{className:"text-2xl font-bold",children:i.totalMentions}),o.jsx("p",{className:"text-xs text-muted-foreground",children:i.lastMentionedAt?`Last: ${bl(i.lastMentionedAt,r)}`:"Never mentioned"})]}),o.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-10",children:o.jsx(Qi,{width:"100%",height:"100%",children:o.jsxs(Lh,{data:T.mentions,children:[o.jsx(Bn,{cursor:!1,content:({active:$,payload:fe})=>$&&fe&&fe.length?o.jsx("div",{className:"rounded-lg border bg-background px-2 py-1 shadow-sm",children:o.jsxs("span",{className:"text-xs font-medium",children:[fe[0].value," mentions"]})}):null}),o.jsx(qa,{dataKey:"value",fill:"var(--primary)",radius:[2,2,0,0]})]})})})]})]}),o.jsxs(Ct,{className:"bg-background border-b",children:[o.jsx(Lt,{className:"border-b",children:o.jsx($t,{children:"Mentioned in Prompts"})}),o.jsx(Et,{className:"p-0",children:i.mentions.length===0?o.jsxs("div",{className:"py-12 text-center text-muted-foreground",children:[o.jsx(Mo,{className:"h-12 w-12 mx-auto mb-3 opacity-50"}
4955),o.jsx("p",{children:"No mentions found in any queries yet."})]}):o.jsxs("div",{className:"overflow-x-auto",children:[o.jsxs("table",{className:"w-full card-table",children:[o.jsx("thead",{className:"bg-muted/50 h-12 border-b",children:o.jsxs("tr",{children:[o.jsx("th",{className:"px-4 text-left text-xs font-medium text-muted-foreground tracking-wider",children:"Prompt"}),o.jsx("th",{className:"px-4 text-left text-xs font-medium text-muted-foreground tracking-wider whitespace-nowrap",children:"LLM"}),o.jsx("th",{className:"px-4 text-center text-xs font-medium text-muted-foreground tracking-wider",children:"Rank"}),o.jsx("th",{className:"px-4 text-center text-xs font-medium text-muted-foreground tracking-wider",children:"Sentiment"}),o.jsx("th",{className:"px-4 text-center text-xs font-medium text-muted-foreground tracking-wider",children:"Date"}),o.jsx("th",{className:"px-4 w-24"})]})}),o.jsx("tbody",{className:"divide-y divide-border",children:F.map($=>o.jsxs("tr",{className:"hover:bg-accent/50 transition-colors",children:[o.jsx("td",{className:"px-4 py-3 min-w-[250px]",children:o.jsx(Mt,{to:`/company/${t}/prompts/${$.queryId}`,className:"text-sm hover:underline line-clamp-2",children:$.queryPrompt})}),o.jsx("td",{className:"px-4 py-3 whitespace-nowrap",children:$.llmProvider.logoUrl?o.jsx(Hn,{src:$.llmProvider.logoUrl,alt:$.llmProvider.displayName,title:$.llmProvider.displayName,className:"h-6 w-6 rounded object-contain"}):o.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded bg-muted text-xs",title:$.llmProvider.displayName,children:$.llmProvider.displayName.charAt(0)})}),o.jsx("td",{className:"px-4 py-3 text-center whitespace-nowrap",children:$.rankPosition?o.jsx(nr,{value:$.rankPosition,size:"md",variant:"rank",className:"mx-auto"}):o.jsx("span",{className:"text-muted-foreground",children:"—"})}),o.jsx("td",{className:"px-4 py-3 text-center whitespace-nowrap",children:$.sentimentScore!==null?o.jsx(xa,{value:$.sentimentScore,size:"md",className:"justify-center",tooltipTitle:`Sentiment score of ${$.sentimentScore}`}):o.jsx("span",{className:"text-muted-foreground",children:"—"})}),o.jsx("td",{className:"px-4 py-3 text-center text-sm text-muted-foreground whitespace-nowrap",children:bl($.createdAt,r)}),o.jsx("td",{className:"px-4 py-3 whitespace-nowrap",children:o.jsx(Mt,{to:`/company/${t}/prompts/${$.queryId}/studio?run=${$.rankingId}&competitor=${encodeURIComponent(i.name)}`,children:o.jsxs(le,{variant:"studio",size:"xs",children:[o.jsx(pr,{className:"mr-1 h-3 w-3"}),"Studio"]})})})]},$.rankingId))})]}),q>1&&o.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-t",children:[o.jsxs("p",{className:"text-sm text-muted-foreground",children:["Showing ",(A-1)*k+1," to ",Math.min(A*k,i.mentions.length)," of ",i.mentions.length," prompts"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(le,{variant:"outline",size:"sm",onClick:()=>C($=>Math.max(1,$-1)),disabled:A===1,children:o.jsx(wd,{className:"h-4 w-4"})}),o.jsxs("span",{className:"text-sm",children:["Page ",A," of ",q]}),o.jsx(le,{variant:"outline",size:"sm",onClick:()=>C($=>Math.min(q,$+1)),disabled:A===q,children:o.jsx(Ga,{className:"h-4 w-4"})})]})]})]})})]}),o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between border-b px-6 py-3",children:[o.jsx("h2",{className:"text-lg font-semibold",children:"Aliases"}),o.jsxs(le,{variant:"outline",size:"sm",onClick:()=>g(!0),children:[o.jsx(yi,{className:"h-4 w-4 mr-1"}),"Add Alias"]})]}),o.jsx(Ct,{className:"bg-background",children:o.jsx(Et,{className:"pt-6",children:i.aliases&&i.aliases.length>0?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"flex flex-wrap gap-2",children:i.aliases.map($=>o.jsxs(Ge,{variant:"secondary",className:"text-sm py-1.5 px-3 pr-1.5 flex items-center gap-1.5",children:[$.name,o.jsx("button",{onClick:()=>L($),className:"hover:bg-destructive/20 rounded-full p-0.5 transition-colors","aria-label":`Remove alias ${$.name}`,children:o.jsx(mr,{className:"h-3 w-3"})})]},$.id))}),o.jsxs("p",{className:"text-xs text-muted-foreground mt-4",children:['These names are treated as the same entity as "',i.name,'" when anal
4955yzing responses.']})]}):o.jsx("p",{className:"text-sm text-muted-foreground",children:"No aliases yet. Add aliases to group different names for the same competitor."})})})]}),o.jsx(ur,{open:d,onOpenChange:f,children:o.jsxs(tr,{children:[o.jsxs(dr,{children:[o.jsxs(fr,{children:['Merge "',i.name,'" Into Another Competitor']}),o.jsxs(hr,{children:['This will merge "',i.name,'" as an alias of the selected competitor. All mentions will be attributed to the target competitor.']})]}),o.jsx("div",{className:"py-4 space-y-4",children:o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{children:"Merge into"}),o.jsx(pF,{options:D,value:h,onValueChange:p,placeholder:"Select competitor...",searchPlaceholder:"Search competitors...",emptyText:"No competitors found."})]})}),o.jsxs(Pr,{children:[o.jsx(le,{variant:"outline",onClick:()=>f(!1),children:"Cancel"}),o.jsxs(le,{onClick:E,disabled:!h||m,children:[m&&o.jsx(Me,{className:"mr-2 h-4 w-4 animate-spin"}),"Merge"]})]})]})}),o.jsx(ur,{open:y,onOpenChange:g,children:o.jsxs(tr,{children:[o.jsxs(dr,{children:[o.jsx(fr,{children:"Add Alias"}),o.jsxs(hr,{children:['Add an alternative name for "',i.name,'". This will help identify mentions when the competitor is referred to by a different name.']})]}),o.jsx("div",{className:"py-4 space-y-4",children:o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{htmlFor:"alias-name",children:"Alias Name"}),o.jsx(gt,{id:"alias-name",placeholder:"e.g. Company Inc., Company Denmark",value:w,onChange:$=>v($.target.value),onKeyDown:$=>{$.key==="Enter"&&w.trim()&&P()}})]})}),o.jsxs(Pr,{children:[o.jsx(le,{variant:"outline",onClick:()=>{g(!1),v("")},children:"Cancel"}),o.jsxs(le,{onClick:P,disabled:!w.trim()||m,children:[m&&o.jsx(Me,{className:"mr-2 h-4 w-4 animate-spin"}),"Add Alias"]})]})]})}),o.jsx(ur,{open:N,onOpenChange:S,children:o.jsxs(tr,{children:[o.jsxs(dr,{children:[o.jsx(fr,{children:"Remove Alias"}),o.jsxs(hr,{children:['Are you sure you want to remove the alias "',_==null?void 0:_.name,'"? This action cannot be undone.']})]}),o.jsxs(Pr,{children:[o.jsx(le,{variant:"outline",onClick:()=>{S(!1),j(null)},children:"Cancel"}),o.jsxs(le,{variant:"destructive",onClick:O,disabled:m,children:[m&&o.jsx(Me,{className:"mr-2 h-4 w-4 animate-spin"}),"Remove"]})]})]})})]})]})]}):o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Competitor",noIndex:!0}),o.jsx("div",{className:"flex h-96 items-center justify-center",children:o.jsx("p",{className:"text-muted-foreground",children:"Competitor not found"})})]})}function $i(t){if(typeof t=="string"||typeof t=="number")return""+t;let e="";if(Array.isArray(t))for(let n=0,r;n<t.length;n++)(r=$i(t[n]))!==""&&(e+=(e&&" ")+r);else for(let n in t)t[n]&&(e+=(e&&" ")+n);return e}var XTt={value:()=>{}};function KP(){for(var t=0,e=arguments.length,n={},r;t<e;++t){if(!(r=arguments[t]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new uk(n)}function uk(t){this._=t}function QTt(t,e){return t.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}uk.prototype=KP.prototype={constructor:uk,on:function(t,e){var n=this._,r=QTt(t+"",n),i,s=-1,a=r.length;if(arguments.length<2){for(;++s<a;)if((i=(t=r[s]).type)&&(i=JTt(n[i],t.name)))return i;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++s<a;)if(i=(t=r[s]).type)n[i]=rZ(n[i],t.name,e);else if(e==null)for(i in n)n[i]=rZ(n[i],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new uk(t)},call:function(t,e){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,s;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(s=this._[t],r=0,i=s.length;r<i;++r)s[r].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,s=r.length;i<s;++i)r[i].value.apply(e,n)}};function JTt(t,e){for(var n=0,r=t.length,i;n<r;++n)if((i=t[n]).name===e)return i.value}function rZ(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=XTt,t=t.slice(0,r).concat(t.slice(r+1));break}return n!=null&&t.push({name:e,value:n}),t}var mF="http://www.w3.org/1999/xhtml";const iZ={svg:"http://www.w3.org/2000/svg",xhtml:mF,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function YP(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),iZ.hasOwnProperty(e)?{space:iZ[e],local:t}:t}function ZTt(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===mF&&e.documentElement.namespaceURI===mF?e.createElement(t):e.createElementNS(n,t)}}function eMt(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function gye(t){var e=YP(t);return(e.local?eMt:ZTt)(e)}
vendor: 5,939 bytes, line 4955
4955function tMt(){}function K8(t){return t==null?tMt:function(){return this.querySelector(t)}}function nMt(t){typeof t!="function"&&(t=K8(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var s=e[i],a=s.length,l=r[i]=new Array(a),c,u,d=0;d<a;++d)(c=s[d])&&(u=t.call(c,c.__data__,d,s))&&("__data__"in c&&(u.__data__=c.__data__),l[d]=u);return new Ro(r,this._parents)}function rMt(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function iMt(){return[]}function xye(t){return t==null?iMt:function(){return this.querySelectorAll(t)}}function sMt(t){return function(){return rMt(t.apply(this,arguments))}}function aMt(t){typeof t=="function"?t=sMt(t):t=xye(t);for(var e=this._groups,n=e.length,r=[],i=[],s=0;s<n;++s)for(var a=e[s],l=a.length,c,u=0;u<l;++u)(c=a[u])&&(r.push(t.call(c,c.__data__,u,a)),i.push(c));return new Ro(r,i)}function yye(t){return function(){return this.matches(t)}}function vye(t){return function(e){return e.matches(t)}}var oMt=Array.prototype.find;function lMt(t){return function(){return oMt.call(this.children,t)}}function cMt(){return this.firstElementChild}function uMt(t){return this.select(t==null?cMt:lMt(typeof t=="function"?t:vye(t)))}var dMt=Array.prototype.filter;function fMt(){return Array.from(this.children)}function hMt(t){return function(){return dMt.call(this.children,t)}}function pMt(t){return this.selectAll(t==null?fMt:hMt(typeof t=="function"?t:vye(t)))}function mMt(t){typeof t!="function"&&(t=yye(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var s=e[i],a=s.length,l=r[i]=[],c,u=0;u<a;++u)(c=s[u])&&t.call(c,c.__data__,u,s)&&l.push(c);return new Ro(r,this._parents)}function bye(t){return new Array(t.length)}function gMt(){return new Ro(this._enter||this._groups.map(bye),this._parents)}function YE(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}YE.prototype={constructor:YE,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function xMt(t){return function(){return t}}function yMt(t,e,n,r,i,s){for(var a=0,l,c=e.length,u=s.length;a<u;++a)(l=e[a])?(l.__data__=s[a],r[a]=l):n[a]=new YE(t,s[a]);for(;a<c;++a)(l=e[a])&&(i[a]=l)}function vMt(t,e,n,r,i,s,a){var l,c,u=new Map,d=e.length,f=s.length,h=new Array(d),p;for(l=0;l<d;++l)(c=e[l])&&(h[l]=p=a.call(c,c.__data__,l,e)+"",u.has(p)?i[l]=c:u.set(p,c));for(l=0;l<f;++l)p=a.call(t,s[l],l,s)+"",(c=u.get(p))?(r[l]=c,c.__data__=s[l],u.delete(p)):n[l]=new YE(t,s[l]);for(l=0;l<d;++l)(c=e[l])&&u.get(h[l])===c&&(i[l]=c)}function bMt(t){return t.__data__}function wMt(t,e){if(!arguments.length)return Array.from(this,bMt);var n=e?vMt:yMt,r=this._parents,i=this._groups;typeof t!="function"&&(t=xMt(t));for(var s=i.length,a=new Array(s),l=new Array(s),c=new Array(s),u=0;u<s;++u){var d=r[u],f=i[u],h=f.length,p=_Mt(t.call(d,d&&d.__data__,u,r)),m=p.length,x=l[u]=new Array(m),y=a[u]=new Array(m),g=c[u]=new Array(h);n(d,f,x,y,g,p,e);for(var w=0,v=0,N,S;w<m;++w)if(N=x[w]){for(w>=v&&(v=w+1);!(S=y[v])&&++v<m;);N._next=S||null}}return a=new Ro(a,r),a._enter=l,a._exit=c,a}function _Mt(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function SMt(){return new Ro(this._exit||this._groups.map(bye),this._parents)}function NMt(t,e,n){var r=this.enter(),i=this,s=this.exit();return typeof t=="function"?(r=t(r),r&&(r=r.selection())):r=r.append(t+""),e!=null&&(i=e(i),i&&(i=i.selection())),n==null?s.remove():n(s),r&&i?r.merge(i).order():i}function jMt(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,i=n.length,s=r.length,a=Math.min(i,s),l=new Array(i),c=0;c<a;++c)for(var u=n[c],d=r[c],f=u.length,h=l[c]=new Array(f),p,m=0;m<f;++m)(p=u[m]||d[m])&&(h[m]=p);for(;c<i;++c)l[c]=n[c];return new Ro(l,this._parents)}function CMt(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r=t[e],i=r.length-1,s=r[i],a;--i>=0;)(a=r[i])&&(s&&a.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(a,s),s=a);return this}function kMt(t){t||(t=EMt);function e(f,h){return f&&h?t(f.__data__,h.__data__):!f-!h}for(var n=this._groups,r=n.length,i=new Array(r),s=0;s<r;++s){for(var a=n[s],l=a.length,c=i[s]=new Array(l),u,d=0;d<l;++d)(u=a[d])&&(c[d]=u);c.sort(e)}return new Ro(i,this._parents).order()}function EMt(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function AMt(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function TMt(){return Array.from(this)}function MMt(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,s=r.length;i<s;++i){var a=r[i];if(a)return a}return null}function PMt(){let t=0;for(const e of this)++t;return t}function OMt(){return!this.node()}function RMt(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i=e[n],s=0,a=i.length,l;s<a;++s)(l=i[s])&&t.call(l,l.__data__,s,i);return this}function IMt(t){return function(){this.removeAttribute(t)}}function DMt(t){return function(){this.removeAttributeNS(t.space,t.local)}}function LMt(t,e){return function(){this.setAttribute(t,e)}}function $Mt(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function FMt(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function UMt(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function zMt(t,e){var n=YP(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((e==null?n.local?DMt:IMt:typeof e=="function"?n.local?UMt:FMt:n.local?$Mt:LMt)(n,e))}function wye(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function BMt(t){return function(){this.style.removeProperty(t)}}
vendor: 4,754 bytes, line 4955
4955function VMt(t,e,n){return function(){this.style.setProperty(t,e,n)}}function HMt(t,e,n){return function(){var r=e.apply(this,arguments);r==null?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function WMt(t,e,n){return arguments.length>1?this.each((e==null?BMt:typeof e=="function"?HMt:VMt)(t,e,n??"")):i0(this.node(),t)}function i0(t,e){return t.style.getPropertyValue(e)||wye(t).getComputedStyle(t,null).getPropertyValue(e)}function GMt(t){return function(){delete this[t]}}function qMt(t,e){return function(){this[t]=e}}function KMt(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function YMt(t,e){return arguments.length>1?this.each((e==null?GMt:typeof e=="function"?KMt:qMt)(t,e)):this.node()[t]}function _ye(t){return t.trim().split(/^|\s+/)}function Y8(t){return t.classList||new Sye(t)}function Sye(t){this._node=t,this._names=_ye(t.getAttribute("class")||"")}Sye.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function Nye(t,e){for(var n=Y8(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function jye(t,e){for(var n=Y8(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}function XMt(t){return function(){Nye(this,t)}}function QMt(t){return function(){jye(this,t)}}function JMt(t,e){return function(){(e.apply(this,arguments)?Nye:jye)(this,t)}}function ZMt(t,e){var n=_ye(t+"");if(arguments.length<2){for(var r=Y8(this.node()),i=-1,s=n.length;++i<s;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof e=="function"?JMt:e?XMt:QMt)(n,e))}function ePt(){this.textContent=""}function tPt(t){return function(){this.textContent=t}}function nPt(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function rPt(t){return arguments.length?this.each(t==null?ePt:(typeof t=="function"?nPt:tPt)(t)):this.node().textContent}function iPt(){this.innerHTML=""}function sPt(t){return function(){this.innerHTML=t}}function aPt(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function oPt(t){return arguments.length?this.each(t==null?iPt:(typeof t=="function"?aPt:sPt)(t)):this.node().innerHTML}function lPt(){this.nextSibling&&this.parentNode.appendChild(this)}function cPt(){return this.each(lPt)}function uPt(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function dPt(){return this.each(uPt)}function fPt(t){var e=typeof t=="function"?t:gye(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function hPt(){return null}function pPt(t,e){var n=typeof t=="function"?t:gye(t),r=e==null?hPt:typeof e=="function"?e:K8(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function mPt(){var t=this.parentNode;t&&t.removeChild(this)}function gPt(){return this.each(mPt)}function xPt(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function yPt(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function vPt(t){return this.select(t?yPt:xPt)}function bPt(t){return arguments.length?this.property("__data__",t):this.node().__data__}function wPt(t){return function(e){t.call(this,e,this.__data__)}}function _Pt(t){return t.trim().split(/^|\s+/).map(function(e){var n="",r=e.indexOf(".");return r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function SPt(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,i=e.length,s;n<i;++n)s=e[n],(!t.type||s.type===t.type)&&s.name===t.name?this.removeEventListener(s.type,s.listener,s.options):e[++r]=s;++r?e.length=r:delete this.__on}}}function NPt(t,e,n){return function(){var r=this.__on,i,s=wPt(e);if(r){for(var a=0,l=r.length;a<l;++a)if((i=r[a]).type===t.type&&i.name===t.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=s,i.options=n),i.value=e;return}}this.addEventListener(t.type,s,n),i={type:t.type,name:t.name,value:e,listener:s,options:n},r?r.push(i):this.__on=[i]}}function jPt(t,e,n){var r=_Pt(t+""),i,s=r.length,a;if(arguments.length<2){var l=this.node().__on;if(l){for(var c=0,u=l.length,d;c<u;++c)for(i=0,d=l[c];i<s;++i)if((a=r[i]).type===d.type&&a.name===d.name)return d.value}return}for(l=e?NPt:SPt,i=0;i<s;++i)this.each(l(r[i],e,n));return this}function Cye(t,e,n){var r=wye(t),i=r.CustomEvent;typeof i=="function"?i=new i(e,n):(i=r.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dis
vendor: 28,029 bytes, line 4955
4955patchEvent(i)}function CPt(t,e){return function(){return Cye(this,t,e)}}function kPt(t,e){return function(){return Cye(this,t,e.apply(this,arguments))}}function EPt(t,e){return this.each((typeof e=="function"?kPt:CPt)(t,e))}function*APt(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,s=r.length,a;i<s;++i)(a=r[i])&&(yield a)}var kye=[null];function Ro(t,e){this._groups=t,this._parents=e}function hN(){return new Ro([[document.documentElement]],kye)}function TPt(){return this}Ro.prototype=hN.prototype={constructor:Ro,select:nMt,selectAll:aMt,selectChild:uMt,selectChildren:pMt,filter:mMt,data:wMt,enter:gMt,exit:SMt,join:NMt,merge:jMt,selection:TPt,order:CMt,sort:kMt,call:AMt,nodes:TMt,node:MMt,size:PMt,empty:OMt,each:RMt,attr:zMt,style:WMt,property:YMt,classed:ZMt,text:rPt,html:oPt,raise:cPt,lower:dPt,append:fPt,insert:pPt,remove:gPt,clone:vPt,datum:bPt,on:jPt,dispatch:EPt,[Symbol.iterator]:APt};function go(t){return typeof t=="string"?new Ro([[document.querySelector(t)]],[document.documentElement]):new Ro([[t]],kye)}function MPt(t){let e;for(;e=t.sourceEvent;)t=e;return t}function Hl(t,e){if(t=MPt(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,r=r.matrixTransform(e.getScreenCTM().inverse()),[r.x,r.y]}if(e.getBoundingClientRect){var i=e.getBoundingClientRect();return[t.clientX-i.left-e.clientLeft,t.clientY-i.top-e.clientTop]}}return[t.pageX,t.pageY]}const PPt={passive:!1},G_={capture:!0,passive:!1};function C3(t){t.stopImmediatePropagation()}function $y(t){t.preventDefault(),t.stopImmediatePropagation()}function Eye(t){var e=t.document.documentElement,n=go(t).on("dragstart.drag",$y,G_);"onselectstart"in e?n.on("selectstart.drag",$y,G_):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function Aye(t,e){var n=t.document.documentElement,r=go(t).on("dragstart.drag",null);e&&(r.on("click.drag",$y,G_),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const tC=t=>()=>t;function gF(t,{sourceEvent:e,subject:n,target:r,identifier:i,active:s,x:a,y:l,dx:c,dy:u,dispatch:d}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:d}})}gF.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function OPt(t){return!t.ctrlKey&&!t.button}function RPt(){return this.parentNode}function IPt(t,e){return e??{x:t.x,y:t.y}}function DPt(){return navigator.maxTouchPoints||"ontouchstart"in this}function Tye(){var t=OPt,e=RPt,n=IPt,r=DPt,i={},s=KP("start","drag","end"),a=0,l,c,u,d,f=0;function h(N){N.on("mousedown.drag",p).filter(r).on("touchstart.drag",y).on("touchmove.drag",g,PPt).on("touchend.drag touchcancel.drag",w).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(N,S){if(!(d||!t.call(this,N,S))){var _=v(this,e.call(this,N,S),N,S,"mouse");_&&(go(N.view).on("mousemove.drag",m,G_).on("mouseup.drag",x,G_),Eye(N.view),C3(N),u=!1,l=N.clientX,c=N.clientY,_("start",N))}}function m(N){if($y(N),!u){var S=N.clientX-l,_=N.clientY-c;u=S*S+_*_>f}i.mouse("drag",N)}function x(N){go(N.view).on("mousemove.drag mouseup.drag",null),Aye(N.view,u),$y(N),i.mouse("end",N)}function y(N,S){if(t.call(this,N,S)){var _=N.changedTouches,j=e.call(this,N,S),A=_.length,C,k;for(C=0;C<A;++C)(k=v(this,j,N,S,_[C].identifier,_[C]))&&(C3(N),k("start",N,_[C]))}}function g(N){var S=N.changedTouches,_=S.length,j,A;for(j=0;j<_;++j)(A=i[S[j].identifier])&&($y(N),A("drag",N,S[j]))}function w(N){var S=N.changedTouches,_=S.length,j,A;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),j=0;j<_;++j)(A=i[S[j].identifier])&&(C3(N),A("end",N,S[j]))}function v(N,S,_,j,A,C){var k=s.copy(),M=Hl(C||_,S),I,R,E;if((E=n.call(N,new gF("beforestart",{sourceEvent:_,target:h,identifier:A,active:a,x:M[0],y:M[1],dx:0,dy:0,dispatch:k}),j))!=null)return I=E.x-M[0]||0,R=E.y-M[1]||0,function P(O,L,T){var D=M,F;switch(O){case"start":i[A]=P,F=a++;break;case"end":delete i[A],--a;case"drag":M=Hl(T||L,S),F=a;break}k.call(O,N,new gF(O,{sourceEvent:L,subject:E,target:h,identifier:A,active:F,x:M[0]+I,y:M[1]+R,dx:M[0]-D[0],dy:M[1]-D[1],dispatch:k}),j)}}return h.filter=function(N){return arguments.length?(t=typeof N=="function"?N:tC(!!N),h):t},h.container=function(N){return arguments.length?(e=typeof N=="function"?N:tC(N),h):e},h.subject=function(N){return arguments.length?(n=typeof N=="function"?N:tC(N),h):n},h.touchable=function(N){return arguments.length?(r=typeof N=="function"?N:tC(!!N),h):r},h.on=function(){var N=s.on.apply(s,arguments);return N===s?h:N},h.clickDistance=function(N){return arguments.length?(f=(N=+N)*N,h):Math.sqrt(f)},h}var s0=0,ww=0,Xb=0,Mye=1e3,XE,_w,QE=0,ug=0,XP=0,q_=typeof performance=="object"&&performance.now?performance:Date,Pye=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function X8(){return ug||(Pye(LPt),ug=q_.now()+XP)}function LPt(){ug=0}function JE(){this._call=this._time=this._next=null}JE.prototype=Oye.prototype={constructor:JE,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?X8():+n)+(e==null?0:+e),!this._next&&_w!==this&&(_w?_w._next=this:XE=this,_w=this),this._call=t,this._time=n,xF()},stop:function(){this._call&&(this._call=null,this._time=1/0,xF())}};function Oye(t,e,n){var r=new JE;return r.restart(t,e,n),r}function $Pt(){X8(),++s0;for(var t=XE,e;t;)(e=ug-t._time)>=0&&t._call.call(void 0,e),t=t._next;--s0}function sZ(){ug=(QE=q_.now())+XP,s0=ww=0;try{$Pt()}finally{s0=0,UPt(),ug=0}}function FPt(){var t=q_.now(),e=t-QE;e>Mye&&(XP-=e,QE=t)}function UPt(){for(var t,e=XE,n,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:XE=n);_w=t,xF(r)}function xF(t){if(!s0){ww&&(ww=clearTimeout(ww));var e=t-ug;e>24?(t<1/0&&(ww=setTimeout(sZ,t-q_.now()-XP)),Xb&&(Xb=clearInterval(Xb))):(Xb||(QE=q_.now(),Xb=setInterval(FPt,Mye)),s0=1,Pye(sZ))}}function aZ(t,e,n){var r=new JE;return e=e==null?0:+e,r.restart(i=>{r.stop(),t(i+e)},e,n),r}var zPt=KP("start","end","cancel","interrupt"),BPt=[],Rye=0,oZ=1,yF=2,dk=3,lZ=4,vF=5,fk=6;function QP(t,e,n,r,i,s){var a=t.__transition;if(!a)t.__transition={};else if(n in a)return;VPt(t,n,{name:e,index:r,group:i,on:zPt,tween:BPt,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:Rye})}function Q8(t,e){var n=Sc(t,e);if(n.state>Rye)throw new Error("too late; already scheduled");return n}function _u(t,e){var n=Sc(t,e);if(n.state>dk)throw new Error("too late; already running");return n}function Sc(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function VPt(t,e,n){var r=t.__transition,i;r[e]=n,n.timer=Oye(s,0,n.time);function s(u){n.state=oZ,n.timer.restart(a,n.delay,n.time),n.delay<=u&&a(u-n.delay)}function a(u){var d,f,h,p;if(n.state!==oZ)return c();for(d in r)if(p=r[d],p.name===n.name){if(p.state===dk)return aZ(a);p.state===lZ?(p.state=fk,p.timer.stop(),p.on.call("interrupt",t,t.__data__,p.index,p.group),delete r[d]):+d<e&&(p.state=fk,p.timer.stop(),p.on.call("cancel",t,t.__data__,p.index,p.group),delete r[d])}if(aZ(function(){n.state===dk&&(n.state=lZ,n.timer.restart(l,n.delay,n.time),l(u))}),n.state=yF,n.on.call("start",t,t.__data__,n.index,n.group),n.state===yF){for(n.state=dk,i=new Array(h=n.tween.length),d=0,f=-1;d<h;++d)(p=n.tween[d].value.call(t,t.__data__,n.index,n.group))&&(i[++f]=p);i.length=f+1}}function l(u){for(var d=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(c),n.state=vF,1),f=-1,h=i.length;++f<h;)i[f].call(t,d);n.state===vF&&(n.on.call("end",t,t.__data__,n.index,n.group),c())}function c(){n.state=fk,n.timer.stop(),delete r[e];for(var u in r)return;delete t.__transition}}function hk(t,e){var n=t.__transition,r,i,s=!0,a;if(n){e=e==null?null:e+"";for(a in n){if((r=n[a]).name!==e){s=!1;continue}i=r.state>yF&&r.state<vF,r.state=fk,r.timer.stop(),r.on.call(i?"interrupt":"cancel",t,t.__data__,r.index,r.group),delete n[a]}s&&delete t.__transition}}function HPt(t){return this.each(function(){hk(this,t)})}function WPt(t,e){var n,r;return function(){var i=_u(this,t),s=i.tween;if(s!==n){r=n=s;for(var a=0,l=r.length;a<l;++a)if(r[a].name===e){r=r.slice(),r.splice(a,1);break}}i.tween=r}}function GPt(t,e,n){var r,i;if(typeof n!="function")throw new Error;return function(){var s=_u(this,t),a=s.tween;if(a!==r){i=(r=a).slice();for(var l={name:e,value:n},c=0,u=i.length;c<u;++c)if(i[c].name===e){i[c]=l;break}c===u&&i.push(l)}s.tween=i}}function qPt(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r=Sc(this.node(),n).tween,i=0,s=r.length,a;i<s;++i)if((a=r[i]).name===t)return a.value;return null}return this.each((e==null?WPt:GPt)(n,t,e))}function J8(t,e,n){var r=t._id;return t.each(function(){var i=_u(this,r);(i.value||(i.value={}))[e]=n.apply(this,arguments)}),function(i){return Sc(i,r).value[e]}}function Iye(t,e){var n;return(typeof e=="number"?Gl:e instanceof Km?k2:(n=Km(e))?(e=n,k2):rB)(t,e)}function KPt(t){return function(){this.removeAttribute(t)}}function YPt(t){return function(){this.removeAttributeNS(t.space,t.local)}}function XPt(t,e,n){var r,i=n+"",s;return function(){var a=this.getAttribute(t);return a===i?null:a===r?s:s=e(r=a,n)}}function QPt(t,e,n){var r,i=n+"",s;return function(){var a=this.getAttributeNS(t.space,t.local);return a===i?null:a===r?s:s=e(r=a,n)}}function JPt(t,e,n){var r,i,s;return function(){var a,l=n(this),c;return l==null?void this.removeAttribute(t):(a=this.getAttribute(t),c=l+"",a===c?null:a===r&&c===i?s:(i=c,s=e(r=a,l)))}}function ZPt(t,e,n){var r,i,s;return function(){var a,l=n(this),c;return l==null?void this.removeAttributeNS(t.space,t.local):(a=this.getAttributeNS(t.space,t.local),c=l+"",a===c?null:a===r&&c===i?s:(i=c,s=e(r=a,l)))}}function eOt(t,e){var n=YP(t),r=n==="transform"?dJe:Iye;return this.attrTween(t,typeof e=="function"?(n.local?ZPt:JPt)(n,r,J8(this,"attr."+t,e)):e==null?(n.local?YPt:KPt)(n):(n.local?QPt:XPt)(n,r,e))}function tOt(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function nOt(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function rOt(t,e){var n,r;function i(){var s=e.apply(this,arguments);return s!==r&&(n=(r=s)&&nOt(t,s)),n}return i._value=e,i}function iOt(t,e){var n,r;function i(){var s=e.apply(this,arguments);return s!==r&&(n=(r=s)&&tOt(t,s)),n}return i._value=e,i}function sOt(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var r=YP(t);return this.tween(n,(r.local?rOt:iOt)(r,e))}function aOt(t,e){return function(){Q8(this,t).delay=+e.apply(this,arguments)}}function oOt(t,e){return e=+e,function(){Q8(this,t).delay=e}}function lOt(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?aOt:oOt)(e,t)):Sc(this.node(),e).delay}function cOt(t,e){return function(){_u(this,t).duration=+e.apply(this,arguments)}}function uOt(t,e){return e=+e,function(){_u(this,t).duration=e}}function dOt(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?cOt:uOt)(e,t)):Sc(this.node(),e).duration}function fOt(t,e){if(typeof e!="function")throw new Error;return function(){_u(this,t).ease=e}}function hOt(t){var e=this._id;return arguments.length?this.each(fOt(e,t)):Sc(this.node(),e).ease}function pOt(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;_u(this,t).ease=n}}function mOt(t){if(typeof t!="function")throw new Error;return this.each(pOt(this._id,t))}function gOt(t){typeof t!="function"&&(t=yye(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var s=e[i],a=s.length,l=r[i]=[],c,u=0;u<a;++u)(c=s[u])&&t.call(c,c.__data__,u,s)&&l.push(c);return new Dd(r,this._parents,this._name,this._id)}function xOt(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,i=n.length,s=Math.min(r,i),a=new Array(r),l=0;l<s;++l)for(var c=e[l],u=n[l],d=c.length,f=a[l]=new Array(d),h,p=0;p<d;++p)(h=c[p]||u[p])&&(f[p]=h);for(;l<r;++l)a[l]=e[l];return new Dd(a,this._parents,this._name,this._id)}function yOt(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function vOt(t,e,n){var r,i,s=yOt(e)?Q8:_u;return function(){var a=s(this,t),l=a.on;l!==r&&(i=(r=l).copy()).on(e,n),a.on=i}}function bOt(t,e){var n=this._id;return arguments.length<2?Sc(this.node(),n).on.on(t):this.each(vOt(n,t,e))}function wOt(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function _Ot(){return this.on("end.remove",wOt(this._id))}function SOt(t){var e=this._name,n=this._id;typeof t!="function"&&(t=K8(t));for(var r=this._groups,i=r.length,s=new Array(i),a=0;a<i;++a)for(var l=r[a],c=l.length,u=s[a]=new Array(c),d,f,h=0;h<c;++h)(d=l[h])&&(f=t.call(d,d.__data__,h,l))&&("__data__"in d&&(f.__data__=d.__data__),u[h]=f,QP(u[h],e,n,h,u,Sc(d,n)));return new Dd(s,this._parents,e,n)}function NOt(t){var e=this._name,n=this._id;typeof t!="function"&&(t=xye(t));for(var r=this._groups,i=r.length,s=[],a=[],l=0;l<i;++l)for(var c=r[l],u=c.length,d,f=0;f<u;++f)if(d=c[f]){for(var h=t.call(d,d.__data__,f,c),p,m=Sc(d,n),x=0,y=h.length;x<y;++x)(p=h[x])&&QP(p,e,n,x,h,m);s.push(h),a.push(d)}return new Dd(s,a,e,n)}var jOt=hN.prototype.constructor;function COt(){return new jOt(this._groups,this._parents)}function kOt(t,e){var n,r,i;return function(){var s=i0(this,t),a=(this.style.removeProperty(t),i0(this,t));return s===a?null:s===n&&a===r?i:i=e(n=s,r=a)}}function Dye(t){return function(){this.style.removeProperty(t)}}function EOt(t,e,n){var r,i=n+"",s;return function(){var a=i0(this,t);return a===i?null:a===r?s:s=e(r=a,n)}}function AOt(t,e,n){var r,i,s;return function(){var a=i0(this,t),l=n(this),c=l+"";return l==null&&(c=l=(this.style.removeProperty(t),i0(this,t))),a===c?null:a===r&&c===i?s:(i=c,s=e(r=a,l))}}function TOt(t,e){var n,r,i,s="style."+e,a="end."+s,l;return function(){var c=_u(this,t),u=c.on,d=c.value[s]==null?l||(l=Dye(e)):void 0;(u!==n||i!==d)&&(r=(n=u).copy()).on(a,i=d),c.on=r}}function MOt(t,e,n){var r=(t+="")=="transform"?uJe:Iye;return e==null?this.styleTween(t,kOt(t,r)).on("end.style."+t,Dye(t)):typeof e=="function"?this.styleTween(t,AOt(t,r,J8(this,"style."+t,e))).each(TOt(this._id,t)):this.styleTween(t,EOt(t,r,e),n).on("end.style."+t,null)}function POt(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function OOt(t,e,n){var r,i;function s(){var a=e.apply(this,arguments);return a!==i&&(r=(i=a)&&POt(t,a,n)),r}return s._value=e,s}function ROt(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!="function")throw new Error;return this.tween(r,OOt(t,e,n??""))}function IOt(t){return function(){this.textContent=t}}function DOt(t){return function(){var e=t(this);this.textContent=e??""}}function LOt(t){return this.tween("text",typeof t=="function"?DOt(J8(this,"text",t)):IOt(t==null?"":t+""))}function $Ot(t){return function(e){this.textContent=t.call(this,e)}}function FOt(t){var e,n;function r(){var i=t.apply(this,arguments);return i!==n&&(e=(n=i)&&$Ot(i)),e}return r._value=t,r}function UOt(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,FOt(t))}function zOt(){for(var t=this._name,e=this._id,n=Lye(),r=this._groups,i=r.length,s=0;s<i;++s)for(var a=r[s],l=a.length,c,u=0;u<l;++u)if(c=a[u]){var d=Sc(c,e);QP(c,t,n,u,a,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new Dd(r,this._parents,t,n)}function BOt(){var t,e,n=this,r=n._id,i=n.size();return new Promise(function(s,a){var l={value:a},c={value:function(){--i===0&&s()}};n.each(function(){var u=_u(this,r),d=u.on;d!==t&&(e=(t=d).copy(),e._.cancel.push(l),e._.interrupt.push(l),e._.end.push(c)),u.on=e}),i===0&&s()})}var VOt=0;function Dd(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function Lye(){return++VOt}var Pu=hN.prototype;Dd.prototype={constructor:Dd,select:SOt,selectAll:NOt,selectChild:Pu.selectChild,selectChildren:Pu.selectChildren,filter:gOt,merge:xOt,selection:COt,transition:zOt,call:Pu.call,nodes:Pu.nodes,node:Pu.node,size:Pu.size,empty:Pu.empty,each:Pu.each,on:bOt,attr:eOt,attrTween:sOt,style:MOt,styleTween:ROt,text:LOt,textTween:UOt,remove:_Ot,tween:qPt,delay:lOt,duration:dOt,ease:hOt,easeVarying:mOt,end:BOt,[Symbol.iterator]:Pu[Symbol.iterator]};function HOt(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var WOt={time:null,delay:0,duration:250,ease:HOt};function GOt(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function qOt(t){var e,n;t instanceof Dd?(e=t._id,t=t._name):(e=Lye(),(n=WOt).time=X8(),t=t==null?null:t+"");for(var r=this._groups,i=r.length,s=0;s<i;++s)for(var a=r[s],l=a.length,c,u=0;u<l;++u)(c=a[u])&&QP(c,t,e,u,a,n||GOt(c,e));return new Dd(r,this._parents,t,e)}hN.prototype.interrupt=HPt;hN.prototype.transition=qOt;const nC=t=>()=>t;function KOt(t,{sourceEvent:e,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function sd(t,e,n){this.k=t,this.x=e,this.y=n}sd.prototype={constructor:sd,scale:function(t){return t===1?this:new sd(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new sd(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var JP=new sd(1,0,0);$ye.prototype=sd.prototype;function $ye(t){for(;!t.__zoom;)if(!(t=t.parentNode))return JP;return t.__zoom}function k3(t){t.stopImmediatePropagation()}function Qb(t){t.preventDefault(),t.stopImmediatePropagation()}function YOt(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function XOt(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function cZ(){return this.__zoom||JP}function QOt(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function JOt(){return navigator.maxTouchPoints||"ontouchstart"in this}function ZOt(t,e,n){var r=t.invertX(e[0][0])-n[0][0],i=t.invertX(e[1][0])-n[1][0],s=t.invertY(e[0][1])-n[0][1],a=t.invertY(e[1][1])-n[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a))}function Fye(){var t=YOt,e=XOt,n=ZOt,r=QOt,i=JOt,s=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,c=XC,u=KP("start","zoom","end"),d,f,h,p=500,m=150,x=0,y=10;function g(E){E.property("__zoom",cZ).on("wheel.zoom",A,{passive:!1}).on("mousedown.zoom",C).on("dblclick.zoom",k).filter(i).on("touchstart.zoom",M).on("touchmove.zoom",I).on("touchend.zoom touchcancel.zoom",R).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(E,P,O,L){var T=E.selection?E.selection():E;T.property("__zoom",cZ),E!==T?S(E,P,O,L):T.interrupt().each(function(){_(this,arguments).event(L).start().zoom(null,typeof P=="function"?P.apply(this,arguments):P).end()})},g.scaleBy=function(E,P,O,L){g.scaleTo(E,function(){var T=this.__zoom.k,D=typeof P=="function"?P.apply(this,arguments):P;return T*D},O,L)},g.scaleTo=function(E,P,O,L){g.transform(E,function(){var T=e.apply(this,arguments),D=this.__zoom,F=O==null?N(T):typeof O=="function"?O.apply(this,arguments):O,q=D.invert(F),B=typeof P=="function"?P.apply(this,arguments):P;return n(v(w(D,B),F,q),T,a)},O,L)},g.translateBy=function(E,P,O,L){g.transform(E,function(){return n(this.__zoom.translate(typeof P=="function"?P.apply(this,arguments):P,typeof O=="function"?O.apply(this,arguments):O),e.apply(this,arguments),a)},null,L)},g.translateTo=function(E,P,O,L,T){g.transform(E,function(){var D=e.apply(this,arguments),F=this.__zoom,q=L==null?N(D):typeof L=="function"?L.apply(this,arguments):L;return n(JP.translate(q[0],q[1]).scale(F.k).translate(typeof P=="function"?-P.apply(this,arguments):-P,typeof O=="function"?-O.apply(this,arguments):-O),D,a)},L,T)};function w(E,P){return P=Math.max(s[0],Math.min(s[1],P)),P===E.k?E:new sd(P,E.x,E.y)}function v(E,P,O){var L=P[0]-O[0]*E.k,T=P[1]-O[1]*E.k;return L===E.x&&T===E.y?E:new sd(E.k,L,T)}function N(E){return[(+E[0][0]+ +E[1][0])/2,(+E[0][1]+ +E[1][1])/2]}function S(E,P,O,L){E.on("start.zoom",function(){_(this,arguments).event(L).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(L).end()}).tween("zoom",function(){var T=this,D=arguments,F=_(T,D).event(L),q=e.apply(T,D),B=O==null?N(q):typeof O=="function"?O.apply(T,D):O,z=Math.max(q[1][0]-q[0][0],q[1][1]-q[0][1]),H=T.__zoom,W=typeof P=="function"?P.apply(T,D):P,G=c(H.invert(B).concat(z/H.k),W.invert(B).concat(z/W.k));return function(K){if(K===1)K=W;else{var ee=G(K),V=z/ee[2];K=new sd(V,B[0]-ee[0]*V,B[1]-ee[1]*V)}F.zoom(null,K)}})}function _(E,P,O){return!O&&E.__zooming||new j(E,P)}function j(E,P){this.that=E,this.args=P,this.active=0,this.sourceEvent=null,this.extent=e.apply(E,P),this.taps=0}j.prototype={event:function(E){return E&&(this.sourceEvent=E),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(E,P){return this.mouse&&E!=="mouse"&&(this.mouse[1]=P.invert(this.mouse[0])),this.touch0&&E!=="touch"&&(this.touch0[1]=P.invert(this.touch0[0])),this.touch1&&E!=="touch"&&(this.touch1[1]=P.invert(this.touch1[0])),this.that.__zoom=P,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(E){var P=go(this.that).datum();u.call(E,this.that,new KOt(E,{sourceEvent:this.sourceEvent,target:g,transform:this.that.__zoom,dispatch:u}),P)}};function A(E,...P){if(!t.apply(this,arguments))return;var O=_(this,P).event(E),L=this.__zoom,T=Math.max(s[0],Math.min(s[1],L.k*Math.pow(2,r.apply(this,arguments)))),D=Hl(E);if(O.wheel)(O.mouse[0][0]!==D[0]||O.mouse[0][1]!==D[1])&&(O.mouse[1]=L.invert(O.mouse[0]=D)),clearTimeout(O.wheel);else{if(L.k===T)return;O.mouse=[D,L.invert(D)],hk(this),O.start()}Qb(E),O.wheel=setTimeout(F,m),O.zoom("mouse",n(v(w(L,T),O.mouse[0],O.mouse[1]),O.extent,a));function F(){O.wheel=null,O.end()}}function C(E,...P){if(h||!t.apply(this,arguments))return;var O=E.currentTarget,L=_(this,P,!0).event(E),T=go(E.view).on("mousemove.zoom",B,!0).on("mouseup.zoom",z,!0),D=Hl(E,O),F=E.clientX,q=E.clientY;Eye(E.view),k3(E),L.mouse=[D,this.__zoom.invert(D)],hk(this),L.start();function B(H){if(Qb(H),!L.moved){var W=H.clientX-F,G=H.clientY-q;L.moved=W*W+G*G>x}L.event(H).zoom("mouse",n(v(L.that.__zoom,L.mouse[0]=Hl(H,O),L.mouse[1]),L.extent,a))}function z(H){T.on("mousemove.zoom mouseup.zoom",null),Aye(H.view,L.moved),Qb(H),L.event(H).end()}}function k(E,...P){if(t.apply(this,arguments)){var O=this.__zoom,L=Hl(E.changedTouches?E.changedTouches[0]:E,this),T=O.invert(L),D=O.k*(E.shiftKey?.5:2),F=n(v(w(O,D),L,T),e.apply(this,P),a);Qb(E),l>0?go(this).transition().duration(l).call(S,F,L,E):go(this).call(g.transform,F,L,E)}}function M(E,...P){if(t.apply(this,arguments)){var O=E.touches,L=O.length,T=_(this,P,E.changedTouches.length===L).event(E),D,F,q,B;for(k3(E),F=0;F<L;++F)q=O[F],B=Hl(q,this),B=[B,this.__zoom.invert(B),q.identifier],T.touch0?!T.touch1&&T.touch0[2]!==B[2]&&(T.touch1=B,T.taps=0):(T.touch0=B,D=!0,T.taps=1+!!d);d&&(d=clearTimeout(d)),D&&(T.taps<2&&(f=B[0],d=setTimeout(function(){d=null},p)),hk(this),T.start())}}function I(E,...P){if(this.__zooming){var O=_(this,P).event(E),L=E.changedTouches,T=L.length,D,F,q,B;for(Qb(E),D=0;D<T;++D)F=L[D],q=Hl(F,this),O.touch0&&O.touch0[2]===F.identifier?O.touch0[0]=q:O.touch1&&O.touch1[2]===F.identifier&&(O.touch1[0]=q);if(F=O.that.__zoom,O.touch1){var z=O.touch0[0],H=O.touch0[1],W=O.touch1[0],G=O.touch1[1],K=(K=W[0]-z[0])*K+(K=W[1]-z[1])*K,ee=(ee=G[0]-H[0])*ee+(ee=G[1]-H[1])*ee;F=w(F,Math.sqrt(K/ee)),q=[(z[0]+W[0])/2,(z[1]+W[1])/2],B=[(H[0]+G[0])/2,(H[1]+G[1])/2]}else if(O.touch0)q=O.touch0[0],B=O.touch0[1];else return;O.zoom("touch",n(v(F,q,B),O.extent,a))}}function R(E,...P){if(this.__zooming){var O=_(this,P).event(E),L=E.changedTouches,T=L.length,D,F;for(k3(E),h&&clearTimeout(h),h=setTimeout(function(){h=null},p),D=0;D<T;++D)F=L[D],O.touch0&&O.touch0[2]===F.identifier?delete O.touch0:O.touch1&&O.touch1[2]===F.identifier&&delete O.touch1;if(O.touch1&&!O.touch0&&(O.touch0=O.touch1,delete O.touch1),O.touch0)O.touch0[1]=this.__zoom.invert(O.touch0[0]);else if(O.end(),O.taps===2&&(F=Hl(F,this),Math.hypot(f[0]-F[0],f[1]-F[1])<y)){var q=go(this).on("dblclick.zoom");q&&q.apply(this,arguments)}}}return g.wheelDelta=function(E){return arguments.length?(r=typeof E=="function"?E:nC(+E),g):r},g.filter=function(E){return arguments.length?(t=typeof E=="function"?E:nC(!!E),g):t},g.touchable=function(E){return arguments.length?(i=typeof E=="function"?E:nC(!!E),g):i},g.extent=function(E){return arguments.length?(e=typeof E=="function"?E:nC([[+E[0][0],+E[0][1]],[+E[1][0],+E[1][1]]]),g):e},g.scaleExtent=function(E){return arguments.length?(s[0]=+E[0],s[1]=+E[1],g):[s[0],s[1]]},g.translateExtent=function(E){return arguments.length?(a[0][0]=+E[0][0],a[1][0]=+E[1][0],a[0][1]=+E[0][1],a[1][1]=+E[1][1],g):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},g.constrain=function(E){return arguments.length?(n=E,g):n},g.duration=function(E){return arguments.length?(l=+E,g):l},g.interpolate=function(E){return arguments.length?(c=E,g):c},g.on=function(){var E=u.on.apply(u,arguments);return E===u?g:E},g.clickDistance=function(E){return arguments.length?(x=(E=+E)*E,g):Math.sqrt(x)},g.tapDistance=function(E){return arguments.length?(y=+E,g):y},g}const fu={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:t=>`Node type "${t}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:t=>`The old edge with id=${t} does not exist.`,error009:t=>`Marker type "${t}" doesn't exist.`,error008:(t,{id:e,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${t} handle id: "${t==="source"?n:r}", edge id: ${e}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:t=>`Edge type "${t}" not found. Using fallback type "default".`,error012:t=>
4955`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(t="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${t}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},K_=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Uye=["Enter"," ","Escape"],zye={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:t,x:e,y:n})=>`Moved selected node ${t}. New position, x: ${e}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var a0;(function(t){t.Strict="strict",t.Loose="loose"})(a0||(a0={}));var km;(function(t){t.Free="free",t.Vertical="vertical",t.Horizontal="horizontal"})(km||(km={}));var Y_;(function(t){t.Partial="partial",t.Full="full"})(Y_||(Y_={}));const Bye={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Mf;(function(t){t.Bezier="default",t.Straight="straight",t.Step="step",t.SmoothStep="smoothstep",t.SimpleBezier="simplebezier"})(Mf||(Mf={}));var ZE;(function(t){t.Arrow="arrow",t.ArrowClosed="arrowclosed"})(ZE||(ZE={}));var _t;(function(t){t.Left="left",t.Top="top",t.Right="right",t.Bottom="bottom"})(_t||(_t={}));const uZ={[_t.Left]:_t.Right,[_t.Right]:_t.Left,[_t.Top]:_t.Bottom,[_t.Bottom]:_t.Top};function Vye(t){return t===null?null:t?"valid":"invalid"}const Hye=t=>"id"in t&&"source"in t&&"target"in t,eRt=t=>"id"in t&&"position"in t&&!("source"in t)&&!("target"in t),Z8=t=>"id"in t&&"internals"in t&&!("source"in t)&&!("target"in t),pN=(t,e=[0,0])=>{const{width:n,height:r}=Gd(t),i=t.origin??e,s=n*i[0],a=r*i[1];return{x:t.position.x-s,y:t.position.y-a}},tRt=(t,e={nodeOrigin:[0,0]})=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const n=t.reduce((r,i)=>{const s=typeof i=="string";let a=!e.nodeLookup&&!s?i:void 0;e.nodeLookup&&(a=s?e.nodeLookup.get(i):Z8(i)?i:e.nodeLookup.get(i.id));const l=a?eA(a,e.nodeOrigin):{x:0,y:0,x2:0,y2:0};return ZP(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return eO(n)},mN=(t,e={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return t.forEach(i=>{(e.filter===void 0||e.filter(i))&&(n=ZP(n,eA(i)),r=!0)}),r?eO(n):{x:0,y:0,width:0,height:0}},e9=(t,e,[n,r,i]=[0,0,1],s=!1,a=!1)=>{const l={...xN(e,[n,r,i]),width:e.width/i,height:e.height/i},c=[];for(const u of t.values()){const{measured:d,selectable:f=!0,hidden:h=!1}=u;if(a&&!f||h)continue;const p=d.width??u.width??u.initialWidth??null,m=d.height??u.height??u.initialHeight??null,x=X_(l,l0(u)),y=(p??0)*(m??0),g=s&&x>0;(!u.internals.handleBounds||g||x>=y||u.dragging)&&c.push(u)}return c},nRt=(t,e)=>{const n=new Set;return t.forEach(r=>{n.add(r.id)}),e.filter(r=>n.has(r.source)||n.has(r.target))};function rRt(t,e){const n=new Map,r=e!=null&&e.nodes?new Set(e.nodes.map(i=>i.id)):null;return t.forEach(i=>{i.measured.width&&i.measured.height&&((e==null?void 0:e.includeHiddenNodes)||!i.hidden)&&(!r||r.has(i.id))&&n.set(i.id,i)}),n}
4955async function iRt({nodes:t,width:e,height:n,panZoom:r,minZoom:i,maxZoom:s},a){if(t.size===0)return Promise.resolve(!0);const l=rRt(t,a),c=mN(l),u=t9(c,e,n,(a==null?void 0:a.minZoom)??i,(a==null?void 0:a.maxZoom)??s,(a==null?void 0:a.padding)??.1);return await r.setViewport(u,{duration:a==null?void 0:a.duration,ease:a==null?void 0:a.ease,interpolate:a==null?void 0:a.interpolate}),Promise.resolve(!0)}function Wye({nodeId:t,nextPosition:e,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:s}){const a=n.get(t),l=a.parentId?n.get(a.parentId):void 0,{x:c,y:u}=l?l.internals.positionAbsolute:{x:0,y:0},d=a.origin??r;let f=a.extent||i;if(a.extent==="parent"&&!a.expandParent)if(!l)s==null||s("005",fu.error005());else{const p=l.measured.width,m=l.measured.height;p&&m&&(f=[[c,u],[c+p,u+m]])}else l&&c0(a.extent)&&(f=[[a.extent[0][0]+c,a.extent[0][1]+u],[a.extent[1][0]+c,a.extent[1][1]+u]]);const h=c0(f)?dg(e,f,a.measured):e;return(a.measured.width===void 0||a.measured.height===void 0)&&(s==null||s("015",fu.error015())),{position:{x:h.x-c+(a.measured.width??0)*d[0],y:h.y-u+(a.measured.height??0)*d[1]},positionAbsolute:h}}async function sRt({nodesToRemove:t=[],edgesToRemove:e=[],nodes:n,edges:r,onBeforeDelete:i}){const s=new Set(t.map(h=>h.id)),a=[];for(const h of n){if(h.deletable===!1)continue;const p=s.has(h.id),m=!p&&h.parentId&&a.find(x=>x.id===h.parentId);(p||m)&&a.push(h)}const l=new Set(e.map(h=>h.id)),c=r.filter(h=>h.deletable!==!1),d=nRt(a,c);for(const h of c)l.has(h.id)&&!d.find(m=>m.id===h.id)&&d.push(h);if(!i)return{edges:d,nodes:a};const f=await i({nodes:a,edges:d});return typeof f=="boolean"?f?{edges:d,nodes:a}:{edges:[],nodes:[]}:f}const o0=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),dg=(t={x:0,y:0},e,n)=>({x:o0(t.x,e[0][0],e[1][0]-((n==null?void 0:n.width)??0)),y:o0(t.y,e[0][1],e[1][1]-((n==null?void 0:n.height)??0))});function Gye(t,e,n){const{width:r,height:i}=Gd(n),{x:s,y:a}=n.internals.positionAbsolute;return dg(t,[[s,a],[s+r,a+i]],e)}const dZ=(t,e,n)=>t<e?o0(Math.abs(t-e),1,e)/e:t>n?-o0(Math.abs(t-n),1,e)/e:0,qye=(t,e,n=15,r=40)=>{const i=dZ(t.x,r,e.width-r)*n,s=dZ(t.y,r,e.height-r)*n;return[i,s]},ZP=(t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x2,e.x2),y2:Math.max(t.y2,e.y2)}),bF=({x:t,y:e,width:n,height:r})=>({x:t,y:e,x2:t+n,y2:e+r}),eO=({x:t,y:e,x2:n,y2:r})=>({x:t,y:e,width:n-t,height:r-e}),l0=(t,e=[0,0])=>{var i,s;const{x:n,y:r}=Z8(t)?t.internals.positionAbsolute:pN(t,e);return{x:n,y:r,width:((i=t.measured)==null?void 0:i.width)??t.width??t.initialWidth??0,height:((s=t.measured)==null?void 0:s.height)??t.height??t.initialHeight??0}},eA=(t,e=[0,0])=>{var i,s;const{x:n,y:r}=Z8(t)?t.internals.positionAbsolute:pN(t,e);return{x:n,y:r,x2:n+(((i=t.measured)==null?void 0:i.width)??t.width??t.initialWidth??0),y2:r+(((s=t.measured)==null?void 0:s.height)??t.height??t.initialHeight??0)}},Kye=(t,e)=>eO(ZP(bF(t),bF(e))),X_=(t,e)=>{const n=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x)),r=Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y));return Math.ceil(n*r)},fZ=t=>nc(t.width)&&nc(t.height)&&nc(t.x)&&nc(t.y),nc=t=>!isNaN(t)&&isFinite(t),aRt=(t,e)=>{},gN=(t,e=[1,1])=>({x:e[0]*Math.round(t.x/e[0]),y:e[1]*Math.round(t.y/e[1])}),xN=({x:t,y:e},[n,r,i],s=!1,a=[1,1])=>{const l={x:(t-n)/i,y:(e-r)/i};return s?gN(l,a):l},tA=({x:t,y:e},[n,r,i])=>({x:t*i+n,y:e*i+r});function Tx(t,e){if(typeof t=="number")return Math.floor((e-e/(1+t))*.5);if(typeof t=="string"&&t.endsWith("px")){const n=parseFloat(t);if(!Number.isNaN(n))return Math.floor(n)}if(typeof t=="string"&&t.endsWith("%")){const n=parseFloat(t);if(!Number.isNaN(n))return Math.floor(e*n*.01)}return console.error(`[React Flow] The padding value "${t}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function oRt(t,e,n){if(typeof t=="string"||typeof t=="number"){const r=Tx(t,n),i=Tx(t,e);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof t=="object"){const r=Tx(t.top??t.y??0,n),i=Tx(t.bottom??t.y??0,n),s=Tx(t.left??t.x??0,e),a=Tx(t.right??t.x??0,e);return{top:r,right:a,bottom:i,left:s,x:s+a,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function lRt(t,e,n,r,i,s){const{x:a,y:l}=tA(t,[e,n,r]),{x:c,y:u}=tA({x:t.x+t.width,y:t.y+t.height},[e,n,r]),d=i-c,f=s-u;return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(d),bottom:Math.floor(f)}}const t9=(t,e,n,r,i,s)=>{const a=oRt(s,e,n),l=(e-a.x)/t.width,c=(n-a.y)/t.height,u=Math.min(l,c),d=o0(u,r,i
4955),f=t.x+t.width/2,h=t.y+t.height/2,p=e/2-f*d,m=n/2-h*d,x=lRt(t,p,m,d,e,n),y={left:Math.min(x.left-a.left,0),top:Math.min(x.top-a.top,0),right:Math.min(x.right-a.right,0),bottom:Math.min(x.bottom-a.bottom,0)};return{x:p-y.left+y.right,y:m-y.top+y.bottom,zoom:d}},Q_=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0};function c0(t){return t!=null&&t!=="parent"}function Gd(t){var e,n;return{width:((e=t.measured)==null?void 0:e.width)??t.width??t.initialWidth??0,height:((n=t.measured)==null?void 0:n.height)??t.height??t.initialHeight??0}}function Yye(t){var e,n;return(((e=t.measured)==null?void 0:e.width)??t.width??t.initialWidth)!==void 0&&(((n=t.measured)==null?void 0:n.height)??t.height??t.initialHeight)!==void 0}function Xye(t,e={width:0,height:0},n,r,i){const s={...t},a=r.get(n);if(a){const l=a.origin||i;s.x+=a.internals.positionAbsolute.x-(e.width??0)*l[0],s.y+=a.internals.positionAbsolute.y-(e.height??0)*l[1]}return s}function hZ(t,e){if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}function cRt(){let t,e;return{promise:new Promise((r,i)=>{t=r,e=i}),resolve:t,reject:e}}function uRt(t){return{...zye,...t||{}}}function s1(t,{snapGrid:e=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){const{x:s,y:a}=rc(t),l=xN({x:s-((i==null?void 0:i.left)??0),y:a-((i==null?void 0:i.top)??0)},r),{x:c,y:u}=n?gN(l,e):l;return{xSnapped:c,ySnapped:u,...l}}const n9=t=>({width:t.offsetWidth,height:t.offsetHeight}),Qye=t=>{var e;return((e=t==null?void 0:t.getRootNode)==null?void 0:e.call(t))||(window==null?void 0:window.document)},dRt=["INPUT","SELECT","TEXTAREA"];function Jye(t){var r,i;const e=((i=(r=t.composedPath)==null?void 0:r.call(t))==null?void 0:i[0])||t.target;return(e==null?void 0:e.nodeType)!==1?!1:dRt.includes(e.nodeName)||e.hasAttribute("contenteditable")||!!e.closest(".nokey")}const Zye=t=>"clientX"in t,rc=(t,e)=>{var s,a;const n=Zye(t),r=n?t.clientX:(s=t.touches)==null?void 0:s[0].clientX,i=n?t.clientY:(a=t.touches)==null?void 0:a[0].clientY;return{x:r-((e==null?void 0:e.left)??0),y:i-((e==null?void 0:e.top)??0)}},pZ=(t,e,n,r,i)=>{const s=e.querySelectorAll(`.${t}`);return!s||!s.length?null:Array.from(s).map(a=>{const l=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:t,nodeId:i,position:a.getAttribute("data-handlepos"),x:(l.left-n.left)/r,y:(l.top-n.top)/r,...n9(a)}})};function eve({sourceX:t,sourceY:e,targetX:n,targetY:r,sourceControlX:i,sourceControlY:s,targetControlX:a,targetControlY:l}){const c=t*.125+i*.375+a*.375+n*.125,u=e*.125+s*.375+l*.375+r*.125,d=Math.abs(c-t),f=Math.abs(u-e);return[c,u,d,f]}function rC(t,e){return t>=0?.5*t:e*25*Math.sqrt(-t)}function mZ({pos:t,x1:e,y1:n,x2:r,y2:i,c:s}){switch(t){case _t.Left:return[e-rC(e-r,s),n];case _t.Right:return[e+rC(r-e,s),n];case _t.Top:return[e,n-rC(n-i,s)];case _t.Bottom:return[e,n+rC(i-n,s)]}}function tve({sourceX:t,sourceY:e,sourcePosition:n=_t.Bottom,targetX:r,targetY:i,targetPosition:s=_t.Top,curvature:a=.25}){const[l,c]=mZ({pos:n,x1:t,y1:e,x2:r,y2:i,c:a}),[u,d]=mZ({pos:s,x1:r,y1:i,x2:t,y2:e,c:a}),[f,h,p,m]=eve({sourceX:t,sourceY:e,targetX:r,targetY:i,sourceControlX:l,sourceControlY:c,targetControlX:u,targetControlY:d});return[`M${t},${e} C${l},${c} ${u},${d} ${r},${i}`,f,h,p,m]}function nve({sourceX:t,sourceY:e,targetX:n,targetY:r}){const i=Math.abs(n-t)/2,s=n<t?n+i:n-i,a=Math.abs(r-e)/2,l=r<e?r+a:r-a;return[s,l,i,a]}function fRt({sourceNode:t,targetNode:e,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:s="basic"}){if(s==="manual")return r;const a=i&&n?r+1e3:r,l=Math.max(t.parentId||i&&t.selected?t.internals.z:0,e.parentId||i&&e.selected?e.internals.z:0);return a+l}function hRt({sourceNode:t,targetNode:e,width:n,height:r,transform:i}){const s=ZP(eA(t),eA(e));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);const a={x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]};return X_(a,eO(s))>0}const pRt=({source:t,sourceHandle:e,target:n,targetHandle:r})=>`xy-edge__${t}${e||""}-${n}${r||""}`,mRt=(t,e)=>e.some(n=>n.source===t.source&&n.target===t.target&&(n.sourceHandle===t.sourceHandle||!n.sourceHandle&&!t.sourceHandle)&&(n.targetHandle===t.targetHandle||!n.targetHandle&&!t.targetHandle)),gRt=(t,e,n={})=>
4955{if(!t.source||!t.target)return e;const r=n.getEdgeId||pRt;let i;return Hye(t)?i={...t}:i={...t,id:r(t)},mRt(i,e)?e:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,e.concat(i))};function rve({sourceX:t,sourceY:e,targetX:n,targetY:r}){const[i,s,a,l]=nve({sourceX:t,sourceY:e,targetX:n,targetY:r});return[`M ${t},${e}L ${n},${r}`,i,s,a,l]}const gZ={[_t.Left]:{x:-1,y:0},[_t.Right]:{x:1,y:0},[_t.Top]:{x:0,y:-1},[_t.Bottom]:{x:0,y:1}},xRt=({source:t,sourcePosition:e=_t.Bottom,target:n})=>e===_t.Left||e===_t.Right?t.x<n.x?{x:1,y:0}:{x:-1,y:0}:t.y<n.y?{x:0,y:1}:{x:0,y:-1},xZ=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function yRt({source:t,sourcePosition:e=_t.Bottom,target:n,targetPosition:r=_t.Top,center:i,offset:s,stepPosition:a}){const l=gZ[e],c=gZ[r],u={x:t.x+l.x*s,y:t.y+l.y*s},d={x:n.x+c.x*s,y:n.y+c.y*s},f=xRt({source:u,sourcePosition:e,target:d}),h=f.x!==0?"x":"y",p=f[h];let m=[],x,y;const g={x:0,y:0},w={x:0,y:0},[,,v,N]=nve({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(l[h]*c[h]===-1){h==="x"?(x=i.x??u.x+(d.x-u.x)*a,y=i.y??(u.y+d.y)/2):(x=i.x??(u.x+d.x)/2,y=i.y??u.y+(d.y-u.y)*a);const _=[{x,y:u.y},{x,y:d.y}],j=[{x:u.x,y},{x:d.x,y}];l[h]===p?m=h==="x"?_:j:m=h==="x"?j:_}else{const _=[{x:u.x,y:d.y}],j=[{x:d.x,y:u.y}];if(h==="x"?m=l.x===p?j:_:m=l.y===p?_:j,e===r){const I=Math.abs(t[h]-n[h]);if(I<=s){const R=Math.min(s-1,s-I);l[h]===p?g[h]=(u[h]>t[h]?-1:1)*R:w[h]=(d[h]>n[h]?-1:1)*R}}if(e!==r){const I=h==="x"?"y":"x",R=l[h]===c[I],E=u[I]>d[I],P=u[I]<d[I];(l[h]===1&&(!R&&E||R&&P)||l[h]!==1&&(!R&&P||R&&E))&&(m=h==="x"?_:j)}const A={x:u.x+g.x,y:u.y+g.y},C={x:d.x+w.x,y:d.y+w.y},k=Math.max(Math.abs(A.x-m[0].x),Math.abs(C.x-m[0].x)),M=Math.max(Math.abs(A.y-m[0].y),Math.abs(C.y-m[0].y));k>=M?(x=(A.x+C.x)/2,y=m[0].y):(x=m[0].x,y=(A.y+C.y)/2)}return[[t,{x:u.x+g.x,y:u.y+g.y},...m,{x:d.x+w.x,y:d.y+w.y},n],x,y,v,N]}function vRt(t,e,n,r){const i=Math.min(xZ(t,e)/2,xZ(e,n)/2,r),{x:s,y:a}=e;if(t.x===s&&s===n.x||t.y===a&&a===n.y)return`L${s} ${a}`;if(t.y===a){const u=t.x<n.x?-1:1,d=t.y<n.y?1:-1;return`L ${s+i*u},${a}Q ${s},${a} ${s},${a+i*d}`}const l=t.x<n.x?1:-1,c=t.y<n.y?-1:1;return`L ${s},${a+i*c}Q ${s},${a} ${s+i*l},${a}`}function wF({sourceX:t,sourceY:e,sourcePosition:n=_t.Bottom,targetX:r,targetY:i,targetPosition:s=_t.Top,borderRadius:a=5,centerX:l,centerY:c,offset:u=20,stepPosition:d=.5}){const[f,h,p,m,x]=yRt({source:{x:t,y:e},sourcePosition:n,target:{x:r,y:i},targetPosition:s,center:{x:l,y:c},offset:u,stepPosition:d});return[f.reduce((g,w,v)=>{let N="";return v>0&&v<f.length-1?N=vRt(f[v-1],w,f[v+1],a):N=`${v===0?"M":"L"}${w.x} ${w.y}`,g+=N,g},""),h,p,m,x]}function yZ(t){var e;return t&&!!(t.internals.handleBounds||(e=t.handles)!=null&&e.length)&&!!(t.measured.width||t.width||t.initialWidth)}function bRt(t){var f;const{sourceNode:e,targetNode:n}=t;if(!yZ(e)||!yZ(n))return null;const r=e.internals.handleBounds||vZ(e.handles),i=n.internals.handleBounds||vZ(n.handles),s=bZ((r==null?void 0:r.source)??[],t.sourceHandle),a=bZ(t.connectionMode===a0.Strict?(i==null?void 0:i.target)??[]:((i==null?void 0:i.target)??[]).concat((i==null?void 0:i.source)??[]),t.targetHandle);if(!s||!a)return(f=t.onError)==null||f.call(t,"008",fu.error008(s?"target":"source",{id:t.id,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle})),null;const l=(s==null?void 0:s.position)||_t.Bottom,c=(a==null?void 0:a.position)||_t.Top,u=fg(e,s,l),d=fg(n,a,c);return{sourceX:u.x,sourceY:u.y,targetX:d.x,targetY:d.y,sourcePosition:l,targetPosition:c}}function vZ(t){if(!t)return null;const e=[],n=[];for(const r of t)r.width=r.width??1,r.height=r.height??1,r.type==="source"?e.push(r):r.type==="target"&&n.push(r);return{source:e,target:n}}function fg(t,e,n=_t.Left,r=!1){const i=((e==null?void 0:e.x)??0)+t.internals.positionAbsolute.x,s=((e==null?void 0:e.y)??0)+t.internals.positionAbsolute.y,{width:a,height:l}=e??Gd(t);if(r)return{x:i+a/2,y:s+l/2};switch((e==null?void 0:e.position)??n){case _t.Top:return{x:i+a/2,y:s};case _t.Right:return{x:i+a,y:s+l/2};case _t.Bottom:return{x:i+a/2,y:s+l};case _t.Left:return{x:i,y:s+l/2}}}function bZ(t,e){return t&&(e?t.find(n=>n.id===e):t[0])||null}function _F(t,e){return t?typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(r=>`${r}=${t[r]}`).join("&")}`:""}function wRt(t,{id:e,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){const s=new Set;return t.reduce((a,l)=>
4955([l.markerStart||r,l.markerEnd||i].forEach(c=>{if(c&&typeof c=="object"){const u=_F(c,e);s.has(u)||(a.push({id:u,color:c.color||n,...c}),s.add(u))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))}const ive=1e3,_Rt=10,r9={nodeOrigin:[0,0],nodeExtent:K_,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},SRt={...r9,checkEquality:!0};function i9(t,e){const n={...t};for(const r in e)e[r]!==void 0&&(n[r]=e[r]);return n}function NRt(t,e,n){const r=i9(r9,n);for(const i of t.values())if(i.parentId)a9(i,t,e,r);else{const s=pN(i,r.nodeOrigin),a=c0(i.extent)?i.extent:r.nodeExtent,l=dg(s,a,Gd(i));i.internals.positionAbsolute=l}}function jRt(t,e){if(!t.handles)return t.measured?e==null?void 0:e.internals.handleBounds:void 0;const n=[],r=[];for(const i of t.handles){const s={id:i.id,width:i.width??1,height:i.height??1,nodeId:t.id,x:i.x,y:i.y,position:i.position,type:i.type};i.type==="source"?n.push(s):i.type==="target"&&r.push(s)}return{source:n,target:r}}function s9(t){return t==="manual"}function SF(t,e,n,r={}){var u,d;const i=i9(SRt,r),s={i:0},a=new Map(e),l=i!=null&&i.elevateNodesOnSelect&&!s9(i.zIndexMode)?ive:0;let c=t.length>0;e.clear(),n.clear();for(const f of t){let h=a.get(f.id);if(i.checkEquality&&f===(h==null?void 0:h.internals.userNode))e.set(f.id,h);else{const p=pN(f,i.nodeOrigin),m=c0(f.extent)?f.extent:i.nodeExtent,x=dg(p,m,Gd(f));h={...i.defaults,...f,measured:{width:(u=f.measured)==null?void 0:u.width,height:(d=f.measured)==null?void 0:d.height},internals:{positionAbsolute:x,handleBounds:jRt(f,h),z:sve(f,l,i.zIndexMode),userNode:f}},e.set(f.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(c=!1),f.parentId&&a9(h,e,n,r,s)}return c}function CRt(t,e){if(!t.parentId)return;const n=e.get(t.parentId);n?n.set(t.id,t):e.set(t.parentId,new Map([[t.id,t]]))}function a9(t,e,n,r,i){const{elevateNodesOnSelect:s,nodeOrigin:a,nodeExtent:l,zIndexMode:c}=i9(r9,r),u=t.parentId,d=e.get(u);if(!d){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}CRt(t,n),i&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++i.i,d.internals.z=d.internals.z+i.i*_Rt),i&&d.internals.rootParentIndex!==void 0&&(i.i=d.internals.rootParentIndex);const f=s&&!s9(c)?ive:0,{x:h,y:p,z:m}=kRt(t,d,a,l,f,c),{positionAbsolute:x}=t.internals,y=h!==x.x||p!==x.y;(y||m!==t.internals.z)&&e.set(t.id,{...t,internals:{...t.internals,positionAbsolute:y?{x:h,y:p}:x,z:m}})}function sve(t,e,n){const r=nc(t.zIndex)?t.zIndex:0;return s9(n)?r:r+(t.selected?e:0)}function kRt(t,e,n,r,i,s){const{x:a,y:l}=e.internals.positionAbsolute,c=Gd(t),u=pN(t,n),d=c0(t.extent)?dg(u,t.extent,c):u;let f=dg({x:a+d.x,y:l+d.y},r,c);t.extent==="parent"&&(f=Gye(f,c,e));const h=sve(t,i,s),p=e.internals.z??0;return{x:f.x,y:f.y,z:p>=h?p+1:h}}function o9(t,e,n,r=[0,0]){var a;const i=[],s=new Map;for(const l of t){const c=e.get(l.parentId);if(!c)continue;const u=((a=s.get(l.parentId))==null?void 0:a.expandedRect)??l0(c),d=Kye(u,l.rect);s.set(l.parentId,{expandedRect:d,parent:c})}return s.size>0&&s.forEach(({expandedRect:l,parent:c},u)=>{var v;const d=c.internals.positionAbsolute,f=Gd(c),h=c.origin??r,p=l.x<d.x?Math.round(Math.abs(d.x-l.x)):0,m=l.y<d.y?Math.round(Math.abs(d.y-l.y)):0,x=Math.max(f.width,Math.round(l.width)),y=Math.max(f.height,Math.round(l.height)),g=(x-f.width)*h[0],w=(y-f.height)*h[1];(p>0||m>0||g||w)&&(i.push({id:u,type:"position",position:{x:c.position.x-p+g,y:c.position.y-m+w}}),(v=n.get(u))==null||v.forEach(N=>{t.some(S=>S.id===N.id)||i.push({id:N.id,type:"position",position:{x:N.position.x+p,y:N.position.y+m}})})),(f.width<l.width||f.height<l.height||p||m)&&i.push({id:u,type:"dimensions",setAttributes:!0,dimensions:{width:x+(p?h[0]*p-g:0),height:y+(m?h[1]*m-w:0)}})}),i}function ERt(t,e,n,r,i,s,a){const l=r==null?void 0:r.querySelector(".xyflow__viewport");let c=!1;if(!l)return{changes:[],updatedInternals:c};const u=[],d=window.getComputedStyle(l),{m22:f}=new window.DOMMatrixReadOnly(d.transform),h=[];for(const p of t.values()){const m=e.get(p.id);if(!m)continue;if(m.hidden){e.set(m.id,{...m,internals:{...m.internals,handleBounds:void 0}}),c=!0;continue}const x=n9(p.nodeElement),y=m.measured.width!==x.width||m.measured.height!==x.height;if(!!(x.width&&x.height&&(y||!m.internals.handleBounds||p.force))){const w=p.nodeElement.getBoundingClientRect(),v=c0(m.extent)?m.extent:s;let{positionAbsolute:N}=m.internals;m.parentId&&m.extent==="parent"?N=Gye(N,x,e.get(m.parentId)):v&&(N=dg(N,v,x));const S={...m,measured:x,internals:{...m.internals,positionAbsolute:N,handleBounds:{source:pZ("source",p.nodeElement,w,f,m.id),target:pZ("target",p.nodeElement,w,f,m.id)}}};
4955e.set(m.id,S),m.parentId&&a9(S,e,n,{nodeOrigin:i,zIndexMode:a}),c=!0,y&&(u.push({id:m.id,type:"dimensions",dimensions:x}),m.expandParent&&m.parentId&&h.push({id:m.id,parentId:m.parentId,rect:l0(S,i)}))}}if(h.length>0){const p=o9(h,e,n,i);u.push(...p)}return{changes:u,updatedInternals:c}}async function ARt({delta:t,panZoom:e,transform:n,translateExtent:r,width:i,height:s}){if(!e||!t.x&&!t.y)return Promise.resolve(!1);const a=await e.setViewportConstrained({x:n[0]+t.x,y:n[1]+t.y,zoom:n[2]},[[0,0],[i,s]],r),l=!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2]);return Promise.resolve(l)}function wZ(t,e,n,r,i,s){let a=i;const l=r.get(a)||new Map;r.set(a,l.set(n,e)),a=`${i}-${t}`;const c=r.get(a)||new Map;if(r.set(a,c.set(n,e)),s){a=`${i}-${t}-${s}`;const u=r.get(a)||new Map;r.set(a,u.set(n,e))}}function ave(t,e,n){t.clear(),e.clear();for(const r of n){const{source:i,target:s,sourceHandle:a=null,targetHandle:l=null}=r,c={edgeId:r.id,source:i,target:s,sourceHandle:a,targetHandle:l},u=`${i}-${a}--${s}-${l}`,d=`${s}-${l}--${i}-${a}`;wZ("source",c,d,t,i,a),wZ("target",c,u,t,s,l),e.set(r.id,r)}}function ove(t,e){if(!t.parentId)return!1;const n=e.get(t.parentId);return n?n.selected?!0:ove(n,e):!1}function _Z(t,e,n){var i;let r=t;do{if((i=r==null?void 0:r.matches)!=null&&i.call(r,e))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function TRt(t,e,n,r){const i=new Map;for(const[s,a]of t)if((a.selected||a.id===r)&&(!a.parentId||!ove(a,t))&&(a.draggable||e&&typeof a.draggable>"u")){const l=t.get(s);l&&i.set(s,{id:s,position:l.position||{x:0,y:0},distance:{x:n.x-l.internals.positionAbsolute.x,y:n.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return i}function E3({nodeId:t,dragItems:e,nodeLookup:n,dragging:r=!0}){var a,l,c;const i=[];for(const[u,d]of e){const f=(a=n.get(u))==null?void 0:a.internals.userNode;f&&i.push({...f,position:d.position,dragging:r})}if(!t)return[i[0],i];const s=(l=n.get(t))==null?void 0:l.internals.userNode;return[s?{...s,position:((c=e.get(t))==null?void 0:c.position)||s.position,dragging:r}:i[0],i]}function MRt({dragItems:t,snapGrid:e,x:n,y:r}){const i=t.values().next().value;if(!i)return null;const s={x:n-i.distance.x,y:r-i.distance.y},a=gN(s,e);return{x:a.x-s.x,y:a.y-s.y}}function PRt({onNodeMouseDown:t,getStoreItems:e,onDragStart:n,onDrag:r,onDragStop:i}){let s={x:null,y:null},a=0,l=new Map,c=!1,u={x:0,y:0},d=null,f=!1,h=null,p=!1,m=!1,x=null;function y({noDragClassName:w,handleSelector:v,domNode:N,isSelectable:S,nodeId:_,nodeClickDistance:j=0}){h=go(N);function A({x:I,y:R}){const{nodeLookup:E,nodeExtent:P,snapGrid:O,snapToGrid:L,nodeOrigin:T,onNodeDrag:D,onSelectionDrag:F,onError:q,updateNodePositions:B}=e();s={x:I,y:R};let z=!1;const H=l.size>1,W=H&&P?bF(mN(l)):null,G=H&&L?MRt({dragItems:l,snapGrid:O,x:I,y:R}):null;for(const[K,ee]of l){if(!E.has(K))continue;let V={x:I-ee.distance.x,y:R-ee.distance.y};L&&(V=G?{x:Math.round(V.x+G.x),y:Math.round(V.y+G.y)}:gN(V,O));let J=null;if(H&&P&&!ee.extent&&W){const{positionAbsolute:fe}=ee.internals,ce=fe.x-W.x+P[0][0],ve=fe.x+ee.measured.width-W.x2+P[1][0],X=fe.y-W.y+P[0][1],de=fe.y+ee.measured.height-W.y2+P[1][1];J=[[ce,X],[ve,de]]}const{position:Y,positionAbsolute:$}=Wye({nodeId:K,nextPosition:V,nodeLookup:E,nodeExtent:J||P,nodeOrigin:T,onError:q});z=z||ee.position.x!==Y.x||ee.position.y!==Y.y,ee.position=Y,ee.internals.positionAbsolute=$}if(m=m||z,!!z&&(B(l,!0),x&&(r||D||!_&&F))){const[K,ee]=E3({nodeId:_,dragItems:l,nodeLookup:E});r==null||r(x,l,K,ee),D==null||D(x,K,ee),_||F==null||F(x,ee)}}async function C(){if(!d)return;const{transform:I,panBy:R,autoPanSpeed:E,autoPanOnNodeDrag:P}=e();if(!P){c=!1,cancelAnimationFrame(a);return}const[O,L]=qye(u,d,E);(O!==0||L!==0)&&(s.x=(s.x??0)-O/I[2],s.y=(s.y??0)-L/I[2],await R({x:O,y:L})&&A(s)),a=requestAnimationFrame(C)}function k(I){var H;const{nodeLookup:R,multiSelectionActive:E,nodesDraggable:P,transform:O,snapGrid:L,snapToGri
4955d:T,selectNodesOnDrag:D,onNodeDragStart:F,onSelectionDragStart:q,unselectNodesAndEdges:B}=e();f=!0,(!D||!S)&&!E&&_&&((H=R.get(_))!=null&&H.selected||B()),S&&D&&_&&(t==null||t(_));const z=s1(I.sourceEvent,{transform:O,snapGrid:L,snapToGrid:T,containerBounds:d});if(s=z,l=TRt(R,P,z,_),l.size>0&&(n||F||!_&&q)){const[W,G]=E3({nodeId:_,dragItems:l,nodeLookup:R});n==null||n(I.sourceEvent,l,W,G),F==null||F(I.sourceEvent,W,G),_||q==null||q(I.sourceEvent,G)}}const M=Tye().clickDistance(j).on("start",I=>{const{domNode:R,nodeDragThreshold:E,transform:P,snapGrid:O,snapToGrid:L}=e();d=(R==null?void 0:R.getBoundingClientRect())||null,p=!1,m=!1,x=I.sourceEvent,E===0&&k(I),s=s1(I.sourceEvent,{transform:P,snapGrid:O,snapToGrid:L,containerBounds:d}),u=rc(I.sourceEvent,d)}).on("drag",I=>{const{autoPanOnNodeDrag:R,transform:E,snapGrid:P,snapToGrid:O,nodeDragThreshold:L,nodeLookup:T}=e(),D=s1(I.sourceEvent,{transform:E,snapGrid:P,snapToGrid:O,containerBounds:d});if(x=I.sourceEvent,(I.sourceEvent.type==="touchmove"&&I.sourceEvent.touches.length>1||_&&!T.has(_))&&(p=!0),!p){if(!c&&R&&f&&(c=!0,C()),!f){const F=rc(I.sourceEvent,d),q=F.x-u.x,B=F.y-u.y;Math.sqrt(q*q+B*B)>L&&k(I)}(s.x!==D.xSnapped||s.y!==D.ySnapped)&&l&&f&&(u=rc(I.sourceEvent,d),A(D))}}).on("end",I=>{if(!(!f||p)&&(c=!1,f=!1,cancelAnimationFrame(a),l.size>0)){const{nodeLookup:R,updateNodePositions:E,onNodeDragStop:P,onSelectionDragStop:O}=e();if(m&&(E(l,!1),m=!1),i||P||!_&&O){const[L,T]=E3({nodeId:_,dragItems:l,nodeLookup:R,dragging:!1});i==null||i(I.sourceEvent,l,L,T),P==null||P(I.sourceEvent,L,T),_||O==null||O(I.sourceEvent,T)}}}).filter(I=>{const R=I.target;return!I.button&&(!w||!_Z(R,`.${w}`,N))&&(!v||_Z(R,v,N))});h.call(M)}function g(){h==null||h.on(".drag",null)}return{update:y,destroy:g}}function ORt(t,e,n){const r=[],i={x:t.x-n,y:t.y-n,width:n*2,height:n*2};for(const s of e.values())X_(i,l0(s))>0&&r.push(s);return r}const RRt=250;function IRt(t,e,n,r){var l,c;let i=[],s=1/0;const a=ORt(t,n,e+RRt);for(const u of a){const d=[...((l=u.internals.handleBounds)==null?void 0:l.source)??[],...((c=u.internals.handleBounds)==null?void 0:c.target)??[]];for(const f of d){if(r.nodeId===f.nodeId&&r.type===f.type&&r.id===f.id)continue;const{x:h,y:p}=fg(u,f,f.position,!0),m=Math.sqrt(Math.pow(h-t.x,2)+Math.pow(p-t.y,2));m>e||(m<s?(i=[{...f,x:h,y:p}],s=m):m===s&&i.push({...f,x:h,y:p}))}}if(!i.length)return null;if(i.length>1){const u=r.type==="source"?"target":"source";return i.find(d=>d.type===u)??i[0]}return i[0]}function lve(t,e,n,r,i,s=!1){var u,d,f;
4955const a=r.get(t);if(!a)return null;const l=i==="strict"?(u=a.internals.handleBounds)==null?void 0:u[e]:[...((d=a.internals.handleBounds)==null?void 0:d.source)??[],...((f=a.internals.handleBounds)==null?void 0:f.target)??[]],c=(n?l==null?void 0:l.find(h=>h.id===n):l==null?void 0:l[0])??null;return c&&s?{...c,...fg(a,c,c.position,!0)}:c}function cve(t,e){return t||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function DRt(t,e){let n=null;return e?n=!0:t&&!e&&(n=!1),n}const uve=()=>!0;function LRt(t,{connectionMode:e,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:s,isTarget:a,domNode:l,nodeLookup:c,lib:u,autoPanOnConnect:d,flowId:f,panBy:h,cancelConnection:p,onConnectStart:m,onConnect:x,onConnectEnd:y,isValidConnection:g=uve,onReconnectEnd:w,updateConnection:v,getTransform:N,getFromHandle:S,autoPanSpeed:_,dragThreshold:j=1,handleDomNode:A}){const C=Qye(t.target);let k=0,M;const{x:I,y:R}=rc(t),E=cve(s,A),P=l==null?void 0:l.getBoundingClientRect();let O=!1;if(!P||!E)return;const L=lve(i,E,r,c,e);if(!L)return;let T=rc(t,P),D=!1,F=null,q=!1,B=null;function z(){if(!d||!P)return;const[Y,$]=qye(T,P,_);h({x:Y,y:$}),k=requestAnimationFrame(z)}const H={...L,nodeId:i,type:E,position:L.position},W=c.get(i);let K={inProgress:!0,isValid:null,from:fg(W,H,_t.Left,!0),fromHandle:H,fromPosition:H.position,fromNode:W,to:T,toHandle:null,toPosition:uZ[H.position],toNode:null,pointer:T};function ee(){O=!0,v(K),m==null||m(t,{nodeId:i,handleId:r,handleType:E})}j===0&&ee();function V(Y){if(!O){const{x:de,y:Te}=rc(Y),Pe=de-I,se=Te-R;if(!(Pe*Pe+se*se>j*j))return;ee()}if(!S()||!H){J(Y);return}const $=N();T=rc(Y,P),M=IRt(xN(T,$,!1,[1,1]),n,c,H),D||(z(),D=!0);const fe=dve(Y,{handle:M,connectionMode:e,fromNodeId:i,fromHandleId:r,fromType:a?"target":"source",isValidConnection:g,doc:C,lib:u,flowId:f,nodeLookup:c});B=fe.handleDomNode,F=fe.connection,q=DRt(!!M,fe.isValid);const ce=c.get(i),ve=ce?fg(ce,H,_t.Left,!0):K.from,X={...K,from:ve,isValid:q,to:fe.toHandle&&q?tA({x:fe.toHandle.x,y:fe.toHandle.y},$):T,toHandle:fe.toHandle,toPosition:q&&fe.toHandle?fe.toHandle.position:uZ[H.position],toNode:fe.toHandle?c.get(fe.toHandle.nodeId):null,pointer:T};v(X),K=X}function J(Y){if(!("touches"in Y&&Y.touches.length>0)){if(O){(M||B)&&F&&q&&(x==null||x(F));const{inProgress:$,...fe}=K,ce={...fe,toPosition:K.toHandle?K.toPosition:null};y==null||y(Y,ce),s&&(w==null||w(Y,ce))}p(),cancelAnimationFrame(k),D=!1,q=!1,F=null,B=null,C.removeEventListener("mousemove",V),C.removeEventListener("mouseup",J),C.removeEventListener("touchmove",V),C.removeEventListener("touchend",J)}}C.addEventListener("mousemove",V),C.addEventListener("mouseup",J),C.addEventListener("touchmove",V),C.addEventListener("touchend",J)}function dve(t,{handle:e,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:s,doc:a,lib:l,flowId:c,isValidConnection:u=uve,nodeLookup:d}){const f=s==="target",h=e?a.querySelector(`.${l}-flow__handle[data-id="${c}-${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`):null,{x:p,y:m}=rc(t),x=a.elementFromPoint(p,m),y=x!=null&&x.classList.contains(`${l}-flow__handle`)?x:h,g={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){const w=cve(void 0,y),v=y.getAttribute("data-nodeid"),N=y.getAttribute("data-handleid"),S=y.classList.contains("connectable"),_=y.classList.contains("connectableend");if(!v||!w)return g;const j={source:f?v:r,sourceHandle:f?N:i,target:f?r:v,targetHandle:f?i:N};g.connection=j;const C=S&&_&&(n===a0.Strict?f&&w==="source"||!f&&w==="target":v!==r||N!==i);g.isValid=C&&u(j),g.toHandle=lve(v,w,N,d,n,!0)}return g}const NF={onPointerDown:LRt,isValid:dve};function $Rt({domNode:t,panZoom:e,getTransform:n,getViewScale:r}){const i=go(t);function s({translateExtent:l,width:c,height:u,zoomStep:d=1,pannable:f=!0,zoomable:h=!0,inversePan:p=!1}){const m=v=>{if(v.sourceEvent.type!=="wheel"||!e)return;const N=n(),S=v.sourceEvent.ctrlKey&&Q_()?10:1,_=-v.sourceEvent.deltaY*(v.sourceEvent.deltaMode===1?.05:v.sourceEvent.deltaMode?1:.002)*d,j=N[2]*Math.pow(2,_*S);e.scaleTo(j)};let x=[0,0];const y=v=>{(v.sourceEvent.type==="mousedown"||v.sourceEvent.type==="touchstart")&&(x=[v.sourceEvent.clientX??v.sourceEvent.touches[0].clientX,v.sourceEvent.clientY??v.sourceEvent.touches[0].clientY])},g=v=>{const N=n();if(v.sourceEvent.type!=="mousemove"&&v.sourceEvent.type!=="touchmove"||!e)return;const S=[v.sourceEvent.clientX??v.sourceEvent.touches[0].clientX,v.sourceEvent.clientY??v.sourceEvent.touches[0].clientY],_=[S[0]-x[0],S[1]-x[1]];x=S;const j=r()*Math.max(N[2],Math.log(N[2]))*(p?-1:1),A={x:N[0]-_[0]*j,y:N[1]-_[1]*j}
4955,C=[[0,0],[c,u]];e.setViewportConstrained({x:A.x,y:A.y,zoom:N[2]},C,l)},w=Fye().on("start",y).on("zoom",f?g:null).on("zoom.wheel",h?m:null);i.call(w,{})}function a(){i.on("zoom",null)}return{update:s,destroy:a,pointer:Hl}}const tO=t=>({x:t.x,y:t.y,zoom:t.k}),A3=({x:t,y:e,zoom:n})=>JP.translate(t,e).scale(n),hy=(t,e)=>t.target.closest(`.${e}`),fve=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),FRt=t=>((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2,T3=(t,e=0,n=FRt,r=()=>{})=>{const i=typeof e=="number"&&e>0;return i||r(),i?t.transition().duration(e).ease(n).on("end",r):t},hve=t=>{const e=t.ctrlKey&&Q_()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e};function URt({zoomPanValues:t,noWheelClassName:e,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:s,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:u}){return d=>{if(hy(d,e))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(d.ctrlKey&&a){const y=Hl(d),g=hve(d),w=f*Math.pow(2,g);r.scaleTo(n,w,y,d);return}const h=d.deltaMode===1?20:1;let p=i===km.Vertical?0:d.deltaX*h,m=i===km.Horizontal?0:d.deltaY*h;!Q_()&&d.shiftKey&&i!==km.Vertical&&(p=d.deltaY*h,m=0),r.translateBy(n,-(p/f)*s,-(m/f)*s,{internal:!0});const x=tO(n.property("__zoom"));clearTimeout(t.panScrollTimeout),t.isPanScrolling?(c==null||c(d,x),t.panScrollTimeout=setTimeout(()=>{u==null||u(d,x),t.isPanScrolling=!1},150)):(t.isPanScrolling=!0,l==null||l(d,x))}}function zRt({noWheelClassName:t,preventScrolling:e,d3ZoomHandler:n}){return function(r,i){const s=r.type==="wheel",a=!e&&s&&!r.ctrlKey,l=hy(r,t);if(r.ctrlKey&&s&&l&&r.preventDefault(),a||l)return null;r.preventDefault(),n.call(this,r,i)}}function BRt({zoomPanValues:t,onDraggingChange:e,onPanZoomStart:n}){return r=>{var s,a,l;if((s=r.sourceEvent)!=null&&s.internal)return;const i=tO(r.transform);t.mouseButton=((a=r.sourceEvent)==null?void 0:a.button)||0,t.isZoomingOrPanning=!0,t.prevViewport=i,((l=r.sourceEvent)==null?void 0:l.type)==="mousedown"&&e(!0),n&&(n==null||n(r.sourceEvent,i))}}function VRt({zoomPanValues:t,panOnDrag:e,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return s=>{var a,l;t.usedRightMouseButton=!!(n&&fve(e,t.mouseButton??0)),(a=s.sourceEvent)!=null&&a.sync||r([s.transform.x,s.transform.y,s.transform.k]),i&&!((l=s.sourceEvent)!=null&&l.internal)&&(i==null||i(s.sourceEvent,tO(s.transform)))}}function HRt({zoomPanValues:t,panOnDrag:e,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:s}){return a=>{var l;if(!((l=a.sourceEvent)!=null&&l.internal)&&(t.isZoomingOrPanning=!1,s&&fve(e,t.mouseButton??0)&&!t.usedRightMouseButton&&a.sourceEvent&&s(a.sourceEvent),t.usedRightMouseButton=!1,r(!1),i)){const c=tO(a.transform);t.prevViewport=c,clearTimeout(t.timerId),t.timerId=setTimeout(()=>{i==null||i(a.sourceEvent,c)},n?150:0)}}}function WRt({zoomActivationKeyPressed:t,zoomOnScroll:e,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:s,userSelectionActive:a,noWheelClassName:l,noPanClassName:c,lib:u,connectionInProgress:d}){return f=>{var y;const h=t||e,p=n&&f.ctrlKey,m=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(hy(f,`${u}-flow__node`)||hy(f,`${u}-flow__edge`)))return!0;if(!r&&!h&&!i&&!s&&!n||a||d&&!m||hy(f,l)&&m||hy(f,c)&&(!m||i&&m&&!t)||!n&&f.ctrlKey&&m)return!1;if(!n&&f.type==="touchstart"&&((y=f.touches)==null?void 0:y.length)>1)return f.preventDefault(),!1;if(!h&&!i&&!p&&m||!r&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(r)&&!r.includes(f.button)&&f.type==="mousedown")return!1;const x=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||m)&&x}}function GRt({domNode:t,minZoom:e,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:s,onPanZoomStart:a,onPanZoomEnd:l,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=t.getBoundingClientRect(),f=Fye().scaleExtent([e,n]).translateExtent(r),h=go(t).call(f);w({x:i.x,y:i.y,zoom:o0(i.zoom,e,n)},[[0,0],[d.width,d.height]],r);const p=h.on("wheel.zoom"),m=h.on("dblclick.zoom");f.wheelDelta(hve);function x(M,I){return h?new Promise(R=>{f==null||f.interpolate((I==null?void 0:I.interpolate)==="linear"?ud:XC).transform(T3(h,I==null?void 0:I.duration,I==null?void 0:I.ease,()=>R(!0)),M)}):Promise.resolve(!1)}function y({noWheelClassName:M,noPanClassName:I,onPaneContextMenu:R,userSelectionActive:E,panOnScroll:P,panOnDrag:O,panOnScrollMode:L,panOnScrollSpeed:T,preventScrolling:D,zoomOnPinch:F,zoomOnScroll:q,zoomOnDoubleClick:B,zoomActivationKeyPressed:z,lib:H,onTransformChange:W,connectionInProgress:G,paneClickDistance:K,selectionOnDrag:ee}){E&&!u.isZoomingOrPanning&&g();const V=P&&!z&&!E;f.clickDistance(ee?1/0:!nc(K)||K<0?0:K);const J=V?URt({zoomPanValues:u,noWheelClassName:M,d3Selection:h,d3Zoom:f,panOnScrollMode:L,panOnScrollSpeed:T,zoomOnPinch:F,onPanZoomStart:a,onPanZoom:s,onPanZoomEnd:l}):zRt({noWheelClassName:M,preventScrolling:D,d3ZoomHandler:p});if(h.on("wheel.zoom",J,{passive:!1}),!E){const $=BRt({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:a});f.on("start",$);const fe=VRt({zoomPanValues:u,panOnDrag:O,onPaneContextMenu:!!R,onPanZoom:s,onTransformChange:W});f.on("zoom",fe);const ce=HRt({zoomPanValues:u,panOnDrag:O,panOnScroll:P,onPaneContextMenu:R,onPanZoomEnd:l,onDraggingChange:c});f.on("end",ce)}const Y=WRt({zoomActivationKeyPressed:z,panOnDrag:O,zoomOnScroll:q,panOnScroll:P,zoomOnDoubleClick:B,zoomOnPinch:F,userSelectionActive:E,noPanClassName:I,noWheelClassName:M,lib:H,connectionInProgress:G});f.filter(Y),B?h.on("dblclick.zoom",m):h.on("dblclick.zoom",null)}function g(){f.on("zoom",null)}
4955async function w(M,I,R){const E=A3(M),P=f==null?void 0:f.constrain()(E,I,R);return P&&await x(P),new Promise(O=>O(P))}async function v(M,I){const R=A3(M);return await x(R,I),new Promise(E=>E(R))}function N(M){if(h){const I=A3(M),R=h.property("__zoom");(R.k!==M.zoom||R.x!==M.x||R.y!==M.y)&&(f==null||f.transform(h,I,null,{sync:!0}))}}function S(){const M=h?$ye(h.node()):{x:0,y:0,k:1};return{x:M.x,y:M.y,zoom:M.k}}function _(M,I){return h?new Promise(R=>{f==null||f.interpolate((I==null?void 0:I.interpolate)==="linear"?ud:XC).scaleTo(T3(h,I==null?void 0:I.duration,I==null?void 0:I.ease,()=>R(!0)),M)}):Promise.resolve(!1)}function j(M,I){return h?new Promise(R=>{f==null||f.interpolate((I==null?void 0:I.interpolate)==="linear"?ud:XC).scaleBy(T3(h,I==null?void 0:I.duration,I==null?void 0:I.ease,()=>R(!0)),M)}):Promise.resolve(!1)}function A(M){f==null||f.scaleExtent(M)}function C(M){f==null||f.translateExtent(M)}function k(M){const I=!nc(M)||M<0?0:M;f==null||f.clickDistance(I)}return{update:y,destroy:g,setViewport:v,setViewportConstrained:w,getViewport:S,scaleTo:_,scaleBy:j,setScaleExtent:A,setTranslateExtent:C,syncViewport:N,setClickDistance:k}}var u0;(function(t){t.Line="line",t.Handle="handle"})(u0||(u0={}));function qRt({width:t,prevWidth:e,height:n,prevHeight:r,affectsX:i,affectsY:s}){const a=t-e,l=n-r,c=[a>0?1:a<0?-1:0,l>0?1:l<0?-1:0];return a&&i&&(c[0]=c[0]*-1),l&&s&&(c[1]=c[1]*-1),c}function SZ(t){const e=t.includes("right")||t.includes("left"),n=t.includes("bottom")||t.includes("top"),r=t.includes("left"),i=t.includes("top");return{isHorizontal:e,isVertical:n,affectsX:r,affectsY:i}}function lf(t,e){return Math.max(0,e-t)}function cf(t,e){return Math.max(0,t-e)}function iC(t,e,n){return Math.max(0,e-t,t-n)}function NZ(t,e){return t?!e:e}function KRt(t,e,n,r,i,s,a,l){let{affectsX:c,affectsY:u}=e;const{isHorizontal:d,isVertical:f}=e,h=d&&f,{xSnapped:p,ySnapped:m}=n,{minWidth:x,maxWidth:y,minHeight:g,maxHeight:w}=r,{x:v,y:N,width:S,height:_,aspectRatio:j}=t;let A=Math.floor(d?p-t.pointerX:0),C=Math.floor(f?m-t.pointerY:0);const k=S+(c?-A:A),M=_+(u?-C:C),I=-s[0]*S,R=-s[1]*_;let E=iC(k,x,y),P=iC(M,g,w);if(a){let T=0,D=0;c&&A<0?T=lf(v+A+I,a[0][0]):!c&&A>0&&(T=cf(v+k+I,a[1][0])),u&&C<0?D=lf(N+C+R,a[0][1]):!u&&C>0&&(D=cf(N+M+R,a[1][1])),E=Math.max(E,T),P=Math.max(P,D)}if(l){let T=0,D=0;c&&A>0?T=cf(v+A,l[0][0]):!c&&A<0&&(T=lf(v+k,l[1][0])),u&&C>0?D=cf(N+C,l[0][1]):!u&&C<0&&(D=lf(N+M,l[1][1])),E=Math.max(E,T),P=Math.max(P,D)}if(i){if(d){const T=iC(k/j,g,w)*j;if(E=Math.max(E,T),a){let D=0;!c&&!u||c&&!u&&h?D=cf(N+R+k/j,a[1][1])*j:D=lf(N+R+(c?A:-A)/j,a[0][1])*j,E=Math.max(E,D)}if(l){let D=0;!c&&!u||c&&!u&&h?D=lf(N+k/j,l[1][1])*j:D=cf(N+(c?A:-A)/j,l[0][1])*j,E=Math.max(E,D)}}if(f){const T=iC(M*j,x,y)/j;if(P=Math.max(P,T),a){let D=0;!c&&!u||u&&!c&&h?D=cf(v+M*j+I,a[1][0])/j:D=lf(v+(u?C:-C)*j+I,a[0][0])/j,P=Math.max(P,D)}if(l){let D=0;!c&&!u||u&&!c&&h?D=lf(v+M*j,l[1][0])/j:D=cf(v+(u?C:-C)*j,l[0][0])/j,P=Math.max(P,D)}}}C=C+(C<0?P:-P),A=A+(A<0?E:-E),i&&(h?k>M*j?C=(NZ(c,u)?-A:A)/j:A=(NZ(c,u)?-C:C)*j:d?(C=A/j,u=c):(A=C*j,c=u));const O=c?v+A:v,L=u?N+C:N;return{width:S+(c?-A:A),height:_+(u?-C:C),x:s[0]*A*(c?-1:1)+O,y:s[1]*C*(u?-1:1)+L}}const pve={width:0,height:0,x:0,y:0},YRt={...pve,pointerX:0,pointerY:0,aspectRatio:1};function XRt(t){return[[0,0],[t.measured.width,t.measured.height]]}function QRt(t,e,n){const r=e.position.x+t.position.x,i=e.position.y+t.position.y,s=t.measured.width??0,a=t.measured.height??0,l=n[0]*s,c=n[1]*a;return[[r-l,i-c],[r+s-l,i+a-c]]}function JRt({domNode:t,nodeId:e,getStoreItems:n,onChange:r,onEnd:i}){const s=go(t);let a={controlDirection:SZ("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:u,boundaries:d,keepAspectRatio:f,resizeDirection:h,onResizeStart:p,onResize:m,onResizeEnd:x,shouldResize:y}){let g={...pve},w={...YRt};a={boundaries:d,resizeDirection:h,keepAspectRatio:f,controlDirection:SZ(u)};let v,N=null,S=[],_,j,A,C=!1;const k=Tye().on("start",M=>
4955{const{nodeLookup:I,transform:R,snapGrid:E,snapToGrid:P,nodeOrigin:O,paneDomNode:L}=n();if(v=I.get(e),!v)return;N=(L==null?void 0:L.getBoundingClientRect())??null;const{xSnapped:T,ySnapped:D}=s1(M.sourceEvent,{transform:R,snapGrid:E,snapToGrid:P,containerBounds:N});g={width:v.measured.width??0,height:v.measured.height??0,x:v.position.x??0,y:v.position.y??0},w={...g,pointerX:T,pointerY:D,aspectRatio:g.width/g.height},_=void 0,v.parentId&&(v.extent==="parent"||v.expandParent)&&(_=I.get(v.parentId),j=_&&v.extent==="parent"?XRt(_):void 0),S=[],A=void 0;for(const[F,q]of I)if(q.parentId===e&&(S.push({id:F,position:{...q.position},extent:q.extent}),q.extent==="parent"||q.expandParent)){const B=QRt(q,v,q.origin??O);A?A=[[Math.min(B[0][0],A[0][0]),Math.min(B[0][1],A[0][1])],[Math.max(B[1][0],A[1][0]),Math.max(B[1][1],A[1][1])]]:A=B}p==null||p(M,{...g})}).on("drag",M=>{const{transform:I,snapGrid:R,snapToGrid:E,nodeOrigin:P}=n(),O=s1(M.sourceEvent,{transform:I,snapGrid:R,snapToGrid:E,containerBounds:N}),L=[];if(!v)return;const{x:T,y:D,width:F,height:q}=g,B={},z=v.origin??P,{width:H,height:W,x:G,y:K}=KRt(w,a.controlDirection,O,a.boundaries,a.keepAspectRatio,z,j,A),ee=H!==F,V=W!==q,J=G!==T&&ee,Y=K!==D&&V;if(!J&&!Y&&!ee&&!V)return;if((J||Y||z[0]===1||z[1]===1)&&(B.x=J?G:g.x,B.y=Y?K:g.y,g.x=B.x,g.y=B.y,S.length>0)){const ve=G-T,X=K-D;for(const de of S)de.position={x:de.position.x-ve+z[0]*(H-F),y:de.position.y-X+z[1]*(W-q)},L.push(de)}if((ee||V)&&(B.width=ee&&(!a.resizeDirection||a.resizeDirection==="horizontal")?H:g.width,B.height=V&&(!a.resizeDirection||a.resizeDirection==="vertical")?W:g.height,g.width=B.width,g.height=B.height),_&&v.expandParent){const ve=z[0]*(B.width??0);B.x&&B.x<ve&&(g.x=ve,w.x=w.x-(B.x-ve));const X=z[1]*(B.height??0);B.y&&B.y<X&&(g.y=X,w.y=w.y-(B.y-X))}const $=qRt({width:g.width,prevWidth:F,height:g.height,prevHeight:q,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),fe={...g,direction:$};(y==null?void 0:y(M,fe))!==!1&&(C=!0,m==null||m(M,fe),r(B,L))}).on("end",M=>{C&&(x==null||x(M,{...g}),i==null||i({...g}),C=!1)});s.call(k)}function c(){s.on(".drag",null)}return{update:l,destroy:c}}const{useDebugValue:ZRt}=te,{useSyncExternalStoreWithSelector:eIt}=Lie,tIt=t=>t;function mve(t,e=tIt,n){const r=eIt(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return ZRt(r),r}const jZ=(t,e)=>{const n=Mie(t),r=(i,s=e)=>mve(n,i,s);return Object.assign(r,n),r},nIt=(t,e)=>t?jZ(t,e):jZ;function Qr(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[r,i]of t)if(!Object.is(i,e.get(r)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const r of t)if(!e.has(r))return!1;return!0}const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(e,r)||!Object.is(t[r],e[r]))return!1;return!0}const nO=b.createContext(null),rIt=nO.Provider,gve=fu.error001();function Dn(t,e){const n=b.useContext(nO);if(n===null)throw new Error(gve);return mve(n,t,e)}function Jr(){const t=b.useContext(nO);if(t===null)throw new Error(gve);return b.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe}),[t])}const CZ={display:"none"},iIt={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},xve="react-flow__node-desc",yve="react-flow__edge-desc",sIt="react-flow__aria-live",aIt=t=>t.ariaLiveMessage,oIt=t=>t.ariaLabelConfig;function lIt({rfId:t}){const e=Dn(aIt);return o.jsx("div",{id:`${sIt}-${t}`,"aria-live":"assertive","aria-atomic":"true",style:iIt,children:e})}function cIt({rfId:t,disableKeyboardA11y:e}){const n=Dn(oIt);return o.jsxs(o.Fragment,{children:[o.jsx("div",{id:`${xve}-${t}`,style:CZ,children:e?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),o.jsx("div",{id:`${yve}-${t}`,style:CZ,children:n["edge.a11yDescription.default"]}),!e&&o.jsx(lIt,{rfId:t})]})}const rO=b.forwardRef(({position:t="top-left",children:e,className:n,style:r,...i},s)=>{const a=`${t}`.split("-");return o.jsx("div",{className:$i(["react-flow__panel",n,...a]),style:r,ref:s,...i,children:e})});rO.displayName="Panel";function uIt({proOptions:t,position:e="bottom-right"}){return t!=null&&t.hideAttribution?null:o.jsx(rO,{position:e,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:o.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const dIt=t=>{const e=[],n=[];for(const[,r]of t.nodeLookup)r.selected&&e.push(r.internals.userNode);for(const[,r]of t.edgeLookup)r.selected&&n.push(r);return{selectedNodes:e,selectedEdges:n}},sC=t=>
4955t.id;function fIt(t,e){return Qr(t.selectedNodes.map(sC),e.selectedNodes.map(sC))&&Qr(t.selectedEdges.map(sC),e.selectedEdges.map(sC))}function hIt({onSelectionChange:t}){const e=Jr(),{selectedNodes:n,selectedEdges:r}=Dn(dIt,fIt);return b.useEffect(()=>{const i={nodes:n,edges:r};t==null||t(i),e.getState().onSelectionChangeHandlers.forEach(s=>s(i))},[n,r,t]),null}const pIt=t=>!!t.onSelectionChangeHandlers;function mIt({onSelectionChange:t}){const e=Dn(pIt);return t||e?o.jsx(hIt,{onSelectionChange:t}):null}const vve=[0,0],gIt={x:0,y:0,zoom:1},xIt=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],kZ=[...xIt,"rfId"],yIt=t=>({setNodes:t.setNodes,setEdges:t.setEdges,setMinZoom:t.setMinZoom,setMaxZoom:t.setMaxZoom,setTranslateExtent:t.setTranslateExtent,setNodeExtent:t.setNodeExtent,reset:t.reset,setDefaultNodesAndEdges:t.setDefaultNodesAndEdges}),EZ={translateExtent:K_,nodeOrigin:vve,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function vIt(t){const{setNodes:e,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:s,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:c}=Dn(yIt,Qr),u=Jr();b.useEffect(()=>(c(t.defaultNodes,t.defaultEdges),()=>{d.current=EZ,l()}),[]);const d=b.useRef(EZ);return b.useEffect(()=>{for(const f of kZ){const h=t[f],p=d.current[f];h!==p&&(typeof t[f]>"u"||(f==="nodes"?e(h):f==="edges"?n(h):f==="minZoom"?r(h):f==="maxZoom"?i(h):f==="translateExtent"?s(h):f==="nodeExtent"?a(h):f==="ariaLabelConfig"?u.setState({ariaLabelConfig:uRt(h)}):f==="fitView"?u.setState({fitViewQueued:h}):f==="fitViewOptions"?u.setState({fitViewOptions:h}):u.setState({[f]:h})))}d.current=t},kZ.map(f=>t[f])),null}function AZ(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function bIt(t){var r;const[e,n]=b.useState(t==="system"?null:t);return b.useEffect(()=>{if(t!=="system"){n(t);return}const i=AZ(),s=()=>n(i!=null&&i.matches?"dark":"light");return s(),i==null||i.addEventListener("change",s),()=>{i==null||i.removeEventListener("change",s)}},[t]),e!==null?e:(r=AZ())!=null&&r.matches?"dark":"light"}const TZ=typeof document<"u"?document:null;function J_(t=null,e={target:TZ,actInsideInputWithModifier:!0}){const[n,r]=b.useState(!1),i=b.useRef(!1),s=b.useRef(new Set([])),[a,l]=b.useMemo(()=>{if(t!==null){const u=(Array.isArray(t)?t:[t]).filter(f=>typeof f=="string").map(f=>f.replace("+",`
4956`).replace(`
4957
4958`,`
4959+`).split(`
4960`)),d=u.reduce((f,h)=>f.concat(...h),[]);return[u,d]}return[[],[]]},[t]);return b.useEffect(()=>{const c=(e==null?void 0:e.target)??TZ,u=(e==null?void 0:e.actInsideInputWithModifier)??!0;if(t!==null){const d=p=>{var y,g;if(i.current=p.ctrlKey||p.metaKey||p.shiftKey||p.altKey,(!i.current||i.current&&!u)&&Jye(p))return!1;const x=PZ(p.code,l);if(s.current.add(p[x]),MZ(a,s.current,!1)){const w=((g=(y=p.composedPath)==null?void 0:y.call(p))==null?void 0:g[0])||p.target,v=(w==null?void 0:w.nodeName)==="BUTTON"||(w==null?void 0:w.nodeName)==="A";e.preventDefault!==!1&&(i.current||!v)&&p.preventDefault(),r(!0)}},f=p=>{const m=PZ(p.code,l);MZ(a,s.current,!0)?(r(!1),s.current.clear()):s.current.delete(p[m]),p.key==="Meta"&&s.current.clear(),i.current=!1},h=()=>{s.current.clear(),r(!1)};return c==null||c.addEventListener("keydown",d),c==null||c.addEventListener("keyup",f),window.addEventListener("blur",h),window.addEventListener("contextmenu",h),()=>{c==null||c.removeEventListener("keydown",d),c==null||c.removeEventListener("keyup",f),window.removeEventListener("blur",h),window.removeEventListener("contextmenu",h)}}},[t,r]),n}function MZ(t,e,n){return t.filter(r=>n||r.length===e.size).some(r=>r.every(i=>e.has(i)))}function PZ(t,e){return e.includes(t)?"code":"key"}const wIt=()=>{const t=Jr();return b.useMemo(()=>({zoomIn:e=>
4960{const{panZoom:n}=t.getState();return n?n.scaleBy(1.2,{duration:e==null?void 0:e.duration}):Promise.resolve(!1)},zoomOut:e=>{const{panZoom:n}=t.getState();return n?n.scaleBy(1/1.2,{duration:e==null?void 0:e.duration}):Promise.resolve(!1)},zoomTo:(e,n)=>{const{panZoom:r}=t.getState();return r?r.scaleTo(e,{duration:n==null?void 0:n.duration}):Promise.resolve(!1)},getZoom:()=>t.getState().transform[2],setViewport:async(e,n)=>{const{transform:[r,i,s],panZoom:a}=t.getState();return a?(await a.setViewport({x:e.x??r,y:e.y??i,zoom:e.zoom??s},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[e,n,r]=t.getState().transform;return{x:e,y:n,zoom:r}},setCenter:async(e,n,r)=>t.getState().setCenter(e,n,r),fitBounds:async(e,n)=>{const{width:r,height:i,minZoom:s,maxZoom:a,panZoom:l}=t.getState(),c=t9(e,r,i,s,a,(n==null?void 0:n.padding)??.1);return l?(await l.setViewport(c,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(e,n={})=>
4960{const{transform:r,snapGrid:i,snapToGrid:s,domNode:a}=t.getState();if(!a)return e;const{x:l,y:c}=a.getBoundingClientRect(),u={x:e.x-l,y:e.y-c},d=n.snapGrid??i,f=n.snapToGrid??s;return xN(u,r,f,d)},flowToScreenPosition:e=>{const{transform:n,domNode:r}=t.getState();if(!r)return e;const{x:i,y:s}=r.getBoundingClientRect(),a=tA(e,n);return{x:a.x+i,y:a.y+s}}}),[])};function bve(t,e){const n=[],r=new Map,i=[];for(const s of t)if(s.type==="add"){i.push(s);continue}else if(s.type==="remove"||s.type==="replace")r.set(s.id,[s]);else{const a=r.get(s.id);a?a.push(s):r.set(s.id,[s])}for(const s of e){const a=r.get(s.id);if(!a){n.push(s);continue}if(a[0].type==="remove")continue;if(a[0].type==="replace"){n.push({...a[0].item});continue}const l={...s};for(const c of a)_It(c,l);n.push(l)}return i.length&&i.forEach(s=>{s.index!==void 0?n.splice(s.index,0,{...s.item}):n.push({...s.item})}),n}function _It(t,e){switch(t.type){case"select":{e.selected=t.selected;break}case"position":{typeof t.position<"u"&&(e.position=t.position),typeof t.dragging<"u"&&(e.dragging=t.dragging);break}case"dimensions":{typeof t.dimensions<"u"&&(e.measured={...t.dimensions},t.setAttributes&&((t.setAttributes===!0||t.setAttributes==="width")&&(e.width=t.dimensions.width),(t.setAttributes===!0||t.setAttributes==="height")&&(e.height=t.dimensions.height))),typeof t.resizing=="boolean"&&(e.resizing=t.resizing);break}}}function wve(t,e){return bve(t,e)}function _ve(t,e){return bve(t,e)}function Dp(t,e){return{id:t,type:"select",selected:e}}function py(t,e=new Set,n=!1){const r=[];for(const[i,s]of t){const a=e.has(i);!(s.selected===void 0&&!a)&&s.selected!==a&&(n&&(s.selected=a),r.push(Dp(s.id,a)))}return r}function OZ({items:t=[],lookup:e}){var i;const n=[],r=new Map(t.map(s=>[s.id,s]));for(const[s,a]of t.entries()){const l=e.get(a.id),c=((i=l==null?void 0:l.internals)==null?void 0:i.userNode)??l;c!==void 0&&c!==a&&n.push({id:a.id,item:a,type:"replace"}),c===void 0&&n.push({item:a,type:"add",index:s})}for(const[s]of e)r.get(s)===void 0&&n.push({id:s,type:"remove"});return n}function RZ(t){return{id:t.id,type:"remove"}}const IZ=t=>eRt(t),SIt=t=>Hye(t);function Sve(t){return b.forwardRef(t)}const NIt=typeof window<"u"?b.useLayoutEffect:b.useEffect;function DZ(t){const[e,n]=b.useState(BigInt(0)),[r]=b.useState(()=>jIt(()=>n(i=>i+BigInt(1))));return NIt(()=>{const i=r.get();i.length&&(t(i),r.reset())},[e]),r}function jIt(t){let e=[];return{get:()=>e,reset:()=>{e=[]},push:n=>{e.push(n),t()}}}const Nve=b.createContext(null);function CIt({children:t}){const e=Jr(),n=b.useCallback(l=>{const{nodes:c=[],setNodes:u,hasDefaultNodes:d,onNodesChange:f,nodeLookup:h,fitViewQueued:p,onNodesChangeMiddlewareMap:m}=e.getState();let x=c;for(const g of l)x=typeof g=="function"?g(x):g;let y=OZ({items:x,lookup:h});for(const g of m.values())y=g(y);d&&u(x),y.length>0?f==null||f(y):p&&window.requestAnimationFrame(()=>{const{fitViewQueued:g,nodes:w,setNodes:v}=e.getState();g&&v(w)})},[]),r=DZ(n),i=b.useCallback(l=>{const{edges:c=[],setEdges:u,hasDefaultEdges:d,onEdgesChange:f,edgeLookup:h}=e.getState();let p=c;for(const m of l)p=typeof m=="function"?m(p):m;d?u(p):f&&f(OZ({items:p,lookup:h}))},[]),s=DZ(i),a=b.useMemo(()=>({nodeQueue:r,edgeQueue:s}),[]);return o.jsx(Nve.Provider,{value:a,children:t})}function kIt(){const t=b.useContext(Nve);if(!t)throw new Error("useBatchContext must be used within a BatchProvider");return t}const EIt=t=>!!t.panZoom;function l9(){const t=wIt(),e=Jr(),n=kIt(),r=Dn(EIt),i=b.useMemo(()=>{const s=f=>e.getState().nodeLookup.get(f),a=f=>{n.nodeQueue.push(f)},l=f=>{n.edgeQueue.push(f)},c=f=>{var g,w;const{nodeLookup:h,nodeOrigin:p}=e.getState(),m=IZ(f)?f:h.get(f.id),x=m.parentId?Xye(m.position,m.measured,m.parentId,h,p):m.position,y={...m,position:x,width:((g=m.measured)==null?void 0:g.width)??m.width,height:((w=m.measured)==null?void 0:w.height)??m.height};return l0(y)},u=(f,h,p={replace:!1})=>{a(m=>m.map(x=>{if(x.id===f){const y=typeof h=="function"?h(x):h;return p.replace&&IZ(y)?y:{...x,...y}}return x}))},d=(f,h,p={replace:!1})=>{l(m=>m.map(x=>{if(x.id===f){const y=typeof h=="function"?h(x):h;return p.replace&&SIt(y)?y:{...x,...y}}return x}))};return{getNodes:()=>e.getState().nodes.map(f=>({...f})),getNode:f=>{var h;
4960return(h=s(f))==null?void 0:h.internals.userNode},getInternalNode:s,getEdges:()=>{const{edges:f=[]}=e.getState();return f.map(h=>({...h}))},getEdge:f=>e.getState().edgeLookup.get(f),setNodes:a,setEdges:l,addNodes:f=>{const h=Array.isArray(f)?f:[f];n.nodeQueue.push(p=>[...p,...h])},addEdges:f=>{const h=Array.isArray(f)?f:[f];n.edgeQueue.push(p=>[...p,...h])},toObject:()=>{const{nodes:f=[],edges:h=[],transform:p}=e.getState(),[m,x,y]=p;return{nodes:f.map(g=>({...g})),edges:h.map(g=>({...g})),viewport:{x:m,y:x,zoom:y}}},deleteElements:async({nodes:f=[],edges:h=[]})=>{const{nodes:p,edges:m,onNodesDelete:x,onEdgesDelete:y,triggerNodeChanges:g,triggerEdgeChanges:w,onDelete:v,onBeforeDelete:N}=e.getState(),{nodes:S,edges:_}=await sRt({nodesToRemove:f,edgesToRemove:h,nodes:p,edges:m,onBeforeDelete:N}),j=_.length>0,A=S.length>0;if(j){const C=_.map(RZ);y==null||y(_),w(C)}if(A){const C=S.map(RZ);x==null||x(S),g(C)}return(A||j)&&(v==null||v({nodes:S,edges:_})),{deletedNodes:S,deletedEdges:_}},getIntersectingNodes:(f,h=!0,p)=>{const m=fZ(f),x=m?f:c(f),y=p!==void 0;return x?(p||e.getState().nodes).filter(g=>{const w=e.getState().nodeLookup.get(g.id);if(w&&!m&&(g.id===f.id||!w.internals.positionAbsolute))return!1;const v=l0(y?g:w),N=X_(v,x);return h&&N>0||N>=v.width*v.height||N>=x.width*x.height}):[]},isNodeIntersecting:(f,h,p=!0)=>{const x=fZ(f)?f:c(f);if(!x)return!1;const y=X_(x,h);return p&&y>0||y>=h.width*h.height||y>=x.width*x.height},updateNode:u,updateNodeData:(f,h,p={replace:!1})=>{u(f,m=>{const x=typeof h=="function"?h(m):h;return p.replace?{...m,data:x}:{...m,data:{...m.data,...x}}},p)},updateEdge:d,updateEdgeData:(f,h,p={replace:!1})=>{d(f,m=>{const x=typeof h=="function"?h(m):h;return p.replace?{...m,data:x}:{...m,data:{...m.data,...x}}},p)},getNodesBounds:f=>{const{nodeLookup:h,nodeOrigin:p}=e.getState();return tRt(f,{nodeLookup:h,nodeOrigin:p})},getHandleConnections:({type:f,id:h,nodeId:p})=>{var m;return Array.from(((m=e.getState().connectionLookup.get(`${p}-${f}${h?`-${h}`:""}`))==null?void 0:m.values())??[])},getNodeConnections:({type:f,handleId:h,nodeId:p})=>{var m;return Array.from(((m=e.getState().connectionLookup.get(`${p}${f?h?`-${f}-${h}`:`-${f}`:""}`))==null?void 0:m.values())??[])},fitView:async f=>{const h=e.getState().fitViewResolver??cRt();return e.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:h}),n.nodeQueue.push(p=>[...p]),h.promise}}},[]);return b.useMemo(()=>({...i,...t,viewportInitialized:r}),[r])}const LZ=t=>t.selected,AIt=typeof window<"u"?window:void 0;function TIt({deleteKeyCode:t,multiSelectionKeyCode:e}){const n=Jr(),{deleteElements:r}=l9(),i=J_(t,{actInsideInputWithModifier:!1}),s=J_(e,{target:AIt});b.useEffect(()=>{if(i){const{edges:a,nodes:l}=n.getState();r({nodes:l.filter(LZ),edges:a.filter(LZ)}),n.setState({nodesSelectionActive:!1})}},[i]),b.useEffect(()=>{n.setState({multiSelectionActive:s})},[s])}function MIt(t){const e=Jr();b.useEffect(()=>{const n=()=>{var i,s,a,l;if(!t.current||!(((s=(i=t.current).checkVisibility)==null?void 0:s.call(i))??!0))return!1;const r=n9(t.current);(r.height===0||r.width===0)&&((l=(a=e.getState()).onError)==null||l.call(a,"004",fu.error004())),e.setState({width:r.width||500,height:r.height||500})};if(t.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(t.current),()=>{window.removeEventListener("resize",n),r&&t.current&&r.unobserve(t.current)}}},[])}const iO={position:"absolute",width:"100%",height:"100%",top:0,left:0},PIt=t=>({userSelectionActive:t.userSelectionActive,lib:t.lib,connectionInProgress:t.connection.inProgress});function OIt({onPaneContextMenu:t,zoomOnScroll:e=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:s=km.Free,zoomOnDoubleClick:a=!0,panOnDrag:l=!0,defaultViewport:c,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:h,preventScrolling:p=!0,children:m,noWheelClassName:x,noPanClassName:y,onViewportChange:g,isControlledViewport:w,paneClickDistance:v,selectionOnDrag:N}){const S=Jr(),_=b.useRef(null),{userSelectionActive:j,lib:A,connectionInProgress:C}=Dn(PIt,Qr),k=J_(h),M=b.useRef();MIt(_);const I=b.useCallback(R=>{g==null||g({x:R[0],y:R[1],zoom:R[2]}),w||S.setState({transform:R})},[g,w]);return b.useEffect(()=>{if(_.current){M.current=GRt({domNode:_.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:c,onDraggingChange:O=>S.setState({paneDragging:O}),onPanZoomStart:(O,L)=>{const{onViewportChangeStart:T,onMoveStart:D}=S.getState();D==null||D(O,L),T==null||T(L)},onPanZoom:(O,L)=>{const{onViewportChange:T,onMove:D}=S.getState();D==null||D(O,L),T==null||T(L)},onPanZoomEnd:(O,L)=>{const{onViewportChangeEnd:T,onMoveEnd:D}=S.getState();D==null||D(O,L),T==null||T(L)}});const{x:R,y:E,zoom:P}=M.current.getViewport();return S.setState({panZoom:M.current,transform:[R,E,P],domNode:_.current.closest(".react-flow")}),()=>{var O;(O=M.current)==null||O.destroy()}}},[]),b.useEffect(()=>{var R;(R=M.current)==null||R.update({onPaneContextMenu:t,zoomOnScroll:e,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:i,panOnScrollMode:s,zoomOnDoubleClick:a,panOnDrag:l,zoomActivationKeyPressed:k,preventScrolling:p,noPanClassName:y,userSelectionActive:j,noWheelClassName:x,lib:A,onTransformChange:I,connectionInProgress:C,selectionOnDrag:N,paneClickDistance:v})},[t,e,n,r,i,s,a,l,k,p,y,j,x,A,I,C,N,v]),o.jsx("div",{className:"react-flow__renderer",ref:_,style:iO,children:m})}const RIt=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function IIt(){const{userSelectionActive:t,userSelectionRect:e}=Dn(RIt,Qr);return t&&e?o.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:e.width,height:e.height,transform:`translate(${e.x}px, ${e.y}px)`}}):null}const M3=(t,e)=>n=>{n.target===e.current&&(t==null||t(n))},DIt=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,connectionInProgress:t.connection.inProgress,dragging:t.paneDragging});function LIt({isSelecting:t,selectionKeyPressed:e,selectionMode:n=Y_.Full,panOnDrag:r,paneClickDistance:i,selectionOnDrag:s,onSelectionStart:a,onSelectionEnd:l,onPaneClick:c,onPaneContextMenu:u,onPaneScroll:d,onPaneMouseEnter:f,onPaneMouseMove:h,onPaneMouseLeave:p,children:m}){const x=Jr(),{userSelectionActive:y,elementsSelectable:g,dragging:w,connectionInProgress:v}=Dn(DIt,Qr),N=g&&(t||y),S=b.useRef(null),_=b.useRef(),j=b.useRef(new Set),A=b.useRef(new Set),C=b.useRef(!1),k=T=>{if(C.current||v){C.current=!1;return}c==null||c(T),x.getState().resetSelectedElements(),x.setState({nodesSelectionActive:!1})},M=T=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){T.preventDefault();return}u==null||u(T)},I=d?T=>d(T):void 0,R=T=>{C.current&&(T.stopPropagation(),C.current=!1)},E=T=>{var W,G;const{domNode:D}=x.getState();if(_.current=D==null?void 0:D.getBoundingClientRect(),!_.current)return;const F=T.target===S.current;
4960if(!F&&!!T.target.closest(".nokey")||!t||!(s&&F||e)||T.button!==0||!T.isPrimary)return;(G=(W=T.target)==null?void 0:W.setPointerCapture)==null||G.call(W,T.pointerId),C.current=!1;const{x:z,y:H}=rc(T.nativeEvent,_.current);x.setState({userSelectionRect:{width:0,height:0,startX:z,startY:H,x:z,y:H}}),F||(T.stopPropagation(),T.preventDefault())},P=T=>{const{userSelectionRect:D,transform:F,nodeLookup:q,edgeLookup:B,connectionLookup:z,triggerNodeChanges:H,triggerEdgeChanges:W,defaultEdgeOptions:G,resetSelectedElements:K}=x.getState();if(!_.current||!D)return;const{x:ee,y:V}=rc(T.nativeEvent,_.current),{startX:J,startY:Y}=D;if(!C.current){const X=e?0:i;if(Math.hypot(ee-J,V-Y)<=X)return;K(),a==null||a(T)}C.current=!0;const $={startX:J,startY:Y,x:ee<J?ee:J,y:V<Y?V:Y,width:Math.abs(ee-J),height:Math.abs(V-Y)},fe=j.current,ce=A.current;j.current=new Set(e9(q,$,F,n===Y_.Partial,!0).map(X=>X.id)),A.current=new Set;const ve=(G==null?void 0:G.selectable)??!0;for(const X of j.current){const de=z.get(X);if(de)for(const{edgeId:Te}of de.values()){const Pe=B.get(Te);Pe&&(Pe.selectable??ve)&&A.current.add(Te)}}if(!hZ(fe,j.current)){const X=py(q,j.current,!0);H(X)}if(!hZ(ce,A.current)){const X=py(B,A.current);W(X)}x.setState({userSelectionRect:$,userSelectionActive:!0,nodesSelectionActive:!1})},O=T=>{var D,F;T.button===0&&((F=(D=T.target)==null?void 0:D.releasePointerCapture)==null||F.call(D,T.pointerId),!y&&T.target===S.current&&x.getState().userSelectionRect&&(k==null||k(T)),x.setState({userSelectionActive:!1,userSelectionRect:null}),C.current&&(l==null||l(T),x.setState({nodesSelectionActive:j.current.size>0})))},L=r===!0||Array.isArray(r)&&r.includes(0);return o.jsxs("div",{className:$i(["react-flow__pane",{draggable:L,dragging:w,selection:t}]),onClick:N?void 0:M3(k,S),onContextMenu:M3(M,S),onWheel:M3(I,S),onPointerEnter:N?void 0:f,onPointerMove:N?P:h,onPointerUp:N?O:void 0,onPointerDownCapture:N?E:void 0,onClickCapture:N?R:void 0,onPointerLeave:p,ref:S,style:iO,children:[m,o.jsx(IIt,{})]})}function jF({id:t,store:e,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:i,unselectNodesAndEdges:s,multiSelectionActive:a,nodeLookup:l,onError:c}=e.getState(),u=l.get(t);if(!u){c==null||c("012",fu.error012(t));return}e.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&a)&&(s({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var d;return(d=r==null?void 0:r.current)==null?void 0:d.blur()})):i([t])}function jve({nodeRef:t,disabled:e=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:s,nodeClickDistance:a}){const l=Jr(),[c,u]=b.useState(!1),d=b.useRef();return b.useEffect(()=>{d.current=PRt({getStoreItems:()=>l.getState(),onNodeMouseDown:f=>{jF({id:f,store:l,nodeRef:t})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),b.useEffect(()=>{var f,h;if(e)(f=d.current)==null||f.destroy();else if(t.current)return(h=d.current)==null||h.update({noDragClassName:n,handleSelector:r,domNode:t.current,isSelectable:s,nodeId:i,nodeClickDistance:a}),()=>{var p;(p=d.current)==null||p.destroy()}},[n,r,e,s,t,i]),c}const $It=t=>e=>e.selected&&(e.draggable||t&&typeof e.draggable>"u");function Cve(){const t=Jr();return b.useCallback(n=>{const{nodeExtent:r,snapToGrid:i,snapGrid:s,nodesDraggable:a,onError:l,updateNodePositions:c,nodeLookup:u,nodeOrigin:d}=t.getState(),f=new Map,h=$It(a),p=i?s[0]:5,m=i?s[1]:5,x=n.direction.x*p*n.factor,y=n.direction.y*m*n.factor;for(const[,g]of u){if(!h(g))continue;let w={x:g.internals.positionAbsolute.x+x,y:g.internals.positionAbsolute.y+y};i&&(w=gN(w,s));const{position:v,positionAbsolute:N}=Wye({nodeId:g.id,nextPosition:w,nodeLookup:u,nodeExtent:r,nodeOrigin:d,onError:l});g.position=v,g.internals.positionAbsolute=N,f.set(g.id,g)}c(f)},[])}const c9=b.createContext(null),FIt=c9.Provider;c9.Consumer;const kve=()=>b.useContext(c9),UIt=t=>({connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName,rfId:t.rfId}),zIt=(t,e,n)=>r=>{const{connectionClickStartHandle:i,connectionMode:s,connection:a}=r,{fromHandle:l,toHandle:c,isValid:u}=a,d=(c==null?void 0:c.nodeId)===t&&(c==null?void 0:c.id)===e&&(c==null?void 0:c.type)===n;return{connectingFrom:(l==null?void 0:l.nodeId)===t&&(l==null?void 0:l.id)===e&&(l==null?void 0:l.type)===n,connectingTo:d,clickConnecting:(i==null?void 0:i.nodeId)===t&&(i==null?void 0:i.id)===e&&(i==null?void 0:i.type)===n,isPossibleEndHandle:s===a0.Strict?(l==null?void 0:l.type)!==n:t!==(l==null?void 0:l.nodeId)||e!==(l==null?void 0:l.id),connectionInProcess:!!l,clickConnectionInProcess:!!i,valid:d&&u}};function BIt({type:t="source",position:e=_t.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:s=!0,id:a,onConnect:l,children:c,className:u,onMouseDown:d,onTouchStart:f,...h},p){var P,O;const m=a||null,x=t==="target",y=Jr(),g=kve(),{connectOnClick:w,noPanClassName:v,rfId:N}=Dn(UIt,Qr),{connectingFrom:S,connectingTo:_,clickConnecting:j,isPossibleEndHandle:A,connectionInProcess:C,clickConnectionInProcess:k,valid:M}=Dn(zIt(g,m,t),Qr);g||(O=(P=y.getState()).onError)==null||O.call(P,"010",fu.error010());const I=L=>{const{defaultEdgeOptions:T,onConnect:D,hasDefaultEdges:F}=y.getState(),q={...T,...L};if(F){const{edges:B,setEdges:z}=y.getState();z(gRt(q,B))}D==null||D(q),l==null||l(q)},R=L=>{if(!g)return;const T=Zye(L.nativeEvent);if(i&&(T&&L.button===0||!T)){const D=y.getState();
4960NF.onPointerDown(L.nativeEvent,{handleDomNode:L.currentTarget,autoPanOnConnect:D.autoPanOnConnect,connectionMode:D.connectionMode,connectionRadius:D.connectionRadius,domNode:D.domNode,nodeLookup:D.nodeLookup,lib:D.lib,isTarget:x,handleId:m,nodeId:g,flowId:D.rfId,panBy:D.panBy,cancelConnection:D.cancelConnection,onConnectStart:D.onConnectStart,onConnectEnd:D.onConnectEnd,updateConnection:D.updateConnection,onConnect:I,isValidConnection:n||D.isValidConnection,getTransform:()=>y.getState().transform,getFromHandle:()=>y.getState().connection.fromHandle,autoPanSpeed:D.autoPanSpeed,dragThreshold:D.connectionDragThreshold})}T?d==null||d(L):f==null||f(L)},E=L=>{const{onClickConnectStart:T,onClickConnectEnd:D,connectionClickStartHandle:F,connectionMode:q,isValidConnection:B,lib:z,rfId:H,nodeLookup:W,connection:G}=y.getState();if(!g||!F&&!i)return;if(!F){T==null||T(L.nativeEvent,{nodeId:g,handleId:m,handleType:t}),y.setState({connectionClickStartHandle:{nodeId:g,type:t,id:m}});return}const K=Qye(L.target),ee=n||B,{connection:V,isValid:J}=NF.isValid(L.nativeEvent,{handle:{nodeId:g,id:m,type:t},connectionMode:q,fromNodeId:F.nodeId,fromHandleId:F.id||null,fromType:F.type,isValidConnection:ee,flowId:H,doc:K,lib:z,nodeLookup:W});J&&V&&I(V);const Y=structuredClone(G);delete Y.inProgress,Y.toPosition=Y.toHandle?Y.toHandle.position:null,D==null||D(L,Y),y.setState({connectionClickStartHandle:null})};return o.jsx("div",{"data-handleid":m,"data-nodeid":g,"data-handlepos":e,"data-id":`${N}-${g}-${m}-${t}`,className:$i(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",v,u,{source:!x,target:x,connectable:r,connectablestart:i,connectableend:s,clickconnecting:j,connectingfrom:S,connectingto:_,valid:M,connectionindicator:r&&(!C||A)&&(C||k?s:i)}]),onMouseDown:R,onTouchStart:R,onClick:w?E:void 0,ref:p,...h,children:c})}const al=b.memo(Sve(BIt));function VIt({data:t,isConnectable:e,sourcePosition:n=_t.Bottom}){return o.jsxs(o.Fragment,{children:[t==null?void 0:t.label,o.jsx(al,{type:"source",position:n,isConnectable:e})]})}function HIt({data:t,isConnectable:e,targetPosition:n=_t.Top,sourcePosition:r=_t.Bottom}){return o.jsxs(o.Fragment,{children:[o.jsx(al,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label,o.jsx(al,{type:"source",position:r,isConnectable:e})]})}function WIt(){return null}function GIt({data:t,isConnectable:e,targetPosition:n=_t.Top}){return o.jsxs(o.Fragment,{children:[o.jsx(al,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label]})}const nA={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},$Z={input:VIt,default:HIt,output:GIt,group:WIt};function qIt(t){var e,n,r,i;return t.internals.handleBounds===void 0?{width:t.width??t.initialWidth??((e=t.style)==null?void 0:e.width),height:t.height??t.initialHeight??((n=t.style)==null?void 0:n.height)}:{width:t.width??((r=t.style)==null?void 0:r.width),height:t.height??((i=t.style)==null?void 0:i.height)}}const KIt=t=>{const{width:e,height:n,x:r,y:i}=mN(t.nodeLookup,{filter:s=>!!s.selected});return{width:nc(e)?e:null,height:nc(n)?n:null,userSelectionActive:t.userSelectionActive,transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]}) translate(${r}px,${i}px)`}};function YIt({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:n}){const r=Jr(),{width:i,height:s,transformString:a,userSelectionActive:l}=Dn(KIt,Qr),c=Cve(),u=b.useRef(null);if(b.useEffect(()=>{var h;n||(h=u.current)==null||h.focus({preventScroll:!0})},[n]),jve({nodeRef:u}),l||!i||!s)return null;const d=t?h=>{const p=r.getState().nodes.filter(m=>m.selected);t(h,p)}:void 0,f=h=>{Object.prototype.hasOwnProperty.call(nA,h.key)&&(h.preventDefault(),c({direction:nA[h.key],factor:h.shiftKey?4:1}))};return o.jsx("div",{className:$i(["react-flow__nodesselection","react-flow__container",e]),style:{transform:a},children:o.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:f,style:{width:i,height:s}})})}const FZ=typeof window<"u"?window:void 0,XIt=t=>({nodesSelectionActive:t.nodesSelectionActive,userSelectionActive:t.userSelectionActive});function Eve({children:t,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:s,onPaneScroll:a,paneClickDistance:l,deleteKeyCode:c,selectionKeyCode:u,selectionOnDrag:d,selectionMode:f,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:x,zoomActivationKeyCode:y,elementsSelectable:g,zoomOnScroll:w,zoomOnPinch:v,panOnScroll:N,panOnScrollSpeed:S,panOnScrollMode:_,zoomOnDoubleClick:j,panOnDrag:A,defaultViewport:C,translateExtent:k,minZoom:M,maxZoom:I,preventScrolling:R,onSelectionContextMenu:E,noWheelClassName:P,noPanClassName:O,disableKeyboardA11y:L,onViewportChange:T,isControlledViewport:D}){const{nodesSelectionActive:F,userSelectionActive:q}=Dn(XIt,Qr),B=J_(u,{target:FZ}),z=J_(x,{target:FZ}),H=z||A,W=z||N,G=d&&H!==!0,K=B||q||G;return TIt({deleteKeyCode:c,multiSelectionKeyCode:m}),o.jsx(OIt,{onPaneContextMenu:s,elementsSelectable:g,zoomOnScroll:w,zoomOnPinch:v,panOnScroll:W,panOnScrollSpeed:S,panOnScrollMode:_,zoomOnDoubleClick:j,panOnDrag:!B&&H,defaultViewport:C,translateExtent:k,minZoom:M,maxZoom:I,zoomActivationKeyCode:y,preventScrolling:R,noWheelClassName:P,noPanClassName:O,onViewportChange:T,isControlledViewport:D,paneClickDistance:l,selectionOnDrag:G,children:o.jsxs(LIt,{onSelectionStart:h,onSelectionEnd:p,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:s,onPaneScroll:a,panOnDrag:H,isSelecting:!!K,selectionMode:f,selectionKeyPressed:B,paneClickDistance:l,selectionOnDrag:G,children:[t,F&&o.jsx(YIt,{onSelectionContextMenu:E,noPanClassName:O,disableKeyboardA11y:L})]})})}Eve.displayName="FlowRenderer";const QIt=b.memo(Eve),JIt=t=>e=>t?e9(e.nodeLookup,{x:0,y:0,width:e.width,height:e.height},e.transform,!0).map(n=>n.id):Array.from(e.nodeLookup.keys());function ZIt(t){return Dn(b.useCallback(JIt(t),[t]),Qr)}const e3t=t=>t.updateNodeInternals;function t3t(){const t=Dn(e3t),[e]=b.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;
4960n.forEach(i=>{const s=i.target.getAttribute("data-id");r.set(s,{id:s,nodeElement:i.target,force:!0})}),t(r)}));return b.useEffect(()=>()=>{e==null||e.disconnect()},[e]),e}function n3t({node:t,nodeType:e,hasDimensions:n,resizeObserver:r}){const i=Jr(),s=b.useRef(null),a=b.useRef(null),l=b.useRef(t.sourcePosition),c=b.useRef(t.targetPosition),u=b.useRef(e),d=n&&!!t.internals.handleBounds;return b.useEffect(()=>{s.current&&!t.hidden&&(!d||a.current!==s.current)&&(a.current&&(r==null||r.unobserve(a.current)),r==null||r.observe(s.current),a.current=s.current)},[d,t.hidden]),b.useEffect(()=>()=>{a.current&&(r==null||r.unobserve(a.current),a.current=null)},[]),b.useEffect(()=>{if(s.current){const f=u.current!==e,h=l.current!==t.sourcePosition,p=c.current!==t.targetPosition;(f||h||p)&&(u.current=e,l.current=t.sourcePosition,c.current=t.targetPosition,i.getState().updateNodeInternals(new Map([[t.id,{id:t.id,nodeElement:s.current,force:!0}]])))}},[t.id,e,t.sourcePosition,t.targetPosition]),s}function r3t({id:t,onClick:e,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:s,onDoubleClick:a,nodesDraggable:l,elementsSelectable:c,nodesConnectable:u,nodesFocusable:d,resizeObserver:f,noDragClassName:h,noPanClassName:p,disableKeyboardA11y:m,rfId:x,nodeTypes:y,nodeClickDistance:g,onError:w}){const{node:v,internals:N,isParent:S}=Dn(ee=>{const V=ee.nodeLookup.get(t),J=ee.parentLookup.has(t);return{node:V,internals:V.internals,isParent:J}},Qr);let _=v.type||"default",j=(y==null?void 0:y[_])||$Z[_];j===void 0&&(w==null||w("003",fu.error003(_)),_="default",j=(y==null?void 0:y.default)||$Z.default);const A=!!(v.draggable||l&&typeof v.draggable>"u"),C=!!(v.selectable||c&&typeof v.selectable>"u"),k=!!(v.connectable||u&&typeof v.connectable>"u"),M=!!(v.focusable||d&&typeof v.focusable>"u"),I=Jr(),R=Yye(v),E=n3t({node:v,nodeType:_,hasDimensions:R,resizeObserver:f}),P=jve({nodeRef:E,disabled:v.hidden||!A,noDragClassName:h,handleSelector:v.dragHandle,nodeId:t,isSelectable:C,nodeClickDistance:g}),O=Cve();if(v.hidden)return null;const L=Gd(v),T=qIt(v),D=C||A||e||n||r||i,F=n?ee=>n(ee,{...N.userNode}):void 0,q=r?ee=>r(ee,{...N.userNode}):void 0,B=i?ee=>i(ee,{...N.userNode}):void 0,z=s?ee=>s(ee,{...N.userNode}):void 0,H=a?ee=>a(ee,{...N.userNode}):void 0,W=ee=>{const{selectNodesOnDrag:V,nodeDragThreshold:J}=I.getState();C&&(!V||!A||J>0)&&jF({id:t,store:I,nodeRef:E}),e&&e(ee,{...N.userNode})},G=ee=>{if(!(Jye(ee.nativeEvent)||m)){if(Uye.includes(ee.key)&&C){const V=ee.key==="Escape";jF({id:t,store:I,unselect:V,nodeRef:E})}else if(A&&v.selected&&Object.prototype.hasOwnProperty.call(nA,ee.key)){ee.preventDefault();const{ariaLabelConfig:V}=I.getState();I.setState({ariaLiveMessage:V["node.a11yDescription.ariaLiveMessage"]({direction:ee.key.replace("Arrow","").toLowerCase(),x:~~N.positionAbsolute.x,y:~~N.positionAbsolute.y})}),O({direction:nA[ee.key],factor:ee.shiftKey?4:1})}}},K=()=>{var ce;if(m||!((ce=E.current)!=null&&ce.matches(":focus-visible")))return;const{transform:ee,width:V,height:J,autoPanOnNodeFocus:Y,setCenter:$}=I.getState();if(!Y)return;e9(new Map([[t,v]]),{x:0,y:0,width:V,height:J},ee,!0).length>0||$(v.position.x+L.width/2,v.position.y+L.height/2,{zoom:ee[2]})};return o.jsx("div",{className:$i(["react-flow__node",`react-flow__node-${_}`,{[p]:A},v.className,{selected:v.selected,selectable:C,parent:S,draggable:A,dragging:P}]),ref:E,style:{zIndex:N.z,transform:`translate(${N.positionAbsolute.x}px,${N.positionAbsolute.y}px)`,pointerEvents:D?"all":"none",visibility:R?"visible":"hidden",...v.style,...T},"data-id":t,"data-testid":`rf__node-${t}`,onMouseEnter:F,onMouseMove:q,onMouseLeave:B,onContextMenu:z,onClick:W,onDoubleClick:H,onKeyDown:M?G:void 0,tabIndex:M?0:void 0,onFocus:M?K:void 0,role:v.ariaRole??(M?"group":void 0),"aria-roledescription":"node","aria-describedby":m?void 0:`${xve}-${x}`,"aria-label":v.ariaLabel,...v.domAttributes,children:o.jsx(FIt,{value:t,children:o.jsx(j,{id:t,data:v.data,type:_,positionAbsoluteX:N.positionAbsolute.x,positionAbsoluteY:N.positionAbsolute.y,selected:v.selected??!1,selectable:C,draggable:A,deletable:v.deletable??!0,isConnectable:k,sourcePosition:v.sourcePosition,targetPosition:v.targetPosition,dragging:P,dragHandle:v.dragHandle,zIndex:N.z,parentId:v.parentId,...L})})})}var i3t=b.memo(r3t);const s3t=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,no
4960desFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,onError:t.onError});function Ave(t){const{nodesDraggable:e,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,onError:s}=Dn(s3t,Qr),a=ZIt(t.onlyRenderVisibleElements),l=t3t();return o.jsx("div",{className:"react-flow__nodes",style:iO,children:a.map(c=>o.jsx(i3t,{id:c,nodeTypes:t.nodeTypes,nodeExtent:t.nodeExtent,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,resizeObserver:l,nodesDraggable:e,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,nodeClickDistance:t.nodeClickDistance,onError:s},c))})}Ave.displayName="NodeRenderer";const a3t=b.memo(Ave);function o3t(t){return Dn(b.useCallback(n=>{if(!t)return n.edges.map(i=>i.id);const r=[];if(n.width&&n.height)for(const i of n.edges){const s=n.nodeLookup.get(i.source),a=n.nodeLookup.get(i.target);s&&a&&hRt({sourceNode:s,targetNode:a,width:n.width,height:n.height,transform:n.transform})&&r.push(i.id)}return r},[t]),Qr)}const l3t=({color:t="none",strokeWidth:e=1})=>{const n={strokeWidth:e,...t&&{stroke:t}};return o.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},c3t=({color:t="none",strokeWidth:e=1})=>{const n={strokeWidth:e,...t&&{stroke:t,fill:t}};return o.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},UZ={[ZE.Arrow]:l3t,[ZE.ArrowClosed]:c3t};function u3t(t){const e=Jr();return b.useMemo(()=>{var i,s;return Object.prototype.hasOwnProperty.call(UZ,t)?UZ[t]:((s=(i=e.getState()).onError)==null||s.call(i,"009",fu.error009(t)),null)},[t])}const d3t=({id:t,type:e,color:n,width:r=12.5,height:i=12.5,markerUnits:s="strokeWidth",strokeWidth:a,orient:l="auto-start-reverse"})=>{const c=u3t(e);return c?o.jsx("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:l,refX:"0",refY:"0",children:o.jsx(c,{color:n,strokeWidth:a})}):null},Tve=({defaultColor:t,rfId:e})=>{const n=Dn(s=>s.edges),r=Dn(s=>s.defaultEdgeOptions),i=b.useMemo(()=>wRt(n,{id:e,defaultColor:t,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,e,t]);return i.length?o.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:o.jsx("defs",{children:i.map(s=>o.jsx(d3t,{id:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,strokeWidth:s.strokeWidth,orient:s.orient},s.id))})}):null};Tve.displayName="MarkerDefinitions";var f3t=b.memo(Tve);function Mve({x:t,y:e,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:s,labelBgPadding:a=[2,4],labelBgBorderRadius:l=2,children:c,className:u,...d}){const[f,h]=b.useState({x:1,y:0,width:0,height:0}),p=$i(["react-flow__edge-textwrapper",u]),m=b.useRef(null);return b.useEffect(()=>{if(m.current){const x=m.current.getBBox();h({x:x.x,y:x.y,width:x.width,height:x.height})}},[n]),n?o.jsxs("g",{transform:`translate(${t-f.width/2} ${e-f.height/2})`,className:p,visibility:f.width?"visible":"hidden",...d,children:[i&&o.jsx("rect",{width:f.width+2*a[0],x:-a[0],y:-a[1],height:f.height+2*a[1],className:"react-flow__edge-textbg",style:s,rx:l,ry:l}),o.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:m,style:r,children:n}),c]}):null}Mve.displayName="EdgeText";const h3t=b.memo(Mve);function sO({path:t,labelX:e,labelY:n,label:r,labelStyle:i,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,interactionWidth:u=20,...d}){return o.jsxs(o.Fragment,{children:[o.jsx("path",{...d,d:t,fill:"none",className:$i(["react-flow__edge-path",d.className])}),u?o.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,r&&nc(e)&&nc(n)?o.jsx(h3t,{x:e,y:n,label:r,labelStyle:i,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c}):null]})}function zZ({pos:t,x1:e,y1:n,x2:r,y2:i}){return t===_t.Left||t===_t.Right?[.5*(e+r),n]:[e,.5*(n+i)]}function Pve({sourceX:t,sourceY:e,sourcePosition:n=_t.Bottom,targetX:r,targetY:i,targetPosition:s=_t.Top}){const[a,l]=zZ({pos:n,x1:t,y1:e,x2:r,y2:i}),[c,u]=zZ({pos:s,x1:r,y1:i,x2:t,y2:e}),[d,f,h,p]=eve({sourceX:t,sourceY:e,targetX:r,targetY:i,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${t},${e} C${a},${l} ${c},${u} ${r},${i}`,d,f,h,p]}function Ove(t){return b.memo(({id:e,sourceX:n,sourceY:r,targetX:i,targetY:s,sourcePosition:a,targetPosition:l,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:x,markerStart:y,interactionWidth:g})=>{const[w,v,N]=Pve({sourceX:n,sourceY:r,sourcePosition:a,targetX:i,targetY:s,targetPosition:l}),S=t.isInternal?void 0:e;return o.jsx(sO,{id:S,path:w,labelX:v,labelY:N,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:x,markerStart:y,interactionWidth:g})})}const p3t=Ove({isInternal:!1}),Rve=Ove({isInternal:!0});p3t.displayName="SimpleBezierEdge";Rve.displayName="SimpleBezierEdgeInternal";function Ive(t){return b.memo(({id:e,sourceX:n,sourceY:r,targetX:i,targetY:s,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,sourcePosition:p=_t.Bottom,targetPosition:m=_t.Top,markerEnd:x,markerStart:y,pathOptions:g,interactionWidth:w})=>{const[v,N,S]=wF({sourceX:n,sourceY:r,sourcePosition:p,targetX:i,targetY:s,targetPosition:m,borderRadius:g==null?void 0:g.borderRadius,offset:g==null?void 0:g.offset,stepPosition:g==null?void 0:g.stepPosition}),_=t.isInternal?void 0:e;return o.jsx(sO,{id:_,path:v,labelX:N,labelY:S,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:x,markerStart:y,interactionWidth:w})})}const Dve=Ive({isInternal:!1}),Lve=Ive({isInternal:!0});Dve.displayName="SmoothStepEdge";Lve.displayName="SmoothStepEdgeInternal";function $ve(t){return b.memo(({id:e,...n})=>{var i;const r=t.isInternal?void 0:e;return o.jsx(Dve,{...n,id:r,pathOptions:b.useMemo(()=>{var s;return{borderRadius:0,offset:(s=n.pathOptions)==null?void 0:s.offset}},[(i=n.pathOptions)==null?void 0:i.offset])})})}const m3t=$ve({isInternal:!1}),Fve=$ve({isInternal:!0});
4960m3t.displayName="StepEdge";Fve.displayName="StepEdgeInternal";function Uve(t){return b.memo(({id:e,sourceX:n,sourceY:r,targetX:i,targetY:s,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:m,interactionWidth:x})=>{const[y,g,w]=rve({sourceX:n,sourceY:r,targetX:i,targetY:s}),v=t.isInternal?void 0:e;return o.jsx(sO,{id:v,path:y,labelX:g,labelY:w,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:m,interactionWidth:x})})}const g3t=Uve({isInternal:!1}),zve=Uve({isInternal:!0});g3t.displayName="StraightEdge";zve.displayName="StraightEdgeInternal";function Bve(t){return b.memo(({id:e,sourceX:n,sourceY:r,targetX:i,targetY:s,sourcePosition:a=_t.Bottom,targetPosition:l=_t.Top,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:x,markerStart:y,pathOptions:g,interactionWidth:w})=>{const[v,N,S]=tve({sourceX:n,sourceY:r,sourcePosition:a,targetX:i,targetY:s,targetPosition:l,curvature:g==null?void 0:g.curvature}),_=t.isInternal?void 0:e;return o.jsx(sO,{id:_,path:v,labelX:N,labelY:S,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:x,markerStart:y,interactionWidth:w})})}const x3t=Bve({isInternal:!1}),Vve=Bve({isInternal:!0});x3t.displayName="BezierEdge";Vve.displayName="BezierEdgeInternal";const BZ={default:Vve,straight:zve,step:Fve,smoothstep:Lve,simplebezier:Rve},VZ={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},y3t=(t,e,n)=>n===_t.Left?t-e:n===_t.Right?t+e:t,v3t=(t,e,n)=>n===_t.Top?t-e:n===_t.Bottom?t+e:t,HZ="react-flow__edgeupdater";function WZ({position:t,centerX:e,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:s,onMouseOut:a,type:l}){return o.jsx("circle",{onMouseDown:i,onMouseEnter:s,onMouseOut:a,className:$i([HZ,`${HZ}-${l}`]),cx:y3t(e,r,t),cy:v3t(n,r,t),r,stroke:"transparent",fill:"transparent"})}function b3t({isReconnectable:t,reconnectRadius:e,edge:n,sourceX:r,sourceY:i,targetX:s,targetY:a,sourcePosition:l,targetPosition:c,onReconnect:u,onReconnectStart:d,onReconnectEnd:f,setReconnecting:h,setUpdateHover:p}){const m=Jr(),x=(N,S)=>{if(N.button!==0)return;const{autoPanOnConnect:_,domNode:j,isValidConnection:A,connectionMode:C,connectionRadius:k,lib:M,onConnectStart:I,onConnectEnd:R,cancelConnection:E,nodeLookup:P,rfId:O,panBy:L,updateConnection:T}=m.getState(),D=S.type==="target",F=(z,H)=>{h(!1),f==null||f(z,n,S.type,H)},q=z=>u==null?void 0:u(n,z),B=(z,H)=>{h(!0),d==null||d(N,n,S.type),I==null||I(z,H)};NF.onPointerDown(N.nativeEvent,{autoPanOnConnect:_,connectionMode:C,connectionRadius:k,domNode:j,handleId:S.id,nodeId:S.nodeId,nodeLookup:P,isTarget:D,edgeUpdaterType:S.type,lib:M,flowId:O,cancelConnection:E,panBy:L,isValidConnection:A,onConnect:q,onConnectStart:B,onConnectEnd:R,onReconnectEnd:F,updateConnection:T,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:N.currentTarget})},y=N=>x(N,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),g=N=>x(N,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),w=()=>p(!0),v=()=>p(!1);return o.jsxs(o.Fragment,{children:[(t===!0||t==="source")&&o.jsx(WZ,{position:l,centerX:r,centerY:i,radius:e,onMouseDown:y,onMouseEnter:w,onMouseOut:v,type:"source"}),(t===!0||t==="target")&&o.jsx(WZ,{position:c,centerX:s,centerY:a,radius:e,onMouseDown:g,onMouseEnter:w,onMouseOut:v,type:"target"})]})}function w3t({id:t,edgesFocusable:e,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:s,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,rfId:m,edgeTypes:x,noPanClassName:y,onError:g,disableKeyboardA11y:w}){let v=Dn($=>$.edgeLookup.get(t));const N=Dn($=>$.defaultEdgeOptions);v=N?{...N,...v}:v;let S=v.type||"default",_=(x==null?void 0:x[S])||BZ[S];_===void 0&&(g==null||g("011",fu.error011(S)),S="default",_=(x==null?void 0:x.default)||BZ.default);const j=!!(v.focusable||e&&typeof v.focusable>"u"),A=typeof f<"u"&&(v.reconnectable||n&&typeof v.reconnectable>"u"),C=!!(v.selectable||r&&typeof v.selectable>"u"),k=b.useRef(null),[M,I]=b.useState(!1),[R,E]=b.useState(!1),P=Jr(),{zIndex:O,sourceX:L,sourceY:T,targetX:D,targetY:F,sourcePosition:q,targetPosition:B}=Dn(b.useCallback($=>{const fe=$.nodeLookup.get(v.source),ce=$.nodeLookup.get(v.target);if(!fe||!ce)return{zIndex:v.zIndex,...VZ};const ve=bRt({id:t,sourceNode:fe,targetNode:ce,sourceHandle:v.sourceHandle||null,targetHandle:v.targetHandle||null,connectionMode:$.connectionMode,onError:g});return{zIndex:fRt({selected:v.selected,zIndex:v.zIndex,sourceNode:fe,targetNode:ce,elevateOnSelect:$.elevateEdgesOnSelect,zIndexMode:$.zIndexMode}),...ve||VZ}},[v.source,v.target,v.sourceHandle,v.targetHandle,v.selected,v.zIndex]),Qr),z=b.useMemo(()=>v.markerStart?`url('#${_F(v.markerStart,m)}')`:void 0,[v.markerStart,m]),H=b.useMemo(()=>v.markerEnd?`url('#${_F(v.markerEnd,m)}')`:void 0,[v.markerEnd,m]);if(v.hidden||L===null||T===null||D===null||F===null)return null;const W=$=>{var X;const{addSelectedEdges:fe,unselectNodesAndEdges:ce,multiSelectionActive:ve}=P.getState();C&&(P.setState({nodesSelectionActive:!1}),v.selected&&ve?(ce({nodes:[],edges:[v]}),(X=k.current)==null||X.blur()):fe([t])),i&&i($,v)},G=s?$=>{s($,{...v})}:void 0,K=a?$=>{a($,{...v})}:void 0,ee=l?$=>{l($,{...v})}:void 0,V=c?$=>{c($,{...v})}:void 0,J=u?$=>{u($,{...v})}:void 0,Y=$=>{var fe;if(!w&&Uye.includes($.key)&&C){const{unselectNodesAndEdges:ce,addSelectedEdges:ve}=P.getState();$.key==="Escape"?((fe=k.current)==null||fe.blur(),ce({edges:[v]})):ve([t])}};return o.jsx("svg",{style:{zIndex:O},children:o.jsxs("g",{className:$i(["react-flow__edge",`react-flow__edge-${S}`,v.className,y,{selected:v.selected,animated:v.animated,inactive:!C&&!i,updating:M,selectable:C}]),onClick:W,onDoubleClick:G,onContextMenu:K,onMouseEnter:ee,onMouseMove:V,onMouseLeave:J,onKeyDown:j?Y:void 0,tabIndex:j?0:void 0,role:v.ariaRole??(j?"group":"img"),"aria-roledescription":"edge","data-id":t,"data-testid":`rf__edge-${t}`,"aria-label":v.ariaLabel===null?void 0:v.ariaLabel||`Edge from ${v.source} to ${v.target}`,"aria-describedby":j?`${yve}-${m}`:void 0,ref:k,...v.domAttributes,children:[!R&&o.jsx(_,{id:t,source:v.source,target:v.target,type:v.type,selected:v.selected,animated:v.animated,selectable:C,deletable:v.deletable??!0,label:v.label,labelStyle:v.labelStyle,labelShowBg:v.labelShowBg,labelBgStyle:v.labelBgStyle,labelBgPadding:v.labelBgPadding,labelBgBorderRadius:v.labelBgBorderRadius,sourceX:L,sourceY:T,targetX:D,targetY:F,sourcePosition:q,targetPosition:B,data:v.data,style:v.style,sourceHandleId:v.sourceHandle,targetHandleId:v.targetHandle,markerStart:z,markerEnd:H,pathOptions:"pathOptions"in v?v.pathOptions:void 0,interactionWidth:v.interactionWidth}),A&&o.jsx(b3t,{edge:v,isReconnectable:A,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,sourceX:L,sourceY:T,targetX:D,targetY:F,sourcePosition:q,targetPosition:B,setUpdateHover:I,setReconnecting:E})]})})}var _3t=b.memo(w3t);const S3t=t=>({edgesFocusable:t.edgesFocusable,edgesReconnectable:t.edgesReconnectable,elementsSelectable:t.elementsSelectable,connectionMode:t.connectionMode,onError:t.onError});function Hve({defaultMarkerColor:t,onlyRenderVisibleElements:e,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:s,onEdgeContextMenu:a,onEdgeMouseEnter:l,onEdgeMouseMove:c,onEdgeMouseLeave:u,onEdgeClick:d,reconnectRadius:f,onEdgeDoubleClick:h,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:x}){const{edgesFocusable:y,edgesReconnectable:g,elementsSelectable:w,onError:v}=Dn(S3t,Qr),N=o3t(e);return o.jsxs("div",{className:"react-flow__edges",children:[o.jsx(f3t,{defaultColor:t,rfId:n}),N.map(S=>o.jsx(_3t,{id:S,edgesFocusable:y,edgesReconnectable:g,elementsSelectable:w,noPanClassName:i,onReconnect:s,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,onClick:d,reconnectRadius:f,onDoubleClick:h,onReconnectStart:p,onReconnectEnd:m,rfId:n,onError:v,edgeTypes:r,disableKeyboardA11y:x},S))]})}Hve.displayName="EdgeRenderer";const N3t=b.memo(Hve),j3t=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function C3t({children:t}){const e=Dn(j3t);return o.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:e},children:t})}function k3t(t){const e=l9(),n=b.useRef(!1);b.useEffect(()=>{!n.current&&e.viewportInitialized&&t&&(setTimeout(()=>t(e),1),n.current=!0)}
4960,[t,e.viewportInitialized])}const E3t=t=>{var e;return(e=t.panZoom)==null?void 0:e.syncViewport};function A3t(t){const e=Dn(E3t),n=Jr();return b.useEffect(()=>{t&&(e==null||e(t),n.setState({transform:[t.x,t.y,t.zoom]}))},[t,e]),null}function T3t(t){return t.connection.inProgress?{...t.connection,to:xN(t.connection.to,t.transform)}:{...t.connection}}function M3t(t){return T3t}function P3t(t){const e=M3t();return Dn(e,Qr)}const O3t=t=>({nodesConnectable:t.nodesConnectable,isValid:t.connection.isValid,inProgress:t.connection.inProgress,width:t.width,height:t.height});function R3t({containerStyle:t,style:e,type:n,component:r}){const{nodesConnectable:i,width:s,height:a,isValid:l,inProgress:c}=Dn(O3t,Qr);return!(s&&i&&c)?null:o.jsx("svg",{style:t,width:s,height:a,className:"react-flow__connectionline react-flow__container",children:o.jsx("g",{className:$i(["react-flow__connection",Vye(l)]),children:o.jsx(Wve,{style:e,type:n,CustomComponent:r,isValid:l})})})}const Wve=({style:t,type:e=Mf.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:i,from:s,fromNode:a,fromHandle:l,fromPosition:c,to:u,toNode:d,toHandle:f,toPosition:h,pointer:p}=P3t();if(!i)return;if(n)return o.jsx(n,{connectionLineType:e,connectionLineStyle:t,fromNode:a,fromHandle:l,fromX:s.x,fromY:s.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:h,connectionStatus:Vye(r),toNode:d,toHandle:f,pointer:p});let m="";const x={sourceX:s.x,sourceY:s.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:h};switch(e){case Mf.Bezier:[m]=tve(x);break;case Mf.SimpleBezier:[m]=Pve(x);break;case Mf.Step:[m]=wF({...x,borderRadius:0});break;case Mf.SmoothStep:[m]=wF(x);break;default:[m]=rve(x)}return o.jsx("path",{d:m,fill:"none",className:"react-flow__connection-path",style:t})};Wve.displayName="ConnectionLine";const I3t={};function GZ(t=I3t){b.useRef(t),Jr(),b.useEffect(()=>{},[t])}function D3t(){Jr(),b.useRef(!1),b.useEffect(()=>{},[])}function Gve({nodeTypes:t,edgeTypes:e,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:s,onEdgeDoubleClick:a,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,onSelectionContextMenu:f,onSelectionStart:h,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:x,connectionLineComponent:y,connectionLineContainerStyle:g,selectionKeyCode:w,selectionOnDrag:v,selectionMode:N,multiSelectionKeyCode:S,panActivationKeyCode:_,zoomActivationKeyCode:j,deleteKeyCode:A,onlyRenderVisibleElements:C,elementsSelectable:k,defaultViewport:M,translateExtent:I,minZoom:R,maxZoom:E,preventScrolling:P,defaultMarkerColor:O,zoomOnScroll:L,zoomOnPinch:T,panOnScroll:D,panOnScrollSpeed:F,panOnScrollMode:q,zoomOnDoubleClick:B,panOnDrag:z,onPaneClick:H,onPaneMouseEnter:W,onPaneMouseMove:G,onPaneMouseLeave:K,onPaneScroll:ee,onPaneContextMenu:V,paneClickDistance:J,nodeClickDistance:Y,onEdgeContextMenu:$,onEdgeMouseEnter:fe,onEdgeMouseMove:ce,onEdgeMouseLeave:ve,reconnectRadius:X,onReconnect:de,onReconnectStart:Te,onReconnectEnd:Pe,noDragClassName:se,noWheelClassName:U,noPanClassName:Q,disableKeyboardA11y:oe,nodeExtent:_e,rfId:ye,viewport:re,onViewportChange:he}){return GZ(t),GZ(e),D3t(),k3t(n),A3t(re),o.jsx(QIt,{onPaneClick:H,onPaneMouseEnter:W,onPaneMouseMove:G,onPaneMouseLeave:K,onPaneContextMenu:V,onPaneScroll:ee,paneClickDistance:J,deleteKeyCode:A,selectionKeyCode:w,selectionOnDrag:v,selectionMode:N,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:S,panActivationKeyCode:_,zoomActivationKeyCode:j,elementsSelectable:k,zoomOnScroll:L,zoomOnPinch:T,zoomOnDoubleClick:B,panOnScroll:D,panOnScrollSpeed:F,panOnScrollMode:q,panOnDrag:z,defaultViewport:M,translateExtent:I,minZoom:R,maxZoom:E,onSelectionContextMenu:f,preventScrolling:P,noDragClassName:se,noWheelClassName:U,noPanClassName:Q,disableKeyboardA11y:oe,onViewportChange:he,isControlledViewport:!!re,children:o.jsxs(C3t,{children:[o.jsx(N3t,{edgeTypes:e,onEdgeClick:i,onEdgeDoubleClick:a,onReconnect:de,onReconnectStart:Te,onReconnectEnd:Pe,onlyRenderVisibleElements:C,onEdgeContextMenu:$,onEdgeMouseEnter:fe,onEdgeMouseMove:ce,onEdgeMouseLeave:ve,reconnectRadius:X,defaultMarkerColor:O,noPanClassName:Q,disableKeyboardA11y:oe,rfId:ye}),o.jsx(R3t,{style:x,type:m,component:y,containerStyle:g}),o.jsx("div",{className:"react-flow__edgelabel-renderer"}),o.jsx(a3t,{nodeTypes:t,onNodeClick:r,onNodeDoubleClick:s,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,nodeClickDistance:Y,onlyRenderVisibleElements:C,noPanClassName:Q,noDragClassName:se,disableKeyboardA11y:oe,nodeExtent:_e,rfId:ye}),o.jsx("div",{className:"react-flow__viewport-portal"})]})})}Gve.displayName="GraphView";const L3t=b.memo(Gve),qZ=({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,width:i,height:s,fitView:a,fitViewOptions:l,minZoom:c=.5,maxZoom:u=2,nodeOrigin:d,nodeExtent:f,zIndexMode:h="basic"}={})=>{const p=new Map,m=new Map,x=new Map,y=new Map,g=r??e??[],w=n??t??[],v=d??[0,0],N=f??K_;ave(x,y,g);const S=SF(w,p,m,{nodeOrigin:v,nodeExtent:N,zIndexMode:h});let _=[0,0,1];if(a&&i&&s){const j=mN(p,{filter:M=>!!((M.width||M.initialWidth)&&(M.height||M.initialHeight))}),{x:A,y:C,zoom:k}=t9(j,i,s,c,u,(l==null?void 0:l.padding)??.1);_=[A,C,k]}return{rfId:"1",width:i??0,height:s??0,transform:_,nodes:w,nodesInitialized:S,nodeLookup:p,parentLookup:m,edges:g,edgeLookup:y,connectionLookup:x,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:u,translateExtent:K_,nodeExtent:N,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:a0.Str
4960ict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:v,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:a??!1,fitViewOptions:l,fitViewResolver:null,connection:{...Bye},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:aRt,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:zye,zIndexMode:h,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},$3t=({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,width:i,height:s,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h})=>nIt((p,m)=>{async function x(){const{nodeLookup:y,panZoom:g,fitViewOptions:w,fitViewResolver:v,width:N,height:S,minZoom:_,maxZoom:j}=m();g&&(await iRt({nodes:y,width:N,height:S,panZoom:g,minZoom:_,maxZoom:j},w),v==null||v.resolve(!0),p({fitViewResolver:null}))}return{...qZ({nodes:t,edges:e,width:i,height:s,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,defaultNodes:n,defaultEdges:r,zIndexMode:h}),setNodes:y=>{const{nodeLookup:g,parentLookup:w,nodeOrigin:v,elevateNodesOnSelect:N,fitViewQueued:S,zIndexMode:_}=m(),j=SF(y,g,w,{nodeOrigin:v,nodeExtent:f,elevateNodesOnSelect:N,checkEquality:!0,zIndexMode:_});S&&j?(x(),p({nodes:y,nodesInitialized:j,fitViewQueued:!1,fitViewOptions:void 0})):p({nodes:y,nodesInitialized:j})},setEdges:y=>{const{connectionLookup:g,edgeLookup:w}=m();ave(g,w,y),p({edges:y})},setDefaultNodesAndEdges:(y,g)=>{if(y){const{setNodes:w}=m();w(y),p({hasDefaultNodes:!0})}if(g){const{setEdges:w}=m();w(g),p({hasDefaultEdges:!0})}},updateNodeInternals:y=>{const{triggerNodeChanges:g,nodeLookup:w,parentLookup:v,domNode:N,nodeOrigin:S,nodeExtent:_,debug:j,fitViewQueued:A,zIndexMode:C}=m(),{changes:k,updatedInternals:M}=ERt(y,w,v,N,S,_,C);M&&(NRt(w,v,{nodeOrigin:S,nodeExtent:_,zIndexMode:C}),A?(x(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),(k==null?void 0:k.length)>0&&(j&&console.log("React Flow: trigger node changes",k),g==null||g(k)))},updateNodePositions:(y,g=!1)=>{const w=[];let v=[];const{nodeLookup:N,triggerNodeChanges:S,connection:_,updateConnection:j,onNodesChangeMiddlewareMap:A}=m();for(const[C,k]of y){const M=N.get(C),I=!!(M!=null&&M.expandParent&&(M!=null&&M.parentId)&&(k!=null&&k.position)),R={id:C,type:"position",position:I?{x:Math.max(0,k.position.x),y:Math.max(0,k.position.y)}:k.position,dragging:g};if(M&&_.inProgress&&_.fromNode.id===M.id){const E=fg(M,_.fromHandle,_t.Left,!0);j({..._,from:E})}I&&M.parentId&&w.push({id:C,parentId:M.parentId,rect:{...k.internals.positionAbsolute,width:k.measured.width??0,height:k.measured.height??0}}),v.push(R)}if(w.length>0){const{parentLookup:C,nodeOrigin:k}=m(),M=o9(w,N,C,k);v.push(...M)}for(const C of A.values())v=C(v);S(v)},triggerNodeChanges:y=>{const{onNodesChange:g,setNodes:w,nodes:v,hasDefaultNodes:N,debug:S}=m();if(y!=null&&y.length){if(N){const _=wve(y,v);w(_)}S&&console.log("React Flow: trigger node changes",y),g==null||g(y)}},triggerEdgeChanges:y=>{const{onEdgesChange:g,setEdges:w,edges:v,hasDefaultEdges:N,debug:S}=m();if(y!=null&&y.length){if(N){const _=_ve(y,v);w(_)}S&&console.log("React Flow: trigger edge changes",y),g==null||g(y)}},addSelectedNodes:y=>{const{multiSelectionActive:g,edgeLookup:w,nodeLookup:v,triggerNodeChanges:N,triggerEdgeChanges:S}=m();if(g){const _=y.map(j=>Dp(j,!0));N(_);return}N(py(v,new Set([...y]),!0)),S(py(w))},addSelectedEdges:y=>{const{multiSelectionActive:g,edgeLookup:w,nodeLookup:v,triggerNodeChanges:N,triggerEdgeChanges:S}=m();if(g){const _=y.map(j=>Dp(j,!0));S(_);return}S(py(w,new Set([...y]))),N(py(v,new Set,!0))},unselectNodesAndEdges:({nodes:y,edges:g}={})=>{const{edges:w,nodes:v,nodeLookup:N,triggerNodeChanges:S,triggerEdgeChanges:_}=m(),j=y||v,A=g||w,C=j.map(M=>{const I=N.get(M.id);return I&&(I.selected=!1),Dp(M.id,!1)}),k=A.map(M=>Dp(M.id,!1));S(C),_(k)},setMinZoom:y=>
4960{const{panZoom:g,maxZoom:w}=m();g==null||g.setScaleExtent([y,w]),p({minZoom:y})},setMaxZoom:y=>{const{panZoom:g,minZoom:w}=m();g==null||g.setScaleExtent([w,y]),p({maxZoom:y})},setTranslateExtent:y=>{var g;(g=m().panZoom)==null||g.setTranslateExtent(y),p({translateExtent:y})},resetSelectedElements:()=>{const{edges:y,nodes:g,triggerNodeChanges:w,triggerEdgeChanges:v,elementsSelectable:N}=m();if(!N)return;const S=g.reduce((j,A)=>A.selected?[...j,Dp(A.id,!1)]:j,[]),_=y.reduce((j,A)=>A.selected?[...j,Dp(A.id,!1)]:j,[]);w(S),v(_)},setNodeExtent:y=>{const{nodes:g,nodeLookup:w,parentLookup:v,nodeOrigin:N,elevateNodesOnSelect:S,nodeExtent:_,zIndexMode:j}=m();y[0][0]===_[0][0]&&y[0][1]===_[0][1]&&y[1][0]===_[1][0]&&y[1][1]===_[1][1]||(SF(g,w,v,{nodeOrigin:N,nodeExtent:y,elevateNodesOnSelect:S,checkEquality:!1,zIndexMode:j}),p({nodeExtent:y}))},panBy:y=>{const{transform:g,width:w,height:v,panZoom:N,translateExtent:S}=m();return ARt({delta:y,panZoom:N,transform:g,translateExtent:S,width:w,height:v})},setCenter:async(y,g,w)=>{const{width:v,height:N,maxZoom:S,panZoom:_}=m();if(!_)return Promise.resolve(!1);const j=typeof(w==null?void 0:w.zoom)<"u"?w.zoom:S;return await _.setViewport({x:v/2-y*j,y:N/2-g*j,zoom:j},{duration:w==null?void 0:w.duration,ease:w==null?void 0:w.ease,interpolate:w==null?void 0:w.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{p({connection:{...Bye}})},updateConnection:y=>{p({connection:y})},reset:()=>p({...qZ()})}},Object.is);function F3t({initialNodes:t,initialEdges:e,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:s,initialMinZoom:a,initialMaxZoom:l,initialFitViewOptions:c,fitView:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h,children:p}){const[m]=b.useState(()=>$3t({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,width:i,height:s,fitView:u,minZoom:a,maxZoom:l,fitViewOptions:c,nodeOrigin:d,nodeExtent:f,zIndexMode:h}));return o.jsx(rIt,{value:m,children:o.jsx(CIt,{children:p})})}function U3t({children:t,nodes:e,edges:n,defaultNodes:r,defaultEdges:i,width:s,height:a,fitView:l,fitViewOptions:c,minZoom:u,maxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p}){return b.useContext(nO)?o.jsx(o.Fragment,{children:t}):o.jsx(F3t,{initialNodes:e,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:s,initialHeight:a,fitView:l,initialFitViewOptions:c,initialMinZoom:u,initialMaxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p,children:t})}const z3t={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function B3t({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:s,edgeTypes:a,onNodeClick:l,onEdgeClick:c,onInit:u,onMove:d,onMoveStart:f,onMoveEnd:h,onConnect:p,onConnectStart:m,onConnectEnd:x,onClickConnectStart:y,onClickConnectEnd:g,onNodeMouseEnter:w,onNodeMouseMove:v,onNodeMouseLeave:N,onNodeContextMenu:S,onNodeDoubleClick:_,onNodeDragStart:j,onNodeDrag:A,onNodeDragStop:C,onNodesDelete:k,onEdgesDelete:M,onDelete:I,onSelectionChange:R,onSelectionDragStart:E,onSelectionDrag:P,onSelectionDragStop:O,onSelectionContextMenu:L,onSelectionStart:T,onSelectionEnd:D,onBeforeDelete:F,connectionMode:q,connectionLineType:B=Mf.Bezier,connectionLineStyle:z,connectionLineComponent:H,connectionLineContainerStyle:W,deleteKeyCode:G="Backspace",selectionKeyCode:K="Shift",selectionOnDrag:ee=!1,selectionMode:V=Y_.Full,panActivationKeyCode:J="Space",multiSelectionKeyCode:Y=Q_()?"Meta":"Control",zoomActivationKeyCode:$=Q_()?"Meta":"Control",snapToGrid:fe,snapGrid:ce,onlyRenderVisibleElements:ve=!1,selectNodesOnDrag:X,nodesDraggable:de,autoPanOnNodeFocus:Te,nodesConnectable:Pe,nodesFocusable:se,nodeOrigin:U=vve,edgesFocusable:Q,edgesReconnectable:oe,elementsSelectable:_e=!0,defaultViewport:ye=gIt,minZoom:re=.5,maxZoom:he=2,translateExtent:pe=K_,preventScrolling:je=!0,nodeExtent:ae,defaultMarkerColor:we="#b1b1b7",zoomOnScroll:Ie=!0,zoomOnPinch:Ue=!0,panOnScroll:Oe=!1,panOnScrollSpeed:ie=.5,panOnScrollMode:De=km.Free,zoomOnDoubleClick:Ve=!0,panOnDrag:xe=!0,onPaneClick:$e,onPaneMouseEnter:ue,onPaneMouseMove:Ne,onPaneMouseLeave:Le,onPaneScroll:tt,onPaneContextMenu:St,paneClickDistance:rt=1,nodeClickDistance:vt=0,children:me,onReconnect:Fe,onReconnectStart:He,onReconnectEnd:Ye,onEdgeContextMenu:Nt,onEdgeDoubleClick:qt,onEdgeMouseEnter:Jt,onEdgeMouseMove:ea,onEdgeMouseLeave:hn,reconnectRadius:sn=10,onNodesChange:Jn,onEdgesChange:sr,noDragClassName:ar="nodrag",noWheelClassName:as="nowheel",noPanClassName:Cs="nopan",fitView:en,fitViewOptions:Z,connectOnClick:Se,attributionPosition:ke,proOptions:Ee,defaultEdgeOptions:Ae,elevateNodesOnSelect:qe=!0,elevateEdgesOnSelect:st=!1,disableKeyboardA11y:it=!1,autoPanOnConnect:lt,autoPanOnNodeDrag:ht,autoPanSpeed:At,connectionRadius:pt,isValidConnection:xn,onError:Fn,style:qr,id:$s,nodeDragThreshold:Un,connectionDragThreshold:Ot,viewport:Fi,onViewportChange:zn,width:Za,height:Yd,colorMode:ta="light",debug:eb,onScroll:Dr,ariaLabelConfig:Nc,zIndexMode:Wg="basic",...Ea},tb){const nb=$s||"1",SN=bIt(ta),m1e=b.useCallback(J9=>{J9.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Dr==null||Dr(J9)},[Dr]);return o.jsx("div",{"data-testid":"rf__wrapper",...Ea,onScroll:m1e,style:{...qr,...z3t},ref:tb,className:$i(["react-flow",i,SN]),id:$s,role:"application",children:o.jsxs(U3t,{nodes:t,edges:e,width:Za,height:Yd,fitView:en,fitViewOptions:Z,minZoom:re,maxZoom:he,nodeOrigin:U,nodeExtent:ae,zIndexMode:Wg,children:[o.jsx(L3t,{onInit:u,onNodeClick:l,onEdgeClick:c,onNodeMouseEnter:w,onNodeMouseMove:v,onNodeMouseLeave:N,onNodeContextMenu:S,onNodeDoubleClick:_,nodeTypes:s,edgeTypes:a,connectionLineType:B,connectionLineStyle:z,connectionLineComponent:H,connectionLineContainerStyle:W,selectionKeyCode:K,selectionOnDrag:ee,selectionMode:V,deleteKeyCode:G,multiSelectionKeyCode:Y,panActivationKeyCode:J,zoomActivationKeyCode:$,onlyRenderVisibleElements:ve,defaultViewport:ye,translateExtent:pe,minZoom:re,maxZoom:he,preventScrolling:je,zoomOnScroll:Ie,zoomOnPinch:Ue,zoomOnDoubleClick:Ve,panOnScroll:Oe,panOnScrollSpeed:ie,panOnScrollMode:De,panOnDrag:xe,onPaneClick:$e,onPaneMouseEnter:ue,onPaneMouseMove:Ne,onPaneMouseLeave:Le,onPaneScroll:tt,onPaneContextMenu:St,paneClickDistance:rt,nodeClickDistance:vt,onSelectionContextMenu:L,onSelectionStart:T,onSelectionEnd:D,onReconnect:Fe,onReconnectStart:He,onReconnectEnd:Ye,onEdgeContextMenu:Nt,onEdgeDoubleClick:qt,onEdgeMouseEnter:Jt,onEdgeMouseMove:ea,onEdgeMouseLeave:hn,reconnectRadius:sn,defaultMarkerColor:we,noDragClassName:ar,noWheelClassName:as,noPanClassName:Cs,rfId:nb,disableKeyboardA11y:it,nodeExtent:ae,viewport:Fi,onViewportChange:zn}),o.jsx(vIt,{nodes:t,edges:e,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:x,onClickConnectStart:y,onClickConnectEnd:g,nodesDraggable:de,autoPanOnNodeFocus:Te,nodesConnectable:Pe,nodesFocusable:se,edgesFocusable:Q,edgesReconnectable:oe,elementsSelectable:_e,elevateNodesOnSelect:qe,elevateEdgesOnSelect:st,minZoom:re,maxZoom:he,nodeExtent:ae,onNodesChange:Jn,onEdgesChange:sr,snapToGri
4960d:fe,snapGrid:ce,connectionMode:q,translateExtent:pe,connectOnClick:Se,defaultEdgeOptions:Ae,fitView:en,fitViewOptions:Z,onNodesDelete:k,onEdgesDelete:M,onDelete:I,onNodeDragStart:j,onNodeDrag:A,onNodeDragStop:C,onSelectionDrag:P,onSelectionDragStart:E,onSelectionDragStop:O,onMove:d,onMoveStart:f,onMoveEnd:h,noPanClassName:Cs,nodeOrigin:U,rfId:nb,autoPanOnConnect:lt,autoPanOnNodeDrag:ht,autoPanSpeed:At,onError:Fn,connectionRadius:pt,isValidConnection:xn,selectNodesOnDrag:X,nodeDragThreshold:Un,connectionDragThreshold:Ot,onBeforeDelete:F,debug:eb,ariaLabelConfig:Nc,zIndexMode:Wg}),o.jsx(mIt,{onSelectionChange:R}),me,o.jsx(uIt,{proOptions:Ee,position:ke}),o.jsx(cIt,{rfId:nb,disableKeyboardA11y:it})]})})}var V3t=Sve(B3t);function H3t(t){const[e,n]=b.useState(t),r=b.useCallback(i=>n(s=>wve(i,s)),[]);return[e,n,r]}function W3t(t){const[e,n]=b.useState(t),r=b.useCallback(i=>n(s=>_ve(i,s)),[]);return[e,n,r]}function G3t({dimensions:t,lineWidth:e,variant:n,className:r}){return o.jsx("path",{strokeWidth:e,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`,className:$i(["react-flow__background-pattern",n,r])})}function q3t({radius:t,className:e}){return o.jsx("circle",{cx:t,cy:t,r:t,className:$i(["react-flow__background-pattern","dots",e])})}var bh;(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})(bh||(bh={}));const K3t={[bh.Dots]:1,[bh.Lines]:1,[bh.Cross]:6},Y3t=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function qve({id:t,variant:e=bh.Dots,gap:n=20,size:r,lineWidth:i=1,offset:s=0,color:a,bgColor:l,style:c,className:u,patternClassName:d}){const f=b.useRef(null),{transform:h,patternId:p}=Dn(Y3t,Qr),m=r||K3t[e],x=e===bh.Dots,y=e===bh.Cross,g=Array.isArray(n)?n:[n,n],w=[g[0]*h[2]||1,g[1]*h[2]||1],v=m*h[2],N=Array.isArray(s)?s:[s,s],S=y?[v,v]:w,_=[N[0]
4960*h[2]||1+S[0]/2,N[1]*h[2]||1+S[1]/2],j=`${p}${t||""}`;return o.jsxs("svg",{className:$i(["react-flow__background",u]),style:{...c,...iO,"--xy-background-color-props":l,"--xy-background-pattern-color-props":a},ref:f,"data-testid":"rf__background",children:[o.jsx("pattern",{id:j,x:h[0]%w[0],y:h[1]%w[1],width:w[0],height:w[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${_[0]},-${_[1]})`,children:x?o.jsx(q3t,{radius:v/2,className:d}):o.jsx(G3t,{dimensions:S,lineWidth:i,variant:e,className:d})}),o.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${j})`})]})}qve.displayName="Background";const X3t=b.memo(qve);function Q3t(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:o.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function J3t(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:o.jsx("path",{d:"M0 0h32v4.2H0z"})})}function Z3t(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:o.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function eDt(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:o.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function tDt(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:o.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function aC({children:t,className:e,...n}){return o.jsx("button",{type:"button",className:$i(["react-flow__controls-button",e]),...n,children:t})}const nDt=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom,ariaLabelConfig:t.ariaLabelConfig});function Kve({style:t,showZoom:e=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:s,onZoomOut:a,onFitView:l,onInteractiveChange:c,className:u,children:d,position:f="bottom-left",orientation:h="vertical","aria-label":p}){const m=Jr(),{isInteractive:x,minZoomReached:y,maxZoomReached:g,ariaLabelConfig:w}=Dn(nDt,Qr),{zoomIn:v,zoomOut:N,fitView:S}=l9(),_=()=>{v(),s==null||s()},j=()=>{N(),a==null||a()},A=()=>{S(i),l==null||l()},C=()=>{m.setState({nodesDraggable:!x,nodesConnectable:!x,elementsSelectable:!x}),c==null||c(!x)},k=h==="horizontal"?"horizontal":"vertical";return o.jsxs(rO,{className:$i(["react-flow__controls",k,u]),position:f,style:t,"data-testid":"rf__controls","aria-label":p??w["controls.ariaLabel"],children:[e&&o.jsxs(o.Fragment,{children:[o.jsx(aC,{onClick:_,className:"react-flow__controls-zoomin",title:w["controls.zoomIn.ariaLabel"],"aria-label":w["controls.zoomIn.ariaLabel"],disabled:g,children:o.jsx(Q3t,{})}),o.jsx(aC,{onClick:j,className:"react-flow__controls-zoomout",title:w["controls.zoomOut.ariaLabel"],"aria-label":w["controls.zoomOut.ariaLabel"],disabled:y,children:o.jsx(J3t,{})})]}),n&&o.jsx(aC,{className:"react-flow__controls-fitview",onClick:A,title:w["controls.fitView.ariaLabel"],"aria-label":w["controls.fitView.ariaLabel"],children:o.jsx(Z3t,{})}),r&&o.jsx(aC,{className:"react-flow__controls-interactive",onClick:C,title:w["controls.interactive.ariaLabel"],"aria-label":w["controls.interactive.ariaLabel"],children:x?o.jsx(tDt,{}):o.jsx(eDt,{})}),d]})}Kve.displayName="Controls";b.memo(Kve);function rDt({id:t,x:e,y:n,width:r,height:i,style:s,color:a,strokeColor:l,strokeWidth:c,className:u,borderRadius:d,shapeRendering:f,selected:h,onClick:p}){const{background:m,backgroundColor:x}=s||{},y=a||m||x;return o.jsx("rect",{className:$i(["react-flow__minimap-node",{selected:h},u]),x:e,y:n,rx:d,ry:d,width:r,height:i,style:{fill:y,stroke:l,strokeWidth:c},shapeRendering:f,onClick:p?g=>p(g,t):void 0})}const iDt=b.memo(rDt),sDt=t=>
4960t.nodes.map(e=>e.id),P3=t=>t instanceof Function?t:()=>t;function aDt({nodeStrokeColor:t,nodeColor:e,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:s=iDt,onClick:a}){const l=Dn(sDt,Qr),c=P3(e),u=P3(t),d=P3(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return o.jsx(o.Fragment,{children:l.map(h=>o.jsx(lDt,{id:h,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:s,onClick:a,shapeRendering:f},h))})}function oDt({id:t,nodeColorFunc:e,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:s,shapeRendering:a,NodeComponent:l,onClick:c}){const{node:u,x:d,y:f,width:h,height:p}=Dn(m=>{const{internals:x}=m.nodeLookup.get(t),y=x.userNode,{x:g,y:w}=x.positionAbsolute,{width:v,height:N}=Gd(y);return{node:y,x:g,y:w,width:v,height:N}},Qr);return!u||u.hidden||!Yye(u)?null:o.jsx(l,{x:d,y:f,width:h,height:p,style:u.style,selected:!!u.selected,className:r(u),color:e(u),borderRadius:i,strokeColor:n(u),strokeWidth:s,shapeRendering:a,onClick:c,id:u.id})}const lDt=b.memo(oDt);var cDt=b.memo(aDt);const uDt=200,dDt=150,fDt=t=>!t.hidden,hDt=t=>{const e={x:-t.transform[0]/t.transform[2],y:-t.transform[1]/t.transform[2],width:t.width/t.transform[2],height:t.height/t.transform[2]};return{viewBB:e,boundingRect:t.nodeLookup.size>0?Kye(mN(t.nodeLookup,{filter:fDt}),e):e,rfId:t.rfId,panZoom:t.panZoom,translateExtent:t.translateExtent,flowWidth:t.width,flowHeight:t.height,ariaLabelConfig:t.ariaLabelConfig}},pDt="react-flow__minimap-desc";function Yve({style:t,className:e,nodeStrokeColor:n,nodeColor:r,nodeClassName:i="",nodeBorderRadius:s=5,nodeStrokeWidth:a,nodeComponent:l,bgColor:c,maskColor:u,maskStrokeColor:d,maskStrokeWidth:f,position:h="bottom-right",onClick:p,onNodeClick:m,pannable:x=!1,zoomable:y=!1,ariaLabel:g,inversePan:w,zoomStep:v=1,offsetScale:N=5}){const S=Jr(),_=b.useRef(null),{boundingRect:j,viewBB:A,rfId:C,panZoom:k,translateExtent:M,flowWidth:I,flowHeight:R,ariaLabelConfig:E}=Dn(hDt,Qr),P=(t==null?void 0:t.width)??uDt,O=(t==null?void 0:t.height)??dDt,L=j.width/P,T=j.height/O,D=Math.max(L,T),F=D*P,q=D*O,B=N*D,z=j.x-(F-j.width)/2-B,H=j.y-(q-j.height)/2-B,W=F+B*2,G=q+B*2,K=`${pDt}-${C}`,ee=b.useRef(0),V=b.useRef();ee.current=D,b.useEffect(()=>{if(_.current&&k)return V.current=$Rt({domNode:_.current,panZoom:k,getTransform:()=>S.getState().transform,getViewScale:()=>ee.current}),()=>{var fe;(fe=V.current)==null||fe.destroy()}},[k]),b.useEffect(()=>{var fe;(fe=V.current)==null||fe.update({translateExtent:M,width:I,height:R,inversePan:w,pannable:x,zoomStep:v,zoomable:y})},[x,y,w,v,M,I,R]);const J=p?fe=>{var X;const[ce,ve]=((X=V.current)==null?void 0:X.pointer(fe))||[0,0];p(fe,{x:ce,y:ve})}:void 0,Y=m?b.useCallback((fe,ce)=>{const ve=S.getState().nodeLookup.get(ce).internals.userNode;m(fe,ve)},[]):void 0,$=g??E["minimap.ariaLabel"];return o.jsx(rO,{position:h,style:{...t,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-width-props":typeof f=="number"?f*D:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof a=="number"?a:void 0},className:$i(["react-flow__minimap",e]),"data-testid":"rf__minimap",children:o.jsxs("svg",{width:P,height:O,viewBox:`${z} ${H} ${W} ${G}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":K,ref:_,onClick:J,children:[$&&o.jsx("title",{id:K,children:$}),o.jsx(cDt,{onClick:Y,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:i,nodeStrokeWidth:a,nodeComponent:l}),o.jsx("path",{className:"react-flow__minimap-mask",d:`M${z-B},${H-B}h${W+B*2}v${G+B*2}h${-W-B*2}z
4961        M${A.x},${A.y}h${A.width}v${A.height}h${-A.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Yve.displayName="MiniMap";b.memo(Yve);const mDt=t=>e=>t?`${Math.max(1/e.transform[2],1)}`:void 0,gDt={[u0.Line]:"right",[u0.Handle]:"bottom-right"};function xDt({nodeId:t,position:e,variant:n=u0.Handle,className:r,style:i=void 0,children:s,color:a,minWidth:l=10,minHeight:c=10,maxWidth:u=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:h,autoScale:p=!0,shouldResize:m,onResizeStart:x,onResize:y,onResizeEnd:g}){const w=kve(),v=typeof t=="string"?t:w,N=Jr(),S=b.useRef(null),_=n===u0.Handle,j=Dn(b.useCallback(mDt(_&&p),[_,p]),Qr),A=b.useRef(null),C=e??gDt[n];b.useEffect(()=>{if(!(!S.current||!v))return A.current||(A.current=JRt({domNode:S.current,nodeId:v,getStoreItems:()=>
4961{const{nodeLookup:M,transform:I,snapGrid:R,snapToGrid:E,nodeOrigin:P,domNode:O}=N.getState();return{nodeLookup:M,transform:I,snapGrid:R,snapToGrid:E,nodeOrigin:P,paneDomNode:O}},onChange:(M,I)=>{const{triggerNodeChanges:R,nodeLookup:E,parentLookup:P,nodeOrigin:O}=N.getState(),L=[],T={x:M.x,y:M.y},D=E.get(v);if(D&&D.expandParent&&D.parentId){const F=D.origin??O,q=M.width??D.measured.width??0,B=M.height??D.measured.height??0,z={id:D.id,parentId:D.parentId,rect:{width:q,height:B,...Xye({x:M.x??D.position.x,y:M.y??D.position.y},{width:q,height:B},D.parentId,E,F)}},H=o9([z],E,P,O);L.push(...H),T.x=M.x?Math.max(F[0]*q,M.x):void 0,T.y=M.y?Math.max(F[1]*B,M.y):void 0}if(T.x!==void 0&&T.y!==void 0){const F={id:v,type:"position",position:{...T}};L.push(F)}if(M.width!==void 0&&M.height!==void 0){const q={id:v,type:"dimensions",resizing:!0,setAttributes:h?h==="horizontal"?"width":"height":!0,dimensions:{width:M.width,height:M.height}};L.push(q)}for(const F of I){const q={...F,type:"position"};L.push(q)}R(L)},onEnd:({width:M,height:I})=>{const R={id:v,type:"dimensions",resizing:!1,dimensions:{width:M,height:I}};N.getState().triggerNodeChanges([R])}})),A.current.update({controlPosition:C,boundaries:{minWidth:l,minHeight:c,maxWidth:u,maxHeight:d},keepAspectRatio:f,resizeDirection:h,onResizeStart:x,onResize:y,onResizeEnd:g,shouldResize:m}),()=>{var M;(M=A.current)==null||M.destroy()}},[C,l,c,u,d,f,x,y,g,m]);const k=C.split("-");return o.jsx("div",{className:$i(["react-flow__resize-control","nodrag",...k,n,r]),ref:S,style:{...i,scale:j,...a&&{[_?"backgroundColor":"borderColor"]:a}},children:s})}b.memo(xDt);function yDt({data:t}){return o.jsxs("div",{className:"px-6 py-4 rounded-xl border-2 border-primary bg-background shadow-lg min-w-[200px]",children:[o.jsx(al,{type:"source",position:_t.Top,className:"!bg-primary"}),o.jsx(al,{type:"source",position:_t.Bottom,className:"!bg-primary"}),o.jsx(al,{type:"source",position:_t.Left,className:"!bg-primary"}),o.jsx(al,{type:"source",position:_t.Right,className:"!bg-primary"}),o.jsxs("div",{className:"flex flex-col items-center gap-3",children:[o.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-lg bg-primary/10",children:o.jsx("img",{src:`https://www.google.com/s2/favicons?domain=${t.domain}&sz=64`,alt:"",className:"h-8 w-8 object-contain",onError:e=>{e.currentTarget.style.display="none",e.currentTarget.parentElement.innerHTML='<svg class="h-6 w-6 text-primary" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/></svg>'}})}),o.jsxs("div",{className:"text-center",children:[o.jsx("p",{className:"font-semibold text-lg",children:t.domain}),t.title&&o.jsx("p",{className:"text-xs text-muted-foreground max-w-[180px] truncate",children:t.title})]}),o.jsxs(Ge,{variant:"secondary",className:"mt-1",children:[t.totalReferences," reference",t.totalReferences!==1?"s":""]}),o.jsxs("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline flex items-center gap-1",children:["Visit site ",o.jsx(Wr,{className:"h-3 w-3"})]})]})]})}function vDt({data:t}){const e=Nr();return o.jsxs("div",{className:ne("px-4 py-3 rounded-lg border bg-background shadow-md cursor-pointer hover:shadow-lg transition-shadow max-w-[250px]",t.brandMentioned?"border-green-500/50":"border-border"),onClick:()=>e(`/company/${t.companyId}/prompts/${t.queryId}`),children:[o.jsx(al,{type:"target",position:_t.Top,className:"!bg-muted-foreground"}),o.jsx(al,{type:"target",position:_t.Bottom,className:"!bg-muted-foreground"}),o.jsx(al,{type:"target",position:_t.Left,className:"!bg-muted-foreground"}),o.jsx(al,{type:"target",position:_t.Right,className:"!bg-muted-foreground"}),o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx(Mo,{className:"h-4 w-4 text-muted-foreground shrink-0 mt-0.5"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"text-sm font-medium line-clamp-2",children:t.prompt}),o.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[o.jsxs(Ge,{variant:"outline",className:"text-xs",children:[t.count,"x"]}),t.brandMentioned&&o.jsx(Ge,{variant:"default",className:"text-xs bg-green-500/20 text-green-600 border-green-500/30",children:"Mentions you"})]})]})]})]})}const bDt={source:yDt,query:vDt};function wDt(){const{companyId:t,sourceUrl:e}=Gr(),n=Nr(),[r,i]=b.useState(null),[s,a]=b.useState(!0),[l,c,u]=H3t([]),[d,f,h]=W3t([]),p=b.useMemo(()=>{try{return decodeURIComponent(e||"")}catch{return e||""}},[e]);b.useEffect(()=>{t&&p&&m()},[t,p]);const m=async()=>{try{a(!0);const y=await Ce.get(`/companies/${t}/sources/${encodeURIComponent(p)}`);i(y),x(y)}catch(y){ge.error(y.message||"Failed to load source data"),n(`/company/${t}/prompts`)}finally{a(!1)}},x=b.useCallback(y=>{const g=[],w=[];g.push({id:"source",type:"source",position:{x:0,y:0},data:{domain:y.domain,title:y.title,url:y.url,totalReferences:y.totalReferences}});const v=y.queries.length,N=Math.max(300,v*40);
4961y.queries.forEach((S,_)=>{const j=2*Math.PI*_/v-Math.PI/2,A=Math.cos(j)*N,C=Math.sin(j)*N;g.push({id:`query-${S.queryId}`,type:"query",position:{x:A,y:C},data:{prompt:S.queryPrompt,count:S.count,brandMentioned:S.brandMentioned,queryId:S.queryId,companyId:t}}),w.push({id:`edge-${S.queryId}`,source:"source",target:`query-${S.queryId}`,type:"smoothstep",animated:!0,style:{stroke:"#22c55e",strokeWidth:2}})}),c(g),f(w)},[t,c,f]);return s?o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Source Detail",noIndex:!0}),o.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:o.jsx(Me,{className:"h-8 w-8 animate-spin text-primary"})})]}):r?o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:`${r.domain} - Source`,noIndex:!0}),o.jsxs("div",{className:"absolute inset-0 flex flex-col",children:[o.jsxs("div",{className:"flex items-center gap-4 p-4 border-b bg-background/95 backdrop-blur z-10 shrink-0",children:[o.jsxs(le,{variant:"ghost",size:"sm",onClick:()=>n(-1),children:[o.jsx(Ii,{className:"h-4 w-4 mr-2"}),"Back"]}),o.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[o.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded bg-muted overflow-hidden",children:o.jsx("img",{src:`https://www.google.com/s2/favicons?domain=${r.domain}&sz=32`,alt:"",className:"h-5 w-5 object-contain",onError:y=>{y.currentTarget.style.display="none"}})}),o.jsxs("div",{children:[o.jsx("h1",{className:"font-semibold",children:r.domain}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:[r.queries.length," queries reference this source"]})]})]}),o.jsx("a",{href:r.url,target:"_blank",rel:"noopener noreferrer",children:o.jsxs(le,{variant:"outline",size:"sm",children:[o.jsx(Wr,{className:"h-4 w-4 mr-2"}),"Open link"]})})]}),o.jsx("div",{className:"flex-1 min-h-0",children:o.jsx(V3t,{nodes:l,edges:d,onNodesChange:u,onEdgesChange:h,nodeTypes:bDt,fitView:!0,fitViewOptions:{padding:.5},minZoom:.1,maxZoom:2,defaultEdgeOptions:{type:"smoothstep"},children:o.jsx(X3t,{gap:20,size:1})})})]})]}):o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Source Detail",noIndex:!0}),o.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:o.jsx("p",{className:"text-muted-foreground",children:"Source not found"})})]})}function _Dt(){const{companyId:t}=Gr(),{user:e}=Rr(),[n,r]=b.useState([]),[i,s]=b.useState(null),[a,l]=b.useState(!0),[c,u]=b.useState(!1),[d,f]=b.useState(!1),[h,p]=b.useState({email:"",role:"viewer"}),m=(i==null?void 0:i.ownerId)===(e==null?void 0:e.id);b.useEffect(()=>{t&&x()},[t]);const x=async()=>{try{const[N,S]=await Promise.all([Ce.get(`/companies/${t}/members`),Ce.get(`/companies/${t}`)]);r(N),s(S)}catch(N){ge.error(N.message||"Failed to fetch team data")}finally{l(!1)}},y=async()=>{if(!h.email.trim()){ge.error("Please enter an email address");return}f(!0);try{await Ce.post(`/companies/${t}/members`,{email:h.email.trim(),role:h.role}),ge.success("Invitation sent successfully"),p({email:"",role:"viewer"}),u(!1),x()}catch(N){ge.error(N.message||"Failed to send invitation")}finally{f(!1)}},g=async(N,S)=>{try{await Ce.patch(`/companies/${t}/members/${N.userId}`,{role:S}),r(n.map(_=>_.id===N.id?{..._,role:S}:_)),ge.success("Role updated successfully")}catch(_){ge.error(_.message||"Failed to update role")}},w=async N=>{if(confirm(`Are you sure you want to remove ${N.user.fullName||"this member"}?`))try{await Ce.delete(`/companies/${t}/members/${N.userId}`),r(n.filter(S=>S.id!==N.id)),ge.success("Member removed")}catch(S){ge.error(S.message||"Failed to remove member")}},v=N=>{switch(N){case"owner":return o.jsxs(Ge,{className:"gap-1 !bg-yellow-500/10 text-yellow-500 border-yellow-500/20",children:[o.jsx(mTe,{className:"h-3 w-3"}),"Owner"]});case"editor":return o.jsxs(Ge,{variant:"secondary",className:"gap-1",children:[o.jsx(G4,{className:"h-3 w-3"}),"Editor"]});default:return o.jsx(Ge,{variant:"outline",className:"gap-1",children:"Viewer"})}};return a?o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Team",noIndex:!0}),o.jsx("div",{className:"flex h-64 items-center justify-center",children:o.jsx(Me,{className:"h-8 w-8 animate-spin text-muted-foreground"})})]}):o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Team",noIndex:!0}),o.jsxs("div",{className:"",children:[o.jsxs("div",{className:"flex items-center justify-between py-3 border-b bg-background px-6 sticky top-0 z-10",children:[o.jsx("h1",{className:"text-lg font-semibold",children:"Team"}),m&&o.jsxs(le,{size:"sm",onClick:()=>u(!0),children:[o.jsx(yi,{className:"h-4 w-4"}),"Invite Member"]})]}),o.jsxs(Ct,{className:"bg-background",children:[o.jsxs(Lt,{className:"border-b",children:[o.jsxs($t,{children:["Team Members (",n.length,")"]}),o.jsx(hh,{children:"People with access to view or manage this company"})]}),o.jsx(Et,{className:"p-0",children:o.jsx("div",{className:"divide-y divide-border",children:n.map(N=>o.jsxs("div",{className:"flex items-center justify-between px-6 py-4",children:[o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-primary/10",children:N.user.avatarUrl?o.jsx("img",{src:N.user.avatarUrl,alt:"",className:"h-10 w-10 rounded-full"}):o.jsx(Rse,{className:"h-6 w-6 text-primary"})}),o.jsxs("div",{children:[o.jsxs("p",{className:"font-medium",children:[N.user.fullName||"Unknown User",N.userId===(e==null?void 0:e.id)&&o.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"(You)"})]}),o.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[v(N.role),!N.acceptedAt&&o.jsx(Ge,{variant:"outline",className:"text-yellow-500 border-yellow-500/20",children:"Pending"})]})]})]}),m&&N.role!=="owner"&&o.jsxs(gc,{children:[o.jsx(xc,{asChild:!0,children:o.jsx(le,{variant:"ghost",size:"icon",children:o.jsx(ru,{className:"h-4 w-4"})})}
4961),o.jsxs(vl,{align:"end",children:[N.role!=="editor"&&o.jsxs(lr,{onClick:()=>g(N,"editor"),children:[o.jsx(G4,{className:"h-4 w-4"}),"Make Editor"]}),N.role!=="viewer"&&o.jsx(lr,{onClick:()=>g(N,"viewer"),children:"Make Viewer"}),o.jsxs(lr,{onClick:()=>w(N),className:"text-destructive focus:text-destructive",children:[o.jsx(Yi,{className:"mr-2 h-4 w-4"}),"Remove"]})]})]})]},N.id))})})]}),o.jsx(ur,{open:c,onOpenChange:u,children:o.jsxs(tr,{children:[o.jsxs(dr,{children:[o.jsx(fr,{children:"Invite Team Member"}),o.jsx(hr,{children:"Send an invitation to join this company"})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{htmlFor:"email",children:"Email Address"}),o.jsxs("div",{className:"relative",children:[o.jsx(uH,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),o.jsx(gt,{id:"email",type:"email",placeholder:"[email protected]",value:h.email,onChange:N=>p({...h,email:N.target.value}),className:"pl-9"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{htmlFor:"role",children:"Role"}),o.jsxs(Tr,{value:h.role,onValueChange:N=>p({...h,role:N}),children:[o.jsx(yr,{children:o.jsx(Vr,{})}),o.jsxs(vr,{children:[o.jsx(Ht,{value:"viewer",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{children:"Viewer"}),o.jsx("span",{className:"text-xs text-muted-foreground",children:"- Can view data"})]})}),o.jsx(Ht,{value:"editor",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{children:"Editor"}),o.jsx("span",{className:"text-xs text-muted-foreground",children:"- Can edit settings"})]})})]})]})]})]}),o.jsxs(Pr,{children:[o.jsx(le,{variant:"outline",onClick:()=>u(!1),children:"Cancel"}),o.jsxs(le,{onClick:y,disabled:d,children:[d?o.jsx(Me,{className:"mr-2 h-4 w-4 animate-spin"}):o.jsx(uH,{className:"h-4 w-4"}),"Send Invitation"]})]})]})})]})]})}function SDt(){const{companyId:t}=Gr(),e=Nr(),{user:n}=Rr(),{fetchCompanies:r,companies:i}=Ri(),[s,a]=b.useState(null),[l,c]=b.useState(!0),[u,d]=b.useState(!1),[f,h]=b.useState(!1),[p,m]=b.useState(!1),[x,y]=b.useState(""),[g,w]=b.useState({name:"",brandName:"",website:"",country:"",allowPublicMention:!1,companyDescription:"",companyIndustry:""}),[v,N]=b.useState(!1),[S,_]=b.useState(""),[j,A]=b.useState([]),[C,k]=b.useState([]),[M,I]=b.useState(""),[R,E]=b.useState(!1),P=b.useRef(null),O=(s==null?void 0:s.ownerId)===(n==null?void 0:n.id),{data:L=[]}=AT(),T=b.useMemo(()=>{const V=S.toLowerCase();return V?L.filter(J=>J.name.toLowerCase().includes(V)):L.slice(0,20)},[S,L]);b.useEffect(()=>{t&&D()},[t]);const D=async()=>{var V;try{const J=await Ce.get(`/companies/${t}`);a(J),w({name:J.name,brandName:J.brandName,website:J.website||"",country:J.country,allowPublicMention:J.allowPublicMention??!1,companyDescription:J.companyDescription||"",companyIndustry:J.companyIndustry||""});const Y=((V=J.alternateNames)==null?void 0:V.map($=>$.name))||[];A(Y),k(Y)}catch(J){ge.error(J.message||"Failed to fetch company")}finally{c(!1)}},F=async()=>{if(!g.name.trim()||!g.brandName.trim()){ge.error("Company name and brand name are required");return}d(!0);try{const V=await Ce.patch(`/companies/${t}`,{name:g.name.trim(),brandName:g.brandName.trim(),website:g.website.trim()||null,country:g.country,allowPublicMention:g.allowPublicMention,companyDescription:g.companyDescription.trim()||null,companyIndustry:g.companyIndustry.trim()||null});a(V),await r(),ge.success("Settings saved successfully")}catch(V){ge.error(V.message||"Failed to save settings")}finally{d(!1)}},q=async()=>{if(x!==(s==null?void 0:s.name)){ge.error("Please type the company name to confirm");return}h(!0);try{await Ce.delete(`/companies/${t}`),await r(),ge.success("Company deleted");const V=i.filter(J=>J.id!==t);V.length>0?e(`/company/${V[0].id}`):e("/onboarding")}catch(V){ge.error(V.message||"Failed to delete company"),h(!1)}},B=()=>{var J;const V=M.trim();if(V){if(j.some(Y=>Y.toLowerCase()===V.toLowerCase())){ge.error("This name already exists");return}A([...j,V]),I(""),(J=P.current)==null||J.focus()}},z=V=>{A(j.filter(J=>J!==V))},H=V=>{V.key==="Enter"?(V.preventDefault(),B()):V.key==="Backspace"&&!M&&j.length>0&&A(j.slice(0,-1))},W=async()=>{E(!0);try{await Ce.put(`/companies/${t}/alternate-names`,{names:j}),k([...j]),ge.success("Alternate names saved")}catch(V){ge.error(V.message||"Failed to save alternate names")}finally{E(!1)}},G=JSON.stringify(j.sort())!==JSON.stringify(C.sort()),{isLoading:K}=Ri();if(l||K)return o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Company Settings",noIndex:!0}),o.jsx("div",{className:"flex h-64 items-center justify-center",children:o.jsx(Me,{className:"h-8 w-8 animate-spin text-muted-foreground"})})]});if(!s)return o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Company Settings",noIndex:!0}),o.jsx("div",{className:"flex h-64 items-center justify-center",children:o.jsx("p",{className:"text-muted-foreground",children:"Company not found"})})]});const ee=g.name!==s.name||g.brandName!==s.brandName||g.website!==(s.website||"")||g.country!==s.country||g.allowPublicMention!==(s.allowPublicMention??!1)||g.companyDescription!==(s.companyDescription||"")||g.companyIndustry!==(s.companyIndustry||"");return o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Company Settings",noIndex:!0}),o.jsxs("div",{className:"",children:[o.jsxs("div",{className:"flex items-center justify-between py-3 border-b bg-background px-6 sticky top-0 z-10",children:[o.jsx("h1",{className:"text-lg font-semibold",children:"Company Settings"}),o.jsxs(le,{onClick:F,disabled:u||!ee,size:"sm",children:[u?o.jsx(Me,{className:"h-4 w-4 animate-spin"}):o.jsx(W1,{className:"h-4 w-4"}),"Save Changes"]})]}),o.jsxs(Ct,{className:"bg-background",children:[o.jsxs(Lt,{className:"border-b",children:[o.jsx($t,{children:"General"}),o.jsx(hh,{children:"Basic company information"})]}),o.jsxs(Et,{className:"space-y-4 pt-6",children:[o.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{htmlFor:"name",children:"Company Name *"}),o.jsx(gt,{id:"name",value:g.name,onChange:V=>w({...g,name:V.target.value}),placeholder:"Acme Inc."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{htmlFor:"brandName",children:"Brand Name *"}),o.jsx(gt,{id:"brandName",value:g.brandName,onChange:V=>w({...g,brandName:V.target.value}),placeholder:"Acme"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"The name that will be tracked in LLM responses"})]})]}),o.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{htmlFor:"website",children:"Website"}),o.jsx(gt,{id:"website",value:g.website,onChange:V=>w({...g,website:V.target.value}),placeholder:"https://acme.com"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{children:"Country"}),o.jsxs(ou,{open:v,onOpenChange:N,children:[o.jsx(lu,{asChild:!0,children:o.jsxs(le,{variant:"outline",role:"combobox","aria-expanded":v,className:"w-full justify-between font-normal",children:[g.country||"Select country...",o.jsx(bg,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),o.jsx(pc,{className:"w-full p-0",align:"start",children:o.jsxs(Kh,{children:[o.jsx(Yh,{placeholder:"Search country...",value:S,onValueChange:_}),o.jsx(Xh,{children:"No country found."}),o.jsx(_d,{className:"max-h-64 overflow-y-auto",children:T.map(V=>o.jsxs(Sd,{value:V.name,onSelect:J=>{w({...g,country:J===g.country?"":J}),N(!1),_("")},children:[o.jsx(Sn,{className:ne("mr-2 h-4 w-4",g.country===V.name?"opacity-100":"opacity-0")}),V.name]},V.code))})]})})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Used to tailor prompts for regional context"})]})]}),o.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx(lv,{className:"h-4 w-4 text-muted-foreground"}),o.jsx("span",{className:"font-medium",children:"Company Context"}),o.jsx("span",{className:"text-xs text-muted-foreground",children:"(Used to improve AI analysis)"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{htmlFor:"companyIndustry",children:"Industry"}),o.jsx(gt,{id:"companyIndustry",value:g.companyIndustry,onChange:V=>w({...g,companyIndustry:V.target.value}
4961),placeholder:"e.g., E-commerce, SaaS, Healthcare Technology..."}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Helps identify relevant competitors in your market"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{htmlFor:"companyDescription",children:"Company Description"}),o.jsx(dl,{id:"companyDescription",value:g.companyDescription,onChange:V=>w({...g,companyDescription:V.target.value}),placeholder:"Brief description of what your company does, your main products/services, and target market...",rows:3}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Provides context for better competitor and source analysis"})]}),(s==null?void 0:s.websiteMeta)&&(s.websiteMeta.title||s.websiteMeta.description)&&o.jsxs("div",{className:"space-y-2 pt-2 border-t",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Ao,{className:"h-4 w-4 text-muted-foreground"}),o.jsx("span",{className:"text-sm font-medium",children:"Website Metadata"}),o.jsx("span",{className:"text-xs text-muted-foreground",children:"(Auto-fetched)"})]}),s.websiteMeta.title&&o.jsxs("div",{className:"text-sm",children:[o.jsx("span",{className:"text-muted-foreground",children:"Title:"})," ",o.jsx("span",{children:s.websiteMeta.title})]}),s.websiteMeta.description&&o.jsxs("div",{className:"text-sm",children:[o.jsx("span",{className:"text-muted-foreground",children:"Description:"})," ",o.jsx("span",{className:"text-sm",children:s.websiteMeta.description})]})]})]}),o.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-4",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(To,{className:"h-4 w-4 text-muted-foreground"}),o.jsx(et,{htmlFor:"allowPublicMention",className:"font-medium",children:"Allow Public Mention"})]}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Allow your company logo to be featured on our public website as a customer example"})]}),o.jsx(Zi,{id:"allowPublicMention",checked:g.allowPublicMention,onCheckedChange:V=>w({...g,allowPublicMention:V})})]})]})]}),o.jsxs(Ct,{className:"bg-background border-t",children:[o.jsxs(Lt,{className:"border-b",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Ez,{className:"h-5 w-5 text-muted-foreground"}),o.jsx($t,{children:"Alternate Names"})]}),o.jsx(hh,{children:'Add other names that represent your company. These could be product names, brand variations, legal names (e.g., "Company Ltd"), or any name you want our platform to recognize as your brand in AI responses.'})]}),o.jsxs(Et,{className:"space-y-4 pt-6",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{children:"Names"}),o.jsxs("div",{className:ne("flex flex-wrap items-center gap-2 p-3 min-h-[52px] rounded-md border bg-background cursor-text","focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2"),onClick:()=>{var V;return(V=P.current)==null?void 0:V.focus()},children:[j.map(V=>o.jsxs(Ge,{variant:"outline",className:"gap-1 h-7 text-sm pr-1.5 bg-muted/50",children:[V,o.jsx("button",{type:"button",onClick:J=>{J.stopPropagation(),z(V)},className:"ml-0.5 hover:bg-muted-foreground/20 rounded-full p-0.5 transition-colors",children:o.jsx(mr,{className:"h-3 w-3"})})]},V)),o.jsx("input",{ref:P,type:"text",value:M,onChange:V=>I(V.target.value),onKeyDown:H,placeholder:j.length===0?"Type a name and press Enter...":"Add more...",className:"flex-1 min-w-[120px] bg-transparent outline-none text-sm placeholder:text-muted-foreground"})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Press Enter to add a name, Backspace on empty input to remove the last one"})]}),o.jsxs("div",{className:"flex items-center justify-between pt-2",children:[o.jsxs("div",{className:"text-sm text-muted-foreground",children:[j.length," alternate name",j.length!==1?"s":""]}),o.jsxs(le,{onClick:W,disabled:R||!G,size:"sm",children:[R?o.jsx(Me,{className:"h-4 w-4 animate-spin"}):o.jsx(W1,{className:"h-4 w-4"}),"Save Names"]})]})]})]}),O&&o.jsxs(Ct,{className:"bg-background border-t",children:[o.jsxs(Lt,{className:"border-b",children:[o.jsx($t,{className:"text-destructive",children:"Danger Zone"}),o.jsx(hh,{children:"Irreversible and destructive actions"})]}),o.jsx(Et,{className:"pt-6",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("p",{className:"font-medium",children:"Delete this company"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Permanently delete all data associated with this company"})]}),o.jsxs(le,{variant:"destructive",onClick:()=>m(!0),children:[o.jsx(Yi,{className:"h-4 w-4"}),"Delete Company"]})]})})]}),o.jsx(ur,{open:p,onOpenChange:m,children:o.jsxs(tr,{children:[o.jsxs(dr,{children:[o.jsxs(fr,{className:"flex items-center gap-2 text-destructive",children:[o.jsx(ll,{className:"h-5 w-5"}),"Delete Company"]}),o.jsx(hr,{children:"This action cannot be undone. This will permanently delete the company and all associated data including queries, rankings, and competitors."})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("p",{className:"text-sm",children:["Type ",o.jsx("strong",{children:s.name})," to confirm:"]}),o.jsx(gt,{value:x,onChange:V=>y(V.target.value),placeholder:s.name})]}),o.jsxs(Pr,{children:[o.jsx(le,{variant:"outline",onClick:()=>m(!1),children:"Cancel"}),o.jsxs(le,{variant:"destructive",onClick:q,disabled:f||x!==s.name,children:[f?o.jsx(Me,{className:"h-4 w-4 animate-spin"}):o.jsx(Yi,{className:"h-4 w-4"}),"Delete Company"]})]})]})})]})]})}function u9({title:t,description:e,isLoading:n=!0,className:r}){return o.jsx(Dt,{className:ne("border-dashed",r),children:o.jsxs(Vt,{className:"flex flex-col items-center justify-center py-16 px-6",children:[n&&o.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-full bg-primary/10 mb-6",children:o.jsx(Me,{className:"h-8 w-8 animate-spin text-primary"})}),o.jsx("h3",{className:"text-lg font-semibold mb-2 text-center",children:t}),o.jsx("p",{className:"text-muted-foreground text-center max-w-md",children:e})]})})}function _r(t){const e=Object.prototype.toString.call(t);return t instanceof Date||typeof t=="object"&&e==="[object Date]"?new t.constructor(+t):typeof t=="number"||e==="[object Number]"||typeof t=="string"||e==="[object String]"?new Date(t):new Date(NaN)}function zh(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}const Xve=6048e5,NDt=864e5,oC=43200,KZ=1440;let jDt={};function yN(){return jDt}function Z_(t,e){var l,c,u,d;const n=yN(),r=(e==null?void 0:e.weekStartsOn)??((c=(l=e==null?void 0:e.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??n.weekStartsOn??((d=(u=n.locale)==null?void 0:u.options)==null?void 0:d.weekStartsOn)??0,i=_r(t),s=i.getDay(),a=(s<r?7:0)+s-r;return i.setDate(i.getDate()-a),i.setHours(0,0,0,0),i}function rA(t){return Z_(t,{weekStartsOn:1}
4961)}function Qve(t){const e=_r(t),n=e.getFullYear(),r=zh(t,0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);const i=rA(r),s=zh(t,0);s.setFullYear(n,0,4),s.setHours(0,0,0,0);const a=rA(s);return e.getTime()>=i.getTime()?n+1:e.getTime()>=a.getTime()?n:n-1}function YZ(t){const e=_r(t);return e.setHours(0,0,0,0),e}function iA(t){const e=_r(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function CDt(t,e){const n=YZ(t),r=YZ(e),i=+n-iA(n),s=+r-iA(r);return Math.round((i-s)/NDt)}function kDt(t){const e=Qve(t),n=zh(t,0);return n.setFullYear(e,0,4),n.setHours(0,0,0,0),rA(n)}function pk(t,e){const n=_r(t),r=_r(e),i=n.getTime()-r.getTime();return i<0?-1:i>0?1:i}function EDt(t){return zh(t,Date.now())}function ADt(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function TDt(t){if(!ADt(t)&&typeof t!="number")return!1;const e=_r(t);return!isNaN(Number(e))}function MDt(t,e){const n=_r(t),r=_r(e),i=n.getFullYear()-r.getFullYear(),s=n.getMonth()-r.getMonth();return i*12+s}function PDt(t){return e=>{const r=(t?Math[t]:Math.trunc)(e);return r===0?0:r}}function ODt(t,e){return+_r(t)-+_r(e)}function RDt(t){const e=_r(t);return e.setHours(23,59,59,999),e}function IDt(t){const e=_r(t),n=e.getMonth();return e.setFullYear(e.getFullYear(),n+1,0),e.setHours(23,59,59,999),e}function DDt(t){const e=_r(t);return+RDt(e)==+IDt(e)}function LDt(t,e){const n=_r(t),r=_r(e),i=pk(n,r),s=Math.abs(MDt(n,r));let a;if(s<1)a=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-i*s);let l=pk(n,r)===-i;DDt(_r(t))&&s===1&&pk(t,r)===1&&(l=!1),a=i*(s-Number(l))}return a===0?0:a}function $Dt(t,e,n){const r=ODt(t,e)/1e3;return PDt(n==null?void 0:n.roundingMethod)(r)}function FDt(t){const e=_r(t),n=zh(t,0);return n.setFullYear(e.getFullYear(),0,1),n.setHours(0,0,0,0),n}const UDt={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"}},zDt=(t,e,n)=>{let r;const i=UDt[t];return typeof i=="string"?r=i:e===1?r=i.one:r=i.other.replace("{{count}}",e.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function O3(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const BDt={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},VDt={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},HDt={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},WDt={date:O3({formats:BDt,defaultWidth:"full"}),time:O3({formats:VDt,defaultWidth:"full"}),dateTime:O3({formats:HDt,defaultWidth:"full"})},GDt={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},qDt=(t,e,n,r)=>GDt[t];function Jb(t){return(e,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let i;if(r==="formatting"&&t.formattingValues){const a=t.defaultFormattingWidth||t.defaultWidth,l=n!=null&&n.width?String(n.width):a;i=t.formattingValues[l]||t.formattingValues[a]}else{const a=t.defaultWidth,l=n!=null&&n.width?String(n.width):t.defaultWidth;i=t.values[l]||t.values[a]}const s=t.argumentCallback?t.argumentCallback(e):e;return i[s]}}const KDt={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},YDt={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},XDt={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"]},QDt={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","Frid
4961ay","Saturday"]},JDt={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"}},ZDt={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"}},e4t=(t,e)=>{const n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},t4t={ordinalNumber:e4t,era:Jb({values:KDt,defaultWidth:"wide"}),quarter:Jb({values:YDt,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Jb({values:XDt,defaultWidth:"wide"}),day:Jb({values:QDt,defaultWidth:"wide"}),dayPeriod:Jb({values:JDt,defaultWidth:"wide",formattingValues:ZDt,defaultFormattingWidth:"wide"})};function Zb(t){return(e,n={})=>{const r=n.width,i=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],s=e.match(i);if(!s)return null;const a=s[0],l=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],c=Array.isArray(l)?r4t(l,f=>f.test(a)):n4t(l,f=>f.test(a));let u;u=t.valueCallback?t.valueCallback(c):c,u=n.valueCallback?n.valueCallback(u):u;const d=e.slice(a.length);return{value:u,rest:d}}}function n4t(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function r4t(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return n}function i4t(t){return(e,n={})=>{const r=e.match(t.matchPattern);if(!r)return null;const i=r[0],s=e.match(t.parsePattern);if(!s)return null;let a=t.valueCallback?t.valueCallback(s[0]):s[0];a=n.valueCallback?n.valueCallback(a):a;const l=e.slice(i.length);return{value:a,rest:l}}}const s4t=/^(\d+)(th|st|nd|rd)?/i,a4t=/\d+/i,o4t={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},l4t={any:[/^b/i,/^(a|c)/i]},c4t={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},u4t={any:[/1/i,/2/i,/3/i,/4/i]},d4t={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},f4t={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]},h4t={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},p4t={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]},m4t={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},g4t={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}},x4t={ordinalNumber:i4t({matchPattern:s4t,parsePattern:a4t,valueCallback:t=>parseInt(t,10)}),era:Zb({matchPatterns:o4t,defaultMatchWidth:"wide",parsePatterns:l4t,defaultParseWidth:"any"}),quarter:Zb({matchPatterns:c4t,defaultMatchWidth:"wide",parsePatterns:u4t,defaultParseWidth:"any",valueCallback:t=>t+1}),month:Zb({matchPatterns:d4t,defaultMatchWidth:"wide",parsePatterns:f4t,defaultParseWidth:"any"}
vendor: 11,389 bytes, line 4961
4961),day:Zb({matchPatterns:h4t,defaultMatchWidth:"wide",parsePatterns:p4t,defaultParseWidth:"any"}),dayPeriod:Zb({matchPatterns:m4t,defaultMatchWidth:"any",parsePatterns:g4t,defaultParseWidth:"any"})},Jve={code:"en-US",formatDistance:zDt,formatLong:WDt,formatRelative:qDt,localize:t4t,match:x4t,options:{weekStartsOn:0,firstWeekContainsDate:1}};function y4t(t){const e=_r(t);return CDt(e,FDt(e))+1}function v4t(t){const e=_r(t),n=+rA(e)-+kDt(e);return Math.round(n/Xve)+1}function Zve(t,e){var d,f,h,p;const n=_r(t),r=n.getFullYear(),i=yN(),s=(e==null?void 0:e.firstWeekContainsDate)??((f=(d=e==null?void 0:e.locale)==null?void 0:d.options)==null?void 0:f.firstWeekContainsDate)??i.firstWeekContainsDate??((p=(h=i.locale)==null?void 0:h.options)==null?void 0:p.firstWeekContainsDate)??1,a=zh(t,0);a.setFullYear(r+1,0,s),a.setHours(0,0,0,0);const l=Z_(a,e),c=zh(t,0);c.setFullYear(r,0,s),c.setHours(0,0,0,0);const u=Z_(c,e);return n.getTime()>=l.getTime()?r+1:n.getTime()>=u.getTime()?r:r-1}function b4t(t,e){var l,c,u,d;const n=yN(),r=(e==null?void 0:e.firstWeekContainsDate)??((c=(l=e==null?void 0:e.locale)==null?void 0:l.options)==null?void 0:c.firstWeekContainsDate)??n.firstWeekContainsDate??((d=(u=n.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??1,i=Zve(t,e),s=zh(t,0);return s.setFullYear(i,0,r),s.setHours(0,0,0,0),Z_(s,e)}function w4t(t,e){const n=_r(t),r=+Z_(n,e)-+b4t(n,e);return Math.round(r/Xve)+1}function er(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}const uf={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return er(e==="yy"?r%100:r,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):er(n+1,2)},d(t,e){return er(t.getDate(),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(t,e){return er(t.getHours()%12||12,e.length)},H(t,e){return er(t.getHours(),e.length)},m(t,e){return er(t.getMinutes(),e.length)},s(t,e){return er(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),i=Math.trunc(r*Math.pow(10,n-3));return er(i,e.length)}},Mx={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},XZ={G:function(t,e,n){const r=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const r=t.getFullYear(),i=r>0?r:1-r;return n.ordinalNumber(i,{unit:"year"})}return uf.y(t,e)},Y:function(t,e,n,r){const i=Zve(t,r),s=i>0?i:1-i;if(e==="YY"){const a=s%100;return er(a,2)}return e==="Yo"?n.ordinalNumber(s,{unit:"year"}):er(s,e.length)},R:function(t,e){const n=Qve(t);return er(n,e.length)},u:function(t,e){const n=t.getFullYear();return er(n,e.length)},Q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return er(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return er(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,n){const r=t.getMonth();switch(e){case"M":case"MM":return uf.M(t,e);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,n){const r=t.getMonth();switch(e){case"L":return String(r+1);case"LL":return er(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,n,r){const i=w4t(t,r);return e==="wo"?n.ordinalNumber(i,{unit:"week"}):er(i,e.length)},I:function(t,e,n){const r=v4t(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):er(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):uf.d(t,e)},D:function(t,e,n){const r=y4t(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):er(r,e.length)},E:function(t,e,n){const r=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,n,r){const i=t.getDay(),s=(i-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(s);case"ee":return er(s,2);case"eo":return n.ordinalNumber(s,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});case"eeee":default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){const i=t.getDay(),s=(i-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(s);case"cc":return er(s,e.length);case"co":return n.ordinalNumber(s,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});case"cccc":default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(t,e,n){const r=t.getDay(),i=r===0?7:r;switch(e){case"i":return String(i);case"ii":return er(i,e.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,n){const i=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(t,e,n){const r=t.getHours();let i;switch(r===12?i=Mx.noon:r===0?i=Mx.midnight:i=r/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(t,e,n){const r=t.getHours();let i;switch(r>=17?i=Mx.evening:r>=12?i=Mx.afternoon:r>=4?i=Mx.morning:i=Mx.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let r=t.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return uf.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):uf.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):er(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):er(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):uf.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):uf.s(t,e)},S:function(t,e){return uf.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return JZ(r);case"XXXX":case"XX":return Lp(r);case"XXXXX":case"XXX":default:return Lp(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return JZ(r);case"xxxx":case"xx":return Lp(r);case"xxxxx":case"xxx":default:return Lp(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+QZ(r,":");case"OOOO":default:return"GMT"+Lp(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+QZ(r,":");case"zzzz":default:return"GMT"+Lp(r,":")}},t:function(t,e,n){const r=Math.trunc(t.getTime()/1e3);return er(r,e.length)},T:function(t,e,n){const r=t.getTime();return er(r,e.length)}};function QZ(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),i=Math.trunc(r/60),s=r%60;return s===0?n+String(i):n+String(i)+e+er(s,2)}function JZ(t,e){return t%60===0?(t>0?"-":"+")+er(Math.abs(t)/60,2):Lp(t,e)}function Lp(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),i=er(Math.trunc(r/60),2),s=er(r%60,2);return n+i+e+s}const ZZ=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},e0e=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},_4t=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return ZZ(t,e);let s;switch(r){case"P":s=e.dateTime({width:"short"});break;case"PP":s=e.dateTime({width:"medium"});break;case"PPP":s=e.dateTime({width:"long"});break;case"PPPP":default:s=e.dateTime({width:"full"});break}return s.replace("{{date}}",ZZ(r,e)).replace("{{time}}",e0e(i,e))},S4t={p:e0e,P:_4t},N4t=/^D+$/,j4t=/^Y+$/,C4t=["D","DD","YY","YYYY"];function k4t(t){return N4t.test(t)}function E4t(t){return j4t.test(t)}function A4t(t,e,n){const r=T4t(t,e,n);if(console.warn(r),C4t.includes(t))throw new RangeError(r)}function T4t(t,e,n){const r=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const M4t=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,P4t=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,O4t=/^'([^]*?)'?$/,R4t=/''/g,I4t=/[a-zA-Z]/;function D4t(t,e,n){var d,f,h,p;const r=yN(),i=r.locale??Jve,s=r.firstWeekContainsDate??((f=(d=r.locale)==null?void 0:d.options)==null?void 0:f.firstWeekContainsDate)??1,a=r.weekStartsOn??((p=(h=r.locale)==null?void 0:h.options)==null?void 0:p.weekStartsOn)??0,l=_r(t);if(!TDt(l))throw new RangeError("Invalid time value");let c=e.match(P4t).map(m=>{const x=m[0];if(x==="p"||x==="P"){const y=S4t[x];return y(m,i.formatLong)}return m}).join("").match(M4t).map(m=>{if(m==="''")return{isToken:!1,value:"'"};const x=m[0];if(x==="'")return{isToken:!1,value:L4t(m)};if(XZ[x])return{isToken:!0,value:m};
4961if(x.match(I4t))throw new RangeError("Format string contains an unescaped latin alphabet character `"+x+"`");return{isToken:!1,value:m}});i.localize.preprocessor&&(c=i.localize.preprocessor(l,c));const u={firstWeekContainsDate:s,weekStartsOn:a,locale:i};return c.map(m=>{if(!m.isToken)return m.value;const x=m.value;(E4t(x)||k4t(x))&&A4t(x,e,String(t));const y=XZ[x[0]];return y(l,x,i.localize,u)}).join("")}function L4t(t){const e=t.match(O4t);return e?e[1].replace(R4t,"'"):t}function $4t(t,e,n){const r=yN(),i=(n==null?void 0:n.locale)??r.locale??Jve,s=2520,a=pk(t,e);if(isNaN(a))throw new RangeError("Invalid time value");const l=Object.assign({},n,{addSuffix:n==null?void 0:n.addSuffix,comparison:a});let c,u;a>0?(c=_r(e),u=_r(t)):(c=_r(t),u=_r(e));const d=$Dt(u,c),f=(iA(u)-iA(c))/1e3,h=Math.round((d-f)/60);let p;if(h<2)return n!=null&&n.includeSeconds?d<5?i.formatDistance("lessThanXSeconds",5,l):d<10?i.formatDistance("lessThanXSeconds",10,l):d<20?i.formatDistance("lessThanXSeconds",20,l):d<40?i.formatDistance("halfAMinute",0,l):d<60?i.formatDistance("lessThanXMinutes",1,l):i.formatDistance("xMinutes",1,l):h===0?i.formatDistance("lessThanXMinutes",1,l):i.formatDistance("xMinutes",h,l);if(h<45)return i.formatDistance("xMinutes",h,l);if(h<90)return i.formatDistance("aboutXHours",1,l);if(h<KZ){const m=Math.round(h/60);return i.formatDistance("aboutXHours",m,l)}else{if(h<s)return i.formatDistance("xDays",1,l);if(h<oC){const m=Math.round(h/KZ);return i.formatDistance("xDays",m,l)}else if(h<oC*2)return p=Math.round(h/oC),i.formatDistance("aboutXMonths",p,l)}if(p=LDt(u,c),p<12){const m=Math.round(h/oC);return i.formatDistance("xMonths",m,l)}else{const m=p%12,x=Math.trunc(p/12);return m<3?i.formatDistance("aboutXYears",x,l):m<9?i.formatDistance("overXYears",x,l):i.formatDistance("almostXYears",x+1,l)}}function d9(t,e){return $4t(t,EDt(t),e)}function F4t(t,e=[]){let n=[];function r(s,a){const l=b.createContext(a),c=n.length;n=[...n,a];const u=f=>{var g;const{scope:h,children:p,...m}=f,x=((g=h==null?void 0:h[t])==null?void 0:g[c])||l,y=b.useMemo(()=>m,Object.values(m));return o.jsx(x.Provider,{value:y,children:p})};u.displayName=s+"Provider";function d(f,h){var x;const p=((x=h==null?void 0:h[t])==null?void 0:x[c])||l,m=b.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[u,d]}const i=()=>{const s=n.map(a=>b.createContext(a));return function(l){const c=(l==null?void 0:l[t])||s;return b.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return i.scopeName=t,[r,U4t(i,...e)]}function U4t(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const a=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...l,...f}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return n.scopeName=e.scopeName,n}function z4t(t){const e=B4t(t),n=b.forwardRef((r,i)=>{const{children:s,...a}=r,l=b.Children.toArray(s),c=l.find(H4t);if(c){const u=c.props.children,d=l.map(f=>f===c?b.Children.count(u)>1?b.Children.only(null):b.isValidElement(u)?u.props.children:null:f);return o.jsx(e,{...a,ref:i,children:b.isValidElement(u)?b.cloneElement(u,void 0,d):null})}return o.jsx(e,{...a,ref:i,children:s})});return n.displayName=`${t}.Slot`,n}function B4t(t){const e=b.forwardRef((n,r)=>{const{children:i,...s}=n;if(b.isValidElement(i)){const a=G4t(i),l=W4t(s,i.props);return i.type!==b.Fragment&&(l.ref=r?Ir(r,a):a),b.cloneElement(i,l)}return b.Children.count(i)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var V4t=Symbol("radix.slottable");function H4t(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===V4t}function W4t(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...l)=>{const c=s(...l);return i(...l),c}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function G4t(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.
4961isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var q4t=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],aO=q4t.reduce((t,e)=>{const n=z4t(`Primitive.${e}`),r=b.forwardRef((i,s)=>{const{asChild:a,...l}=i,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),oO="Tabs",[K4t]=F4t(oO,[qM]),t0e=qM(),[Y4t,f9]=K4t(oO),n0e=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:s,orientation:a="horizontal",dir:l,activationMode:c="automatic",...u}=t,d=GM(l),[f,h]=su({prop:r,onChange:i,defaultProp:s??"",caller:oO});return o.jsx(Y4t,{scope:n,baseId:ys(),value:f,onValueChange:h,orientation:a,dir:d,activationMode:c,children:o.jsx(aO.div,{dir:d,"data-orientation":a,...u,ref:e})})});n0e.displayName=oO;var r0e="TabsList",i0e=b.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...i}=t,s=f9(r0e,n),a=t0e(n);return o.jsx(khe,{asChild:!0,...a,orientation:s.orientation,dir:s.dir,loop:r,children:o.jsx(aO.div,{role:"tablist","aria-orientation":s.orientation,...i,ref:e})})});i0e.displayName=r0e;var s0e="TabsTrigger",a0e=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...s}=t,a=f9(s0e,n),l=t0e(n),c=c0e(a.baseId,r),u=u0e(a.baseId,r),d=r===a.value;return o.jsx(Ehe,{asChild:!0,...l,focusable:!i,active:d,children:o.jsx(aO.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:c,...s,ref:e,onMouseDown:at(t.onMouseDown,f=>{!i&&f.button===0&&f.ctrlKey===!1?a.onValueChange(r):f.preventDefault()}),onKeyDown:at(t.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&a.onValueChange(r)}),onFocus:at(t.onFocus,()=>{const f=a.activationMode!=="manual";!d&&!i&&f&&a.onValueChange(r)})})})});a0e.displayName=s0e;var o0e="TabsContent",l0e=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:i,children:s,...a}=t,l=f9(o0e,n),c=c0e(l.baseId,r),u=u0e(l.baseId,r),d=r===l.value,f=b.useRef(d);return b.useEffect(()=>{const h=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(h)},[]),o.jsx(Na,{present:i||d,children:({present:h})=>o.jsx(aO.div,{"data-state":d?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!h,id:u,tabIndex:0,...a,ref:e,style:{...t.style,animationDuration:f.current?"0s":void 0},children:h&&s})})});l0e.displayName=o0e;function c0e(t,e){return`${t}-trigger-${e}`}function u0e(t,e){return`${t}-content-${e}`}var X4t=n0e,d0e=i0e,f0e=a0e,h0e=l0e;const J0=X4t,Bg=b.forwardRef(({className:t,...e},n)=>o.jsx(d0e,{ref:n,className:ne("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...e}));Bg.displayName=d0e.displayName;const pi=b.forwardRef(({className:t,...e},n)=>o.jsx(f0e,{ref:n,className:ne("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",t),...e}));pi.displayName=f0e.displayName;const my=b.forwardRef(({className:t,...e},n)=>o.jsx(h0e,{ref:n,className:ne("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));my.displayName=h0e.displayName;const R3=t=>{const e={"blog-post":"blog post",blog_post:"blog post","how-to":"how-to guide",how_to:"how-to guide",comparison:"comparison","case-study":"case study",case_study:"case study",listicle:"listicle",guide:"guide",tutorial:"tutorial",faq:"FAQ","landing-page":"landing page",landing_page:"landing page","product-page":"product page",product_page:"product page","topic-guide":"topic guide",topic_guide:"topic guide",review:"review",checklist:"checklist"};let n=t;for(const[r,i]of Object.entries(e))n=n.replace(new RegExp(r,"gi"),i);return n},eee={critical:"bg-red-500/20 text-red-500",high:"bg-orange-500/20 text-orange-500",medium:"bg-yellow-500/20 text-yellow-500",low:"bg-emerald-500/20 text-emerald-500"},tee={critical:0,high:1,medium:2,low:3},Q4t={low:"bg-emerald-500/20 text-emerald-500",medium:"bg-amber-500/20 text-amber-500",high:"bg-red-500/20 text-red-500"},J4t={platform:"bg-blue-500/20 text-blue-500",technical:"bg-violet-500/20 text-violet-500",content:"bg-emerald-500/20 text-emerald-500",queries:"bg-orange-500/20 text-orange-500",competitor:"bg-pink-500/20 text-pink-500"},Z4t={platform:wT,technical:bo,content:Ao,queries:iu,competitor:uc};function nee({label:t,score:e,icon:n,description:r,embedded:i}){return o.jsx(on,{children:o.jsxs(Ft,{children:[o.jsx(Ut,{asChild:!0,children:o.jsxs("div",{className:ne("flex items-center gap-3 cursor-help",i?"p-0":"p-3 rounded-lg border bg-card"),children:[o.jsx(nr,{value:e??0,size:"lg",variant:"percentage"}),o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center gap-1.5 text-sm font-medium",children:[o.jsx(n,{className:"h-3.5 w-3.5 text-muted-foreground"}),t]}),o.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:e!==null?`${e}/100`:"Not audited"})]})]})}),o.jsx(zt,{children:o.jsx("p",{className:"max-w-xs",children:r})})]})})}function eLt(){var C,k,M,I;const{companyId:t}=Gr(),e=Sa(),[n,r]=b.useState("all"),[i,s]=b.useState(null),[a,l]=b.useState(1),c=5,u=_S(t),{data:d,isLoading:f}=En({queryKey:["site-health",t],queryFn:async()=>await Ce.get(`/companies/${t}/site-health`),enabled:!!t}),{data:h,isLoading:p}=En({queryKey:["opportunity-tasks",t,n],queryFn:async()=>{const R=n==="all"?"":n;return await Ce.get(`/companies/${t}/opportunity-tasks?status=pending&limit=50${R?`&bucket=${R}`:""}`)},enabled:!!t}),m=(h==null?void 0:h.data)||[],{data:x}=En({queryKey:["opportunity-task-counts",t],queryFn:async()=>Ce.get(`/companies/${t}/opportunity-tasks/counts`),enabled:!!t}),y=(i==null?void 0:i.signal_type)==="content_type_gap"&&((C=i.metadata)==null?void 0:C.articleType)||null,{data:g,isLoading:w}=En({queryKey:["related-sources",t,y],queryFn:async()=>{const R=new URLSearchParams({startDate:new Date(Date.now()-2592e6).toISOString().split("T")[0],endDate:new Date().toISOString().split("T")[0],limit:"5",offset:"0"});return y&&R.set("contentType",y),await Ce.get(`/companies/${t}/analytics/sources/urls?${R.toString()}`)},enabled:!!t&&!!y}),v=un({mutationFn:async()=>{await Ce.post(`/companies/${t}/opportunity-tasks/generate`)},onSuccess:()=>
4961{ge.success("Opportunities refreshed"),e.invalidateQueries({queryKey:["opportunity-tasks",t]}),e.invalidateQueries({queryKey:["opportunity-task-counts",t]})},onError:R=>{ge.error(R.message||"Failed to refresh opportunities")}}),N=un({mutationFn:async({taskId:R,status:E})=>{await Ce.patch(`/companies/${t}/opportunity-tasks/${R}`,{status:E})},onSuccess:()=>{ge.success("Status updated"),e.invalidateQueries({queryKey:["opportunity-tasks",t]}),e.invalidateQueries({queryKey:["opportunity-task-counts",t]})}}),S=b.useMemo(()=>m?[...m].sort((R,E)=>tee[R.impact]-tee[E.impact]):[],[m]);b.useEffect(()=>{S.length>0&&!i&&(s(S[0]),l(1))},[S,i]),b.useEffect(()=>{i&&S.length>0&&(S.some(E=>E.id===i.id)||(s(S[0]),l(1)))},[S,i==null?void 0:i.id]);const _=R=>{if(R.description)return R3(R.description);if(R.next_steps&&R.next_steps.length>0){const E=R.next_steps.map(O=>R3(O.text).toLowerCase());if(E.length===1)return E[0].charAt(0).toUpperCase()+E[0].slice(1)+".";const P=E.pop();return E.join(", ")+", and "+P+"."}return""},j=u.hasOpportunitiesData||m.length>0,A=!j&&(u.isSetupRunning||u.isInitialLoad);return o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Opportunities",noIndex:!0}),o.jsxs("div",{className:"flex flex-col min-h-full h-full overflow-y-auto",children:[A&&o.jsx(u9,{title:"Finding Opportunities",description:"We're analyzing your company and website to find opportunities for improving your AI visibility. This usually takes a few moments."}),!j&&!A&&!f&&!p&&o.jsx(Dt,{children:o.jsxs(Vt,{className:"flex flex-col items-center justify-center py-12",children:[o.jsx(Zu,{className:"h-12 w-12 text-muted-foreground mb-4"}),o.jsx("h3",{className:"text-lg font-medium mb-2",children:"No opportunities yet"}),o.jsx("p",{className:"text-muted-foreground text-center max-w-md mb-6",children:"Run a site health audit to discover opportunities for improving your AI discoverability."}),o.jsxs("div",{className:"flex gap-3",children:[o.jsx(le,{asChild:!0,children:o.jsxs(Mt,{to:`/company/${t}/site-health`,children:[o.jsx(Zu,{className:"h-4 w-4 mr-2"}),"Go to Site Health"]})}),o.jsxs(le,{variant:"outline",onClick:()=>v.mutate(),children:[o.jsx(ws,{className:"h-4 w-4 mr-2"}),"Generate Opportunities"]})]})]})}),(j||m.length>0)&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-4 py-3 border-b bg-background px-6 sticky top-0 z-10",children:[o.jsx(J0,{value:n,onValueChange:R=>{r(R),s(null)},children:o.jsxs(Bg,{children:[o.jsxs(pi,{value:"all",children:["All Opportunities",x&&x.pending>0&&o.jsx(Ge,{variant:"secondary",className:"ml-2",children:x.pending})]}),o.jsx(pi,{value:"on-page",children:"On-Page"}),o.jsx(pi,{value:"off-page",children:"Off-Page"})]})}),o.jsx(on,{children:o.jsxs(Ft,{children:[o.jsx(Ut,{asChild:!0,children:o.jsxs(le,{variant:"outline",size:"sm",onClick:()=>v.mutate(),disabled:v.isPending,children:[v.isPending?o.jsx(Me,{className:"h-4 w-4 animate-spin"}):o.jsx(ws,{className:"h-4 w-4"}),"Refresh"]})}),o.jsx(zt,{children:"Regenerate opportunities from latest data"})]})})]}),o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-px bg-border shrink-0 border-b",children:[o.jsxs("div",{className:"flex items-center gap-3 px-6 py-4 bg-card",children:[o.jsx("div",{className:"flex items-center justify-center h-10 w-10 rounded-md bg-red-500/20 shrink-0",children:o.jsx(ll,{className:"h-5 w-5 text-red-500"})}),o.jsxs("div",{children:[o.jsx("span",{className:"font-bold",children:S.filter(R=>R.impact==="critical").length}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Critical issues"})]})]}),o.jsx("div",{className:"px-6 py-4 bg-card flex items-center",children:o.jsx(nee,{label:"Health",score:(d==null?void 0:d.scores.overall)??null,icon:Zu,description:"Overall health score combining technical, content, and AEO metrics",embedded:!0})}),o.jsx("div",{className:"px-6 py-4 bg-card flex items-center",children:o.jsx(nee,{label:"AEO",score:(d==null?void 0:d.scores.aeo)??null,icon:pr,description:"AI Engine Optimization score for LLM visibility and citations",embedded:!0})}),o.jsxs("div",{className:"flex items-center gap-3 px-6 py-4 bg-card",children:[o.jsx("div",{className:"flex items-center justify-center h-10 w-10 rounded-md bg-emerald-500/20 shrink-0",children:o.jsx(wg,{className:"h-5 w-5 text-emerald-600"})}),o.jsxs("div",{children:[o.jsx("span",{className:"font-bold",children:(x==null?void 0:x.completed)||0}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Completed"})]})]})]}),p?o.jsx("div",{className:"flex flex-1 items-center justify-center px-6",children:o.jsx(Me,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):o.jsxs("div",{className:"flex flex-1 min-h-0 ",children:[o.jsxs("div",{className:"w-[calc(25%+0.5px)] flex-shrink-0 flex flex-col border-r overflow-hidden",children:[o.jsx("div",{className:"h-12 border-b px-4 py-2.5 shrink-0 flex items-center",children:o.jsxs("div",{className:"flex items-center justify-between w-full",children:[o.jsx("span",{className:"w-8 text-xs font-medium text-muted-foreground uppercase",children:"#"}),o.jsx("span",{className:"flex-1 text-xs font-medium text-muted-foreground uppercase",children:"Opportunity"}),o.jsx("span",{className:"w-20 text-xs font-medium text-muted-foreground uppercase text-right",children:"Impact"})]})}),o.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:S.length===0?o.jsxs("div",{className:"flex flex-col items-center justify-center h-full px-4 text-center",children:[o.jsx("p",{className:"text-sm font-medium",children:"No opportunities found"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Come back later."})]}):S.map((R,E)=>{const P=(i==null?void 0:i.id)===R.id,O=Z4t[R.category]||Zu;return o.jsxs("button",{onClick:()=>{s(R),l(1)},className:ne("w-full flex items-center gap-3 px-4 py-3 text-left transition-all border-b border-border/50 last:border-b-0",P?"bg-muted":"hover:bg-muted/50"),children:[o.jsx("span",{className:"w-6 text-[11px] font-medium tabular-nums flex-shrink-0 text-muted-foreground",children:E+1}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(O,{className:"h-3.5 w-3.5 text-muted-foreground flex-shrink-0"}),o.jsx("p",{className:"text-[13px] truncate font-medium text-foreground",children:R.title})]}),R.description&&o.jsx("p",{className:"text-[11px] mt-0.5 line-clamp-1 text-muted-foreground",children:R.description})]}),o.jsx("span",{className:"flex-shrink-0",children:o.jsx("span",{className:ne("inl
4961ine-block px-2 py-0.5 rounded text-[10px] font-medium border",eee[R.impact]),children:R.impact.charAt(0).toUpperCase()+R.impact.slice(1)})})]},R.id)})})]}),o.jsx("div",{className:"flex-1 min-w-0 flex flex-col overflow-hidden",children:S.length===0?o.jsx("div",{className:"flex flex-1 min-h-0 items-center justify-center p-8",children:o.jsxs("div",{className:"flex flex-col items-center justify-center",children:[o.jsx("h3",{className:"text-lg font-medium mb-2",children:"So far, so good!"}),o.jsx("p",{className:"text-muted-foreground text-center max-w-md mb-6",children:n!=="all"?`No ${n} opportunities at the moment.`:"There are no pending opportunities right now."})]})}):i?o.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[o.jsxs("div",{className:"p-6 pb-5",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-4 mb-4",children:[o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:"Type:"}),o.jsx("span",{className:ne("text-xs px-2 py-0.5 rounded font-medium",J4t[i.category]),children:i.category.charAt(0).toUpperCase()+i.category.slice(1)})]}),o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:"Priority:"}),o.jsx("span",{className:ne("text-xs px-2 py-0.5 rounded font-medium border",eee[i.impact]),children:i.impact.charAt(0).toUpperCase()+i.impact.slice(1)})]}),i.effort&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:"Effort:"}),o.jsx("span",{className:ne("px-2 py-0.5 text-xs font-medium rounded",Q4t[i.effort]),children:i.effort.charAt(0).toUpperCase()+i.effort.slice(1)})]}),o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:"Created:"}),o.jsx("span",{className:"text-xs",children:D4t(new Date(i.created_at),"MMM d, yyyy")})]})]}),o.jsx("p",{className:"text-sm text-muted-foreground mb-4 leading-relaxed",children:_(i)}),o.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[i.action_url&&i.action_label&&!i.action_url.includes("filter=")&&o.jsx(le,{size:"sm",variant:"default",asChild:!0,children:o.jsxs(Mt,{to:i.action_url.replace("__COMPANY_ID__",t||""),children:[i.action_label,o.jsx(Ai,{className:"h-4 w-4 ml-1"})]})}),o.jsxs(le,{variant:"outline",size:"sm",onClick:()=>N.mutate({taskId:i.id,status:"completed"}),children:[o.jsx(bT,{className:"h-4 w-4 mr-1"}),"Done"]}),o.jsx(le,{variant:"ghost",size:"sm",onClick:()=>N.mutate({taskId:i.id,status:"dismissed"}),children:"Dismiss"})]}),i.signal_type.startsWith("technical_issues")&&Array.isArray((k=i.metadata)==null?void 0:k.issues)&&o.jsxs("div",{className:"space-y-3 mb-4",children:[o.jsx("h4",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Issues to Fix"}),o.jsx("div",{className:"space-y-3",children:i.metadata.issues.slice(0,5).map((R,E)=>o.jsxs("div",{className:"border rounded-lg overflow-hidden",children:[o.jsxs("div",{className:"p-3 bg-muted/30",children:[o.jsxs("div",{className:"flex items-start justify-between gap-2 mb-1",children:[o.jsx("span",{className:"text-sm font-medium",children:R.name}),o.jsxs(Ge,{variant:"secondary",className:"text-xs flex-shrink-0",children:[R.count," ",R.count===1?"page":"pages"]})]}),R.fixRecommendation&&o.jsx("p",{className:"text-xs text-muted-foreground",children:R.fixRecommendation})]}),R.pages&&R.pages.length>0&&o.jsxs("div",{className:"divide-y divide-border",children:[R.pages.slice(0,5).map((P,O)=>o.jsxs(Mt,{to:`/company/${t}/site-health/page/${P.pageId}?from_page=opportunities`,className:"flex items-center gap-2 px-3 py-2 hover:bg-muted/50 transition-colors group",children:[o.jsx(Ao,{className:"h-3.5 w-3.5 text-muted-foreground flex-shrink-0"}),o.jsx("span",{className:"text-sm truncate flex-1 group-hover:text-primary",children:P.title||P.path||"/"}),o.jsx("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:P.path||"/"}),o.jsx(Wr,{className:"h-3 w-3 text-muted-foreground opacity-0 group-hover:opacity-100 flex-shrink-0"})]},O)),R.pages.length>5&&o.jsxs("div",{className:"px-3 py-2 text-xs text-muted-foreground bg-muted/20",children:["+",R.pages.length-5," more pages affected"]})]})]},E))})]}),(i.signal_type==="queries_zero_visibility"||i.signal_type==="queries_over_capacity")&&Array.isArray((M=i.metadata)==null?void 0:M.zeroMentionQueries)&&o.jsxs("div",{className:"space-y-3 mb-4",children:[o.jsx("h4",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Queries with Zero Mentions"}),o.jsxs("div",{className:"rounded-md border overflow-hidden",children:[o.jsxs("table",{className:"w-full card-table",children:[o.jsx("thead",{className:"bg-muted/50",children:o.jsxs("tr",{children:[o.jsx("th",{className:"px-3 py-2 text-left text-xs font-medium text-muted-foreground uppercase",children:"Visibility"}),o.jsx("th",{className:"px-3 py-2 text-left text-xs font-medium text-muted-foreground uppercase",children:"Query"})]})}),o.jsx("tbody",{className:"divide-y divide-border",children:i.metadata.zeroMentionQueries.slice(0,8).map((R,E)=>o.jsxs("tr",{className:"hover:bg-muted/50",children:[o.jsx("td",{className:"px-3 py-2 whitespace-nowrap",children:o.jsx(nr,{value:0,size:"sm",variant:"percentage"})}),o.jsx("td",{className:"px-3 py-2",children:o.jsx(Mt,{to:`/company/${t}/prompts/${R.id}`,className:"text-sm hover:underline hover:text-primary line-clamp-2",children:R.text})})]},E))})]}),i.metadata.zeroMentionQueries.length>8&&o.jsxs("div",{className:"px-3 py-2 text-xs text-muted-foreground bg-muted/20 border-t",children:["+",i.metadata.zeroMentionQueries.length-8," more queries with zero mentions"]})]})]}),i.signal_type==="content_type_gap"&&o.jsxs("div",{className:"space-y-3 mb-4",children:[o.jsxs("h4",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:["Top ",R3(String(((I=i.metadata)==null?void 0:I.articleType)||""))," Sources from C
4961ompetitors"]}),w?o.jsx("div",{className:"flex items-center justify-center py-8",children:o.jsx(Me,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):g!=null&&g.items&&g.items.length>0?o.jsx("div",{className:"rounded-md border overflow-hidden",children:o.jsxs("table",{className:"w-full card-table",children:[o.jsx("thead",{className:"bg-muted/50",children:o.jsxs("tr",{children:[o.jsx("th",{className:"px-3 py-2 text-left text-xs font-medium text-muted-foreground uppercase w-10",children:"#"}),o.jsx("th",{className:"px-3 py-2 text-left text-xs font-medium text-muted-foreground uppercase",children:"Page"}),o.jsx("th",{className:"px-3 py-2 text-right text-xs font-medium text-muted-foreground uppercase w-20",children:"Citations"})]})}),o.jsx("tbody",{className:"divide-y divide-border",children:g.items.map((R,E)=>o.jsxs("tr",{className:"hover:bg-muted/50",children:[o.jsx("td",{className:"px-3 py-2 text-sm text-muted-foreground",children:R.rank}),o.jsx("td",{className:"px-3 py-2",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("img",{src:`https://www.google.com/s2/favicons?domain=${R.domain}&sz=32`,alt:"",className:"h-4 w-4 rounded flex-shrink-0"}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("a",{href:R.url,target:"_blank",rel:"noopener noreferrer",className:"text-sm font-medium hover:underline hover:text-primary line-clamp-1 flex items-center gap-1",children:[R.title||R.url,o.jsx(Wr,{className:"h-3 w-3 text-muted-foreground flex-shrink-0"})]}),o.jsx("p",{className:"text-xs text-muted-foreground truncate",children:R.domain})]})]})}),o.jsx("td",{className:"px-3 py-2 text-right",children:o.jsx("span",{className:"text-sm font-medium tabular-nums",children:R.count})})]},E))})]})}):o.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No related sources found for this content type."})]}),i.implication&&o.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed border-l-2 border-muted pl-3 mb-4",children:i.implication})]}),i.affected_urls&&i.affected_urls.length>0&&!i.signal_type.startsWith("technical_issues")&&o.jsx("div",{className:"border-t",children:o.jsxs("div",{className:"p-4",children:[o.jsxs("h4",{className:"text-sm font-semibold mb-3",children:["Affected Pages (",i.affected_urls.length,")"]}),o.jsx("div",{className:"rounded-md border overflow-hidden",children:o.jsxs("table",{className:"w-full card-table",children:[o.jsx("thead",{className:"bg-muted/50",children:o.jsxs("tr",{children:[o.jsx("th",{className:"px-3 py-2 text-left text-xs font-medium text-muted-foreground uppercase",children:"Page"}),o.jsx("th",{className:"w-10 px-3 py-2"})]})}),o.jsx("tbody",{className:"divide-y divide-border",children:i.affected_urls.slice((a-1)*c,a*c).map((R,E)=>o.jsxs("tr",{className:"hover:bg-muted/50",children:[o.jsx("td",{className:"px-3 py-2",children:R.pageId?o.jsxs(Mt,{to:`/company/${t}/site-health/page/${R.pageId}?from_page=opportunities`,className:"flex items-center gap-2 group",children:[o.jsx("img",{src:`https://www.google.com/s2/favicons?domain=${new URL(R.url).hostname}&sz=32`,alt:"",className:"h-4 w-4 rounded flex-shrink-0"}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("p",{className:"text-sm font-medium truncate group-hover:text-primary",children:R.title||R.url}),o.jsx("p",{className:"text-xs text-muted-foreground truncate",children:new URL(R.url).pathname})]})]}):o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("img",{src:`https://www.google.com/s2/favicons?domain=${new URL(R.url).hostname}&sz=32`,alt:"",className:"h-4 w-4 rounded flex-shrink-0"}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("p",{className:"text-sm font-medium truncate",children:R.title||R.url}),o.jsx("p",{className:"text-xs text-muted-foreground truncate",children:new URL(R.url).pathname})]})]})}),o.jsx("td",{className:"px-3 py-2",children:o.jsx("a",{href:R.url,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground",children:o.jsx(Wr,{className:"h-3.5 w-3.5"})})})]},E))})]})}),i.affected_urls.length>c&&o.jsxs("div",{className:"flex items-center justify-between mt-3",children:[o.jsxs("p",{className:"text-xs text-muted-foreground",children:[(a-1)*c+1,"-",Math.min(a*c,i.affected_urls.length)," of ",i.affected_urls.length]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(le,{variant:"outline",size:"sm",className:"h-7 w-7 p-0",onClick:()=>l(R=>Math.max(1,R-1)),disabled:a===1,children:o.jsx(wd,{className:"h-4 w-4"})}),o.jsx(le,{variant:"outline",size:"sm",className:"h-7 w-7 p-0",onClick:()=>l(R=>Math.min(Math.ceil(i.affected_urls.length/c),R+1)),disabled:a>=Math.ceil(i.affected_urls.length/c),children:o.jsx(Ga,{className:"h-4 w-4"})})]})]})]})})]}):o.jsx("div",{className:"flex flex-1 min-h-0 items-center justify-center rounded-lg border bg-muted/30 p-8",children:o.jsxs("div",{className:"text-center",children:[o.jsx(Cz,{className:"h-8 w-8 text-muted-foreground mx-auto mb-2"}),o.jsx("p",{className:"text-muted-foreground",children:"Select an opportunity to see details"})]})})})]})]})]})]})}const tLt=t=>({brand:"Brand",informational:"Info",commercial:"Commercial"})[t]||t,nLt=t=>({research:"Research",brand_advocacy:"Brand Advocacy",troubleshooting:"Troubleshooting",brand_engagement:"Brand Engagement",consideration:"Consideration",brand_awareness:"Brand Awareness",comparison:"Comparison",deal_hunting:"Deal Hunting"})[t]||t,rLt=t=>({blind_spot:"Blind Spot",opportunity:"Opportunity",strong_presence:"Strong Presence"})[t]||t,iLt=t=>({blind_spot:"Start Tracking",opportunity:"Expand Coverage",strong_presence:"Track Topic"})[t]||"Track",sLt=$d(t=>({topics:[],setTopics:e=>t({topics:e}),addTopic:e=>t(n=>({topics:[e,...n.topics]})),removeTopic:e=>t(n=>({topics:n.topics.filter(r=>r.id!==e)})),updateTopic:(e,n)=>t(r=>({topics:r.topics.map(i=>i.id===e?{...i,...n}:i)})),suggestedTopics:{blindSpots:[],opportunities:[],strongPresence:[]},setSuggestedTopics:e=>t({suggestedTopics:e}),removeSuggestedTopic:e=>t(n=>({suggestedTopics:{blindSpots:n.suggestedTopics.blindSpots.filter(r=>r.id!==e),opportunities:n.suggestedTopics.opportunities.filter(r=>r.id!==e),strongPresence:n.suggestedTopics.strongPresence.filter(r=>r.id!==e)}})),isGeneratingSuggestions:!1,setIsGeneratingSuggestions:e=>t({isGeneratingSuggestions:e})})),aLt=b.forwardRef(({className:t,value:e=0,max:n=100,...r},i)=>{const s=Math.min(100,Math.max(0,e/n*100));return o.jsx("div",{ref:i,role:"progressbar","aria-valuemin":0,"aria-valuemax":n,"aria-valuenow":e,className:ne("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",t),...r,children:o.jsx("div",{className:"h-full bg-primary transition-all duration-300 ease-in-out",style:{width:`${s}%`}})})});aLt.displayName="Progress";function oLt({open:t,onOpenChange:e,onSubmit:n,isLoading:r=!1}){const[i,s]=b.useState(""),[a,l]=b.useState(""),c=async u=>{u.preventDefault(),i.trim()&&(await n({name:i.trim(),seed:a.trim()||void 0}),s(""),l(""))};return o.jsx(ur,{open:t,onOpenChange:e,children:o.jsx(tr,{className:"sm:max-w-[425px]",children:o.jsxs("form",{onSubmit:c,children:[o.jsxs(dr,{children:[o.jsx(fr,{children:"Create Topic"}),o.jsx(hr,{children:"Create a topic to filter prompts and generate ideas for further research."})]}),o.jsxs("div",{className:"grid gap-4 py-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(et,{htmlFor:"name",children:"Topic Name"}),o.jsx(gt,{id:"name",placeholder:"e.g., Cloud Security Solutions",value:i,onChange:u=>s(u.target.value),maxLength:100,required:!0}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"This name can be used as a tag for filtering prompts."})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(et,{htmlFor:"seed",children:"Seed Context (Optional)"}),o.jsx(dl,{id:"seed",placeholder:"e.g., Focus on enterprise security features, compliance certifications, and comparison with traditional security solutions...",value:a,onChange:u=>l(u.target.value),rows:3,maxLength:1e3}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Context to help generate more relevant prompts."})]})]}),o.jsxs(Pr,{children:[o.jsx(le,{type:"button",variant:"outline",onClick:()=>e(!1),disabled:r,children:"Cancel"}),o.jsx(le,{type:"submit",disabled:!i.trim()||r,children:r?o.jsxs(o.Fragment,{children:[o.jsx(Me,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Topic"})]})]})})})}function lLt({suggestion:t,onTrack:e,onDismiss:n,isTracking:r=!1,isDismissing:i=!1}){return o.jsx(Ct,{className:"relative",children:o.jsx(Et,{className:"px-6 py-3",children:o.jsxs("div",{className:"flex flex-col",children:[o.jsxs("div",{className:"flex items-start justify-between gap-2 mb-1",children:[o.jsx("h4",{className:"text-sm font-medium line-clamp-2 flex-1",children:t.title}),o.jsx(le,{variant:"ghost",size:"icon",className:"h-5 w-5 -mr-1 shrink-0",onClick:()=>n(t.id),disabled:i,children:i?o.jsx(Me,{className:"h-3 w-3 animate-spin"}):o.jsx(mr,{className:"h-3 w-3"})})]}),o.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:t.reason}),o.jsx(le,{variant:"outline",className:"w-full",onClick:()=>e(t.id),disabled:r,children:r?o.jsxs(o.Fragment,{children:[o.jsx(Me,{className:"h-3 w-3 animate-spin"}),"Creating..."]}):iLt(t.category)})]})})})}function I3({title:t,description:e,suggestions:n,onTrack:r,onDismiss:i,trackingId:s,dismissingId:a}){return o.jsxs("div",{className:"flex flex-col min-w-0 flex-1 h-full bg-background",children:[o.jsxs("div",{className:"flex items-center gap-1.5 px-6 h-12 min-h-12 border-b justify-between",children:[o.jsxs("span",{className:"text-xs text-muted-foreground font-medium uppercase",children:[t," (",n.length,")"]}),o.jsx(on,{children:o.jsxs(Ft,{children:[o.jsx(Ut,{asChild:!0,children:o.jsx(xr,{className:"h-3.5 w-3.5 text-muted-foreground cursor-help"})}),o.jsx(zt,{side:"top",children:o.jsx("p",{children:e})})]})})]}),o.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:n.length===0?o.jsx("div",{className:"flex flex-1 flex-col items-center justify-center",children:o.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"No suggestions yet."})}):o.jsx(o.Fragment,{children:o.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto gap-[1px] bg-border",children:n.map(l=>o.jsx(lLt,{suggestion:l,onTrack:r,onDismiss:i},l.id))})})})]})}function cLt({suggestions:t,onTrack:e,onDismiss:n}){const[r,i]=b.useState(null),[s,a]=b.useState(null),l=async d=>{i(d);try{await e(d)}finally{i(null)}},c=async d=>{a(d);try{await n(d)}finally{a(null)}};
4961return t.blindSpots.length+t.opportunities.length+t.strongPresence.length===0?o.jsxs("div",{className:"flex flex-col items-center justify-center py-12 h-full",children:[o.jsx("p",{className:"text-sm font-medium mb-1",children:"No suggested topics yet."}),o.jsx("p",{className:"text-xs text-muted-foreground",children:'Click "Regenerate" to generate suggestions for your company.'})]}):o.jsxs("div",{className:"flex flex-row w-full flex-1 h-full gap-[1px] bg-border",children:[o.jsx(I3,{title:"Blind Spots",description:"Topics and areas to cover for complete visibility.",suggestions:t.blindSpots,onTrack:l,onDismiss:c,trackingId:r,dismissingId:s}),o.jsx(I3,{title:"Opportunities",description:"High-potential areas to expand your coverage and gain competitive advantage.",suggestions:t.opportunities,onTrack:l,onDismiss:c,trackingId:r,dismissingId:s}),o.jsx(I3,{title:"Strong Presence",description:"Areas with strong presence that could deepen your tracking for more insights.",suggestions:t.strongPresence,onTrack:l,onDismiss:c,trackingId:r,dismissingId:s})]})}const uLt={brand:"bg-purple-500/10 text-purple-500 border-purple-500/20",informational:"bg-blue-500/10 text-blue-500 border-blue-500/20",commercial:"bg-green-500/10 text-green-500 border-green-500/20"};function dLt({query:t,isSelected:e,onSelect:n,onConvert:r,onDismiss:i,isConverting:s=!1,isDismissing:a=!1,disabled:l=!1}){const[c,u]=b.useState(!1),[d,f]=b.useState(!1),h=async()=>{u(!0);try{await r(t.id)}finally{u(!1)}},p=async()=>{f(!0);try{await i(t.id)}finally{f(!1)}},m=s||c||a||d,x=t.status==="converted",y=t.status==="dismissed";return o.jsxs("tr",{className:ne("transition-colors hover:bg-accent/30",e&&"bg-accent/50",(x||y)&&"opacity-50"),children:[o.jsx("td",{className:"w-12 px-3 py-3",children:o.jsx(Yr,{checked:e,onChange:g=>n(g.target.checked),disabled:l||x||y})}),o.jsx("td",{className:"px-3 py-3 max-w-[300px]",children:o.jsx("span",{className:"text-sm line-clamp-2",children:t.promptText})}),o.jsx("td",{className:"px-3 py-3",children:o.jsx(Ge,{variant:"outline",className:uLt[t.intent],children:tLt(t.intent)})}),o.jsx("td",{className:"px-3 py-3",children:o.jsx("span",{className:"text-sm text-muted-foreground",children:nLt(t.promptStage)})}),o.jsx("td",{className:"px-3 py-3 text-center",children:o.jsx(xa,{value:t.searchVolume,size:"md",className:"justify-center",tooltipTitle:`Search volume: ${t.searchVolume}`})}),o.jsx("td",{className:"px-3 py-3 text-center",children:o.jsx(xa,{value:t.difficulty,size:"md",className:"justify-center",tooltipTitle:`Difficulty: ${t.difficulty}`})}),o.jsx("td",{className:"px-3 py-3 text-center",children:o.jsx(nr,{value:t.priorityScore,size:"md",variant:"percentage",className:"mx-auto",tooltipTitle:`Priority score: ${t.priorityScore}`})}),o.jsx("td",{className:"px-3 py-3",children:o.jsx("div",{className:"flex items-center justify-center gap-1",children:x?o.jsxs(Ge,{variant:"outline",className:"gap-1 text-green-600 border-green-600/30",children:[o.jsx(bT,{className:"h-3 w-3"}),"Converted"]}):y?o.jsx(Ge,{variant:"outline",className:"text-muted-foreground",children:"Dismissed"}):o.jsxs(o.Fragment,{children:[o.jsx(le,{variant:"outline",size:"sm",onClick:h,disabled:m||l,children:c||s?o.jsx(Me,{className:"h-3 w-3 animate-spin"}):o.jsxs(o.Fragment,{children:[o.jsx(yi,{className:"h-3 w-3 mr-1"}),"Create"]})}),o.jsx(le,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:p,disabled:m,children:d||a?o.jsx(Me,{className:"h-3 w-3 animate-spin"}):o.jsx(mr,{className:"h-3 w-3"})})]})})})]})}function fLt({queries:t,onConvert:e,onBulkConvert:n,onDismiss:r,promptsUsed:i,promptsLimit:s,isOwner:a}){const[l,c]=b.useState(new Set),[u,d]=b.useState("priorityScore"),[f,h]=b.useState("desc"),[p,m]=b.useState(""),[x,y]=b.useState("all"),[g,w]=b.useState("pending"),[v,N]=b.useState(!1),S=a?Math.max(0,s-i):1/0,_=a&&S===0,j=b.useMemo(()=>{let O=[...t];if(p){const L=p.toLowerCase();O=O.filter(T=>T.promptText.toLowerCase().includes(L))}return x!=="all"&&(O=O.filter(L=>L.intent===x)),g!=="all"&&(O=O.filter(L=>L.status===g)),O.sort((L,T)=>{let D=L[u],F=T[u];
4961return typeof D=="string"&&(D=D.toLowerCase(),F=F.toLowerCase()),f==="asc"?D>F?1:-1:D<F?1:-1}),O},[t,p,x,g,u,f]),A=j.filter(O=>O.status==="pending"),C=A.length>0&&A.every(O=>l.has(O.id)),k=A.some(O=>l.has(O.id))&&!C,M=O=>{c(O?new Set(A.map(L=>L.id)):new Set)},I=(O,L)=>{const T=new Set(l);L?T.add(O):T.delete(O),c(T)},R=O=>{u===O?h(L=>L==="asc"?"desc":"asc"):(d(O),h("desc"))},E=async()=>{if(l.size!==0){N(!0);try{const O=Array.from(l).slice(0,S);await n(O),c(new Set)}finally{N(!1)}}},P=({field:O,children:L})=>o.jsxs("button",{className:"flex items-center justify-center gap-1 hover:text-foreground text-xs text-muted-foreground uppercase font-medium",onClick:()=>R(O),children:[L,u===O&&(f==="asc"?o.jsx(Kc,{className:"h-3 w-3"}):o.jsx(ms,{className:"h-3 w-3"}))]});return o.jsxs("div",{className:"",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-3 px-6 py-3 border-b",children:[o.jsxs("div",{className:"relative flex-1 min-w-[200px] max-w-[300px]",children:[o.jsx(Xa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(gt,{placeholder:"Search queries...",value:p,onChange:O=>m(O.target.value),className:"pl-9"})]}),o.jsxs(Tr,{value:x,onValueChange:O=>y(O),children:[o.jsx(yr,{className:"w-[150px]",children:o.jsx(Vr,{placeholder:"Intent"})}),o.jsxs(vr,{children:[o.jsx(Ht,{value:"all",children:"All Intents"}),o.jsx(Ht,{value:"brand",children:"Brand"}),o.jsx(Ht,{value:"informational",children:"Informational"}),o.jsx(Ht,{value:"commercial",children:"Commercial"})]})]}),o.jsxs(Tr,{value:g,onValueChange:O=>w(O),children:[o.jsx(yr,{className:"w-[150px]",children:o.jsx(Vr,{placeholder:"Status"})}),o.jsxs(vr,{children:[o.jsx(Ht,{value:"all",children:"All Status"}),o.jsx(Ht,{value:"pending",children:"Pending"}),o.jsx(Ht,{value:"converted",children:"Converted"}),o.jsx(Ht,{value:"dismissed",children:"Dismissed"})]})]})]}),l.size>0&&o.jsxs("div",{className:"flex items-center gap-3 px-6 py-3 border-b bg-muted/50",children:[o.jsxs("span",{className:"text-sm font-medium",children:[l.size," selected"]}),o.jsx(le,{size:"sm",onClick:E,disabled:v||_,children:v?o.jsxs(o.Fragment,{children:[o.jsx(Me,{className:"mr-2 h-4 w-4 animate-spin"}),"Converting..."]}):o.jsxs(o.Fragment,{children:["Create Prompts",a&&S<l.size&&o.jsxs("span",{className:"ml-1 text-xs",children:["(",S," available)"]})]})}),o.jsxs(le,{variant:"ghost",size:"sm",onClick:()=>c(new Set),children:[o.jsx(mr,{className:"mr-1 h-3 w-3"}),"Clear"]}),a&&o.jsxs("span",{className:"ml-auto text-sm text-muted-foreground",children:[i," / ",s," prompts used"]})]}),o.jsx("div",{className:"overflow-x-auto",children:o.jsxs("table",{className:"w-full card-table",children:[o.jsx("thead",{className:"bg-muted/50 h-12 border-b",children:o.jsxs("tr",{children:[o.jsx("th",{className:"w-12 px-3",children:o.jsx(Yr,{checked:C,indeterminate:k,onChange:O=>M(O.target.checked),disabled:A.length===0||_})}),o.jsx("th",{className:"px-3 text-left w-full",children:o.jsx(P,{field:"promptText",children:"Prompt"})}),o.jsx("th",{className:"px-3 text-left",children:o.jsx(P,{field:"intent",children:"Intent"})}),o.jsx("th",{className:"px-3 text-left",children:o.jsx(P,{field:"promptStage",children:"Stage"})}),o.jsx("th",{className:"px-3 text-center",children:o.jsx(P,{field:"searchVolume",children:"Volume"})}),o.jsx("th",{className:"px-3 text-center",children:o.jsx(P,{field:"difficulty",children:"Difficulty"})}),o.jsx("th",{className:"px-3 text-center",children:o.jsx(P,{field:"priorityScore",children:"Priority"})}),o.jsx("th",{className:"px-3 text-center uppercase text-xs text-muted-foreground font-medium",children:"Actions"})]})}),o.jsx("tbody",{className:"divide-y divide-border",children:j.length===0?o.jsx("tr",{children:o.jsx("td",{colSpan:8,className:"p-8 text-center text-muted-foreground",children:"No queries found"})}):j.map(O=>o.jsx(dLt,{query:O,isSelected:l.has(O.id),onSelect:L=>I(O.id,L),onConvert:e,onDismiss:r,disabled:_},O.id))})]})})]})}function hLt(){const{companyId:t}=Gr(),e=Nr(),n=Sa(),{topics:r,setTopics:i,addTopic:s,suggestedTopics:a,setSuggestedTopics:l,removeSuggestedTopic:c,isGeneratingSuggestions:u,setIsGeneratingSuggestions:d}=sLt(),[f,h]=b.useState(!1),[p,m]=b.useState(!1),x=_S(t),{data:y,isLoading:g}=En({queryKey:["research-status",t],queryFn:async()=>await Ce.get(`/companies/${t}/research/status`),enabled:!!t}),{data:w,isLoading:v}=En({queryKey:["research-topics",t],queryFn:async()=>await Ce.get(`/companies/${t}/research/topics`),enabled:!!t&&(y==null?void 0:y.isAvailable)}),{data:N,isLoading:S}=En({queryKey:["research-suggestions",t],queryFn:async()=>await Ce.get(`/companies/${t}/research/suggestions`),enabled:!!t&&(y==null?void 0:y.isAvailable)});b.useEffect(()=>{w&&i(w)},[w,i]),b.useEffect(()=>{N&&l(N)},[N,l]);const _=un({mutationFn:async T=>Ce.post(`/companies/${t}/research/topics`,T),onSuccess:T=>{s(T),n.invalidateQueries({queryKey:["research-topics",t]}),ge.success("Topic created! Query generation started."),h(!1)},onError:T=>{ge.error(T.message||"Failed to create topic")}}),j=un({mutationFn:async()=>Ce.post(`/companies/${t}/research/suggestions/generate`,{}),onSuccess:()=>{d(!0),ge.success("Regenerating suggestions... This may take a moment."),setTimeout(()=>{n.invalidateQueries({queryKey:["research-suggestions",t]}),d(!1)},1e4)},onError:T=>{ge.error(T.message||"Failed to regenerate suggestions")}}),A=un({mutationFn:async T=>Ce.post(`/companies/${t}/research/suggestions/${T}/track`,{}),onSuccess:T=>{s(T),n.invalidateQueries({queryKey:["research-topics",t]}),n.invalidateQueries({queryKey:["research-suggestions",t]}),ge.success("Topic created from suggestion! Query generation started.")},onError:T=>{ge.error(T.message||"Failed to track suggestion")}}),C=un({mutationFn:async T=>Ce.patch(`/companies/${t}/research/suggestions/${T}`,{status:"dismissed"}),onSuccess:(T,D)=>{c(D),ge.success("Suggestion dismissed")},onError:T=>{ge.error(T.message||"Failed to dismiss suggestion")}}),k=async T=>{m(!0);try{await _.mutateAsync(T)}finally{m(!1)}},M=async T=>{await A.mutateAsync(T)},I=async T=>{await C.mutateAsync(T)},R=async()=>{await j.mutateAsync()},E=T=>{e(`/company/${t}/research/${T}`)},P=T=>{switch(T){case"generating":return o.jsxs(Ge,{variant:"secondary",className:"gap-1",children:[o.jsx(Me,{className:"h-3 w-3 animate-spin"}),"Generating"]});case"completed":return o.jsxs(Ge,{variant:"outline",className:"gap-1 text-green-600 border-green-600/30",children:[o.jsx(bT,{className:"h-3 w-3"}),"Ready"]});case"failed":return o.jsxs(Ge,{variant:"destructive",className:"gap-1",children:[o.jsx(_z,{className:"h-3 w-3"}),"Failed"]});default:return o.jsxs(Ge,{variant:"secondary",className:"gap-1",children:[o.jsx(Me,{className:"h-3 w-3 animate-spin"}),"Pending"]})}};if(g)return o.jsx("div",{className:"flex h-64 items-center justify-center",children:o.jsx(Me,{className:"h-8 w-8 animate-spin text-muted-foreground"})});const O=x.hasResearchData||r.length>0;return!O&&(x.isSetupRunning||x.isInitialLoad)?o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Research"}),o.jsx(u9,{title:"Setting Up Research",description:"We're generating your initial research topic and suggestions based on your company profile. This helps you discover how your brand is perceived across different AI platforms."})]}):!O&&!(y!=null&&y.isAvailable)?o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Research"}),o.jsx("div",{className:"flex flex-col h-[calc(100vh-120px)]",children:o.jsx(Dt,{className:"flex-1",children:o.jsxs(Vt,{className:"flex flex-col items-center justify-center h-full py-16",children:[o.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Research will be available soon"}),o.jsx("p",{className:"text-muted-foreground text-center max-w-md mb-6",children:"Research features will be available as soon as your first prompt is created and run."}),o.jsx(Mt,{to:`/company/${t}/prompts`,children:o.jsx(le,{variant:"outline",size:"sm",children:"Go to Prompts"})})]})})})]}):o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Research"}),o.jsxs("div",{className:"flex flex-col min-h-full h-full w-full overflow-y-auto",children:[o.jsxs("div",{className:"flex shrink-0 items-center justify-between px-6 py-3 border-b",children:[o.jsx("h2",{className:"text-sm font-medium",children:"Topic Research"}),o.jsxs(le,{size:"sm",onClick:()=>h(!0),children:[o.jsx(yi,{className:"h-4 w-4"}),"Create Topic"]})]}),o.jsx("div",{className:"flex shrink-0 flex-col",children:o.jsx("div",{className:"min-h-40 overflow-auto",children:v?o.jsx("div",{className:"flex h-40 items-center justify-center border-b",children:o.jsx(Me,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):r.length===0?o.jsxs("div",{className:"flex flex-col items-center justify-center py-12 h-40 border-b",children:[o.jsx("h3",{className:"text-sm font-medium mb-1",children:"You haven't created any research topics yet"}),o.jsx("p",{className:"text-xs text-muted-foreground text-center max-w-md",children:"Create your first topic to get prompt suggestions for further research."})]}):o.jsx("div",{className:"border-b min-h-40",children:o.jsxs("table",{className:"w-full bg-background card-table",children:[o.jsx("thead",{className:"bg-muted/50 sticky top-0",children:o.jsxs("tr",{className:"text-xs text-muted-foreground uppercase font-medium h-12 border-b",children:[o.jsx("th",{className:"text-left font-medium px-4 py-2",children:"Topic"}),o.jsx("th",{className:"text-left font-medium px-4 py-2 w-[100px]",children:"Ideas"}),o.jsx("th",{className:"text-left font-medium px-4 py-2 w-[100px]",children:"Converted"}),o.jsx("th",{className:"text-left font-medium px-4 py-2 w-[100px]",children:"Category"}),o.jsx("th",{className:"text-left font-medium px-4 py-2 w-[120px]",children:"Status"}),o.jsx("th",{className:"w-[80px]"})]})}),o.jsx("tbody",{className:"divide-y",children:r.map(T=>o.jsxs("tr",{onClick:()=>E(T.id),className:"hover:bg-accent/50 cursor-pointer transition-colors",children:[o.jsx("td",{className:"px-4 py-3",children:o.jsxs("div",{children:[o.jsx("p",{className:"font-medium text-sm",children:T.name}),T.seed&&o.jsx("p",{className:"text-xs text-muted-foreground truncate max-w-[300px]",children:T.seed})]})}),o.jsx("td",{className:"px-4 py-3 text-sm text-muted-foreground",children:T.queryCount||0}),o.jsx("td",{className:"px-4 py-3 text-sm text-muted-foreground",children:T.convertedCount||0}),o.jsx("td",{className:"px-4 py-3 text-sm text-muted-foreground",children:T.category?rLt(T.category):"—"}),o.jsx("td",{className:"px-4 py-3",children:P(T.generationStatus)}),o.jsx("td",{className:"px-4 py-3",children:o.jsx(le,{variant:"outline",size:"sm",onClick:D=>{D.stopPropagation(),E(T.id)},children:"Open"})})]},T.id))})]})})})}),o.jsxs("div",{className:"flex shrink-0 items-center justify-between px-6 py-3 border-b",children:[o.jsx("h2",{className:"text-sm font-medium",children:"Suggested Topics"}),o.jsx(le,{size:"sm",onClick:R,disabled:u||j.isPending,children:u||j.isPending?o.jsxs(o.Fragment,{children:[o.jsx(Me,{className:"h-4 w-4 animate-spin"}),"Generating..."]}):o.jsxs(o.Fragment,{children:[o.jsx(MTe,{className:"h-4 w-4"}),"Regenerate"]})})]}),o.jsx("div",{className:"flex min-h-80 flex-1 flex-col overflow-hidden",children:o.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:S?o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Me,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):o.jsx(cLt,{suggestions:a,onTrack:M,onDismiss:I})})})]}),o.jsx(oLt,{open:f,onOpenChange:h,onSubmit:k,isLoading:p})]})}function pLt(t,e=[]){let n=[];function r(s,a){const l=b.createContext(a),c=n.length;n=[...n,a];const u=f=>{var g;const{scope:h,children:p,...m}=f,x=((g=h==null?void 0:h[t])==null?void 0:g[c])||l,y=b.useMemo(()=>m,Object.values(m));return o.jsx(x.Provider,{value:y,children:p})};u.displayName=s+"Provider";function d(f,h){var x;const p=((x=h==null?void 0:h[t])==null?void 0:x[c])||l,m=b.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[u,d]}const i=()=>{const s=n.map(a=>b.createContext(a));return function(l){const c=(l==null?void 0:l[t])||s;return b.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return i.scopeName=t,[r,mLt(i,...e)]}function mLt(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));
4961return function(s){const a=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...l,...f}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return n.scopeName=e.scopeName,n}var gLt=Symbol("radix.slottable");function xLt(t){const e=({children:n})=>o.jsx(o.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=gLt,e}var p0e="AlertDialog",[yLt]=pLt(p0e,[uae]),qd=uae(),m0e=t=>{const{__scopeAlertDialog:e,...n}=t,r=qd(e);return o.jsx(Oz,{...r,...n,modal:!0})};m0e.displayName=p0e;var vLt="AlertDialogTrigger",g0e=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=qd(n);return o.jsx($Pe,{...i,...r,ref:e})});g0e.displayName=vLt;var bLt="AlertDialogPortal",x0e=t=>{const{__scopeAlertDialog:e,...n}=t,r=qd(e);return o.jsx(Rz,{...r,...n})};x0e.displayName=bLt;var wLt="AlertDialogOverlay",y0e=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=qd(n);return o.jsx(kT,{...i,...r,ref:e})});y0e.displayName=wLt;var Fy="AlertDialogContent",[_Lt,SLt]=yLt(Fy),NLt=xLt("AlertDialogContent"),v0e=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:r,...i}=t,s=qd(n),a=b.useRef(null),l=Pn(e,a),c=b.useRef(null);return o.jsx(RPe,{contentName:Fy,titleName:b0e,docsSlug:"alert-dialog",children:o.jsx(_Lt,{scope:n,cancelRef:c,children:o.jsxs(ET,{role:"alertdialog",...s,...i,ref:l,onOpenAutoFocus:at(i.onOpenAutoFocus,u=>{var d;u.preventDefault(),(d=c.current)==null||d.focus({preventScroll:!0})}),onPointerDownOutside:u=>u.preventDefault(),onInteractOutside:u=>u.preventDefault(),children:[o.jsx(NLt,{children:r}),o.jsx(CLt,{contentRef:a})]})})})});v0e.displayName=Fy;var b0e="AlertDialogTitle",w0e=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=qd(n);return o.jsx(Iz,{...i,...r,ref:e})});w0e.displayName=b0e;var _0e="AlertDialogDescription",S0e=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=qd(n);return o.jsx(Dz,{...i,...r,ref:e})});S0e.displayName=_0e;var jLt="AlertDialogAction",N0e=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=qd(n);return o.jsx(Lz,{...i,...r,ref:e})});N0e.displayName=jLt;var j0e="AlertDialogCancel",C0e=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,{cancelRef:i}=SLt(j0e,n),s=qd(n),a=Pn(e,i);return o.jsx(Lz,{...s,...r,ref:a})});C0e.displayName=j0e;var CLt=({contentRef:t})=>{const e=`\`${Fy}\` requires a description for the component to be accessible for screen reader users.
4962
4963You can add a description to the \`${Fy}\` by passing a \`${_0e}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
4964
4965Alternatively, 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 \`${Fy}\`. 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.
4966
4967For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return b.useEffect(()=>{var r;document.getElementById((r=t.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},kLt=m0e,ELt=g0e,ALt=x0e,TLt=y0e,MLt=v0e,PLt=N0e,OLt=C0e,RLt=w0e,ILt=S0e;function DLt({...t}){return o.jsx(kLt,{"data-slot":"alert-dialog",...t})}function LLt({...t}){return o.jsx(ELt,{"data-slot":"alert-dialog-trigger",...t})}function $Lt({...t}){return o.jsx(ALt,{"data-slot":"alert-dialog-portal",...t})}function FLt({className:t,...e}){return o.jsx(TLt,{"data-slot":"alert-dialog-overlay",className:ne("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...e})}function ULt({className:t,...e}){return o.jsxs($Lt,{children:[o.jsx(FLt,{}),o.jsx(MLt,{"data-slot":"alert-dialog-content",className:ne("bg-background 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 roun
4967ded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),...e})]})}function zLt({className:t,...e}){return o.jsx("div",{"data-slot":"alert-dialog-header",className:ne("flex flex-col gap-2 text-center sm:text-left",t),...e})}function BLt({className:t,...e}){return o.jsx("div",{"data-slot":"alert-dialog-footer",className:ne("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})}function VLt({className:t,...e}){return o.jsx(RLt,{"data-slot":"alert-dialog-title",className:ne("text-lg font-semibold",t),...e})}function HLt({className:t,...e}){return o.jsx(ILt,{"data-slot":"alert-dialog-description",className:ne("text-muted-foreground text-sm",t),...e})}function WLt({className:t,...e}){return o.jsx(PLt,{className:ne(Fz(),t),...e})}function GLt({className:t,...e}){return o.jsx(OLt,{className:ne(Fz({variant:"outline"}),t),...e})}function qLt(){const{companyId:t,topicId:e}=Gr(),n=Nr(),r=Sa(),{profile:i}=Rr(),{currentCompany:s}=Ri(),[a,l]=b.useState(!1),[c,u]=b.useState(!1),d=(s==null?void 0:s.ownerId)===(i==null?void 0:i.id),{data:f,isLoading:h,refetch:p}=En({queryKey:["research-topic",t,e],queryFn:async()=>await Ce.get(`/companies/${t}/research/topics/${e}`),enabled:!!t&&!!e,refetchInterval:M=>{var R,E;const I=(E=(R=M.state.data)==null?void 0:R.topic)==null?void 0:E.generationStatus;return I==="generating"||I==="pending"?5e3:!1}}),m=un({mutationFn:async M=>Ce.post(`/companies/${t}/research/topics/${e}/queries/${M}/convert`,{}),onSuccess:()=>{r.invalidateQueries({queryKey:["research-topic",t,e]}),ge.success("Query converted to prompt!")},onError:M=>{var I;(I=M.message)!=null&&I.includes("limit")?ge.error("You have reached your prompt limit. Upgrade your plan to create more."):ge.error(M.message||"Failed to convert query")}}),x=un({mutationFn:async M=>Ce.post(`/companies/${t}/research/topics/${e}/queries/bulk-convert`,{queryIds:M}),onSuccess:M=>{r.invalidateQueries({queryKey:["research-topic",t,e]}),ge.success(`${M.converted} queries converted to prompts!`)},onError:M=>{var I;(I=M.message)!=null&&I.includes("limit")?ge.error("You have reached your prompt limit. Upgrade your plan to create more."):ge.error(M.message||"Failed to convert queries")}}),y=un({mutationFn:async M=>Ce.patch(`/companies/${t}/research/topics/${e}/queries/${M}`,{status:"dismissed"}),onSuccess:()=>{r.invalidateQueries({queryKey:["research-topic",t,e]}),ge.success("Query dismissed")},onError:M=>{ge.error(M.message||"Failed to dismiss query")}}),g=un({mutationFn:async()=>Ce.delete(`/companies/${t}/research/topics/${e}`),onSuccess:()=>{r.invalidateQueries({queryKey:["research-topics",t]}),ge.success("Topic deleted"),n(`/company/${t}/research`)},onError:M=>{ge.error(M.message||"Failed to delete topic")}}),w=async M=>{await m.mutateAsync(M)},v=async M=>{await x.mutateAsync(M)},N=async M=>{await y.mutateAsync(M)},S=async()=>{l(!0);try{await g.mutateAsync()}finally{l(!1)}},_=async()=>{u(!0);try{await p()}finally{u(!1)}};if(h)return o.jsx("div",{className:"flex h-64 items-center justify-center",children:o.jsx(Me,{className:"h-8 w-8 animate-spin text-muted-foreground"})});if(!f)return o.jsxs("div",{className:"",children:[o.jsx("div",{className:"flex items-center gap-3 py-3 border-b bg-background px-6 sticky top-0 z-10",children:o.jsxs(le,{variant:"outline",size:"sm",onClick:()=>n(`/company/${t}/research`),children:[o.jsx(Ii,{className:"mr-1 h-4 w-4"}),"Back"]})}),o.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[o.jsx("h3",{className:"text-lg font-medium mb-2",children:"Topic Not Found"}),o.jsx("p",{className:"text-muted-foreground",children:"This research topic could not be found."})]})]});const{topic:j,queries:A,stats:C}=f,k=j.generationStatus==="generating"||j.generationStatus==="pending";return o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:`${j.name} - Research`}),o.jsxs("div",{className:"",children:[o.jsxs("div",{className:"flex items-center justify-between py-3 border-b bg-background px-6 sticky top-0 z-10",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs(le,{variant:"outline",size:"sm",onClick:()=>n(`/company/${t}/research`),children:[o.jsx(Ii,{className:"mr-1 h-4 w-4"}),"Back"]}),o.jsx("h1",{className:"text-lg font-semibold",children:j.name}),k&&o.jsxs(Ge,{variant:"secondary",className:"gap-1",children:[o.jsx(Me,{className:"h-3 w-3 animate-spin"}),"Generating queries..."]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(le,{variant:"outline",size:"sm",className:"h-8 w-8 p-0",onClick:_,disabled:c,
4967children:o.jsx(ws,{className:`h-4 w-4 ${c?"animate-spin":""}`})}),o.jsxs(DLt,{children:[o.jsx(LLt,{asChild:!0,children:o.jsx(le,{variant:"outline",size:"sm",className:"text-destructive h-8 w-8 p-0",children:o.jsx(Yi,{className:"h-4 w-4"})})}),o.jsxs(ULt,{children:[o.jsxs(zLt,{children:[o.jsx(VLt,{children:"Delete Topic"}),o.jsxs(HLt,{children:['Are you sure you want to delete "',j.name,'"? This will also delete all generated queries. This action cannot be undone.']})]}),o.jsxs(BLt,{children:[o.jsx(GLt,{children:"Cancel"}),o.jsx(WLt,{onClick:S,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",disabled:a,children:a?o.jsxs(o.Fragment,{children:[o.jsx(Me,{className:"mr-2 h-4 w-4 animate-spin"}),"Deleting..."]}):"Delete"})]})]})]})]})]}),j.seed&&o.jsx("div",{className:"px-6 py-3 border-b",children:o.jsx("p",{className:"text-sm text-muted-foreground max-w-2xl",children:j.seed})}),o.jsxs("div",{className:"grid sm:grid-cols-2 md:grid-cols-4 gap-[1px] bg-border border-b",children:[o.jsxs(Ct,{children:[o.jsxs(Lt,{className:"flex flex-row items-center justify-between pb-2",children:[o.jsx($t,{className:"text-sm font-medium text-muted-foreground",children:"Queries"}),o.jsx(Ao,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsx(Et,{children:o.jsx("div",{className:"text-2xl font-bold",children:C.total})})]}),o.jsxs(Ct,{children:[o.jsxs(Lt,{className:"flex flex-row items-center justify-between pb-2",children:[o.jsx($t,{className:"text-sm font-medium text-muted-foreground",children:"Converted"}),o.jsx(bT,{className:"h-4 w-4 text-green-600"})]}),o.jsx(Et,{children:o.jsx("div",{className:"text-2xl font-bold",children:C.converted})})]}),o.jsxs(Ct,{children:[o.jsxs(Lt,{className:"flex flex-row items-center justify-between pb-2",children:[o.jsx($t,{className:"text-sm font-medium text-muted-foreground",children:"Avg Volume"}),o.jsx(Ud,{className:"h-4 w-4 text-blue-600"})]}),o.jsx(Et,{children:o.jsx("div",{className:"text-2xl font-bold",children:C.avgVolume})})]}),o.jsxs(Ct,{children:[o.jsxs(Lt,{className:"flex flex-row items-center justify-between pb-2",children:[o.jsx($t,{className:"text-sm font-medium text-muted-foreground",children:"Avg Difficulty"}),o.jsx(wz,{className:"h-4 w-4 text-amber-600"})]}),o.jsx(Et,{children:o.jsx("div",{className:"text-2xl font-bold",children:C.avgDifficulty})})]})]}),k&&A.length===0?o.jsx(Ct,{className:"bg-background",children:o.jsxs(Et,{className:"flex flex-col items-center justify-center py-12 pt-12",children:[o.jsx(Me,{className:"h-8 w-8 animate-spin text-muted-foreground mb-4"}),o.jsx("h3",{className:"text-lg font-medium mb-2",children:"Generating Queries..."}),o.jsx("p",{className:"text-muted-foreground text-center max-w-md",children:"AI is analyzing your company profile and generating relevant queries for this topic. This usually takes 30-60 seconds."})]})}):A.length===0?o.jsx(Ct,{className:"bg-background",children:o.jsxs(Et,{className:"flex flex-col items-center justify-center py-12 pt-12",children:[o.jsx("h3",{className:"text-lg font-medium mb-2",children:"No Queries"}),o.jsx("p",{className:"text-muted-foreground",children:"No queries have been generated for this topic yet."})]})}):o.jsx(fLt,{queries:A,onConvert:w,onBulkConvert:v,onDismiss:N,promptsUsed:(i==null?void 0:i.promptsUsed)||0,promptsLimit:(i==null?void 0:i.promptsLimit)||0,isOwner:d})]})]})}function lC(t){const e=new Date(t),n=new Date;return e.toDateString()===n.toDateString()}function cC(){return new Date().toISOString().split("T")[0]}const KLt=[{label:"Last 7 days",value:"7"},{label:"Last 14 days",value:"14"},{label:"Last 30 days",value:"30"},{label:"Last 90 days",value:"90"}],Sp={non_competitor:{label:"Non-Competitor",color:"#6366f1",description:"Company website (not a competitor)"},competitor:{label:"Competitor",color:"#ef4444",description:"Competitor company website"},editorial:{label:"Editorial",color:"#8b5cf6",description:"News, magazines, editorial content"},institutional:{label:"Institutional",color:"#0ea5e9",description:"Government, education, research institutions"},review:{label:"Review",color:"#f59e0b",description:"Review sites and comparison platforms"},social:{label:"Social",color:"#ec4899",description:"Social media platforms"},forum:{label:"Forum",color:"#14b8a6",description:"Forums and community discussions"},you:{label:"You",color:"#22c55e",description:"Your own domain"},other:{label:"Other",color:"#94a3b8",description:"Other source types"}};function ree(t){const e=new Date(t),n=e.toLocaleDateString("en-US",{month:"short"}),r=e.getDate();return`${n} ${r}${r===1||r===21||r===31?"st":r===2||r===22?"nd":r===3||r===23?"rd":"th"}`}function YLt(){const{companyId:t}=Gr(),[e,n]=b.useState(null),[r,i]=b.useState(null),[s,a]=b.useState([]),[l,c]=b.useState(null),[u,d]=b.useState("Your brand"),[f,h]=b.useState(null),[p,m]=b.useState(null),[x,y]=b.useState(!0),[g,w]=b.useState(null),[v,N]=b.useState("7"),[S,_]=b.useState("all"),[j,A]=b.useState([]),C=async()=>
4967{if(t)try{y(!0),w(null);const P=new Date,O=new Date;O.setDate(P.getDate()-parseInt(v));const L=new URLSearchParams({startDate:O.toISOString().split("T")[0],endDate:P.toISOString().split("T")[0]});S!=="all"&&L.append("platform",S);const[T,D,F,q,B]=await Promise.all([Ce.get(`/companies/${t}/analytics/visibility?${L.toString()}`),Ce.get(`/companies/${t}/analytics/share-of-voice?${L.toString()}`),Ce.get(`/companies/${t}/competitors`),Ce.get(`/companies/${t}/analytics/sources?${L.toString()}`),Ce.get(`/companies/${t}`)]);n(T),i(D),a(F),c(q),d(B.brandName||B.name||"Your brand"),h(B.logoUrl),m(B.website);const z=T.byPlatform.filter(H=>H.provider).map(H=>H.provider);A(z)}catch(P){w(P.message||"Failed to load visibility data")}finally{y(!1)}};b.useEffect(()=>{C()},[t,v,S]);const k=b.useMemo(()=>{if(!r||!e)return null;const P=r.overview.totalMentions,O=[{id:"brand",name:u,isBrand:!0,mentions:r.overview.brandMentions,shareOfVoice:r.overview.shareOfVoice,sentiment:e.overview.avgSentiment,website:p,logoUrl:f},...r.topCompetitors.map((L,T)=>{const D=s.find(F=>F.name.toLowerCase()===L.name.toLowerCase());return{id:`competitor-${T}`,name:L.name,isBrand:!1,mentions:L.mentions,shareOfVoice:L.shareOfVoice,sentiment:(D==null?void 0:D.stats.avgSentiment)??null,website:(D==null?void 0:D.website)??null,logoUrl:(D==null?void 0:D.logoUrl)??null}})].sort((L,T)=>T.shareOfVoice-L.shareOfVoice);return{brandShareOfVoice:r.overview.shareOfVoice,totalMentions:P,rankings:O}},[r,e,s,u,f,p]),M=b.useMemo(()=>!e||s.length===0?null:[{id:"brand",name:u,isBrand:!0,visibility:e.overview.visibilityRate,mentions:e.overview.totalMentions,avgRank:e.overview.avgRank,change:null,website:p,logoUrl:f},...s.map(O=>({id:O.id,name:O.name,isBrand:!1,visibility:O.stats.visibility,mentions:O.stats.mentionCount,avgRank:O.stats.avgRank,change:null,website:O.website,logoUrl:O.logoUrl}))].sort((O,L)=>L.visibility-O.visibility),[e,s,u,f,p]),I=b.useMemo(()=>l!=null&&l.bySourceType?l.bySourceType.map(P=>{var O,L;return{name:((O=Sp[P.sourceType])==null?void 0:O.label)||P.sourceType,value:P.count,color:((L=Sp[P.sourceType])==null?void 0:L.color)||"#94a3b8"}}):[],[l]),E=(()=>{if(!(e!=null&&e.trend)||e.trend.length<2)return"neutral";const P=e.trend.slice(-3).reduce((L,T)=>L+T.visibilityRate,0)/3,O=e.trend.slice(0,3).reduce((L,T)=>L+T.visibilityRate,0)/3;return P>O+5?"up":P<O-5?"down":"neutral"})();return x&&!e?o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Visibility Analytics",noIndex:!0}),o.jsx("div",{className:"flex h-64 items-center justify-center",children:o.jsx(Me,{className:"h-8 w-8 animate-spin text-primary"})})]}):g?o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Visibility Analytics",noIndex:!0}),o.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-4",children:[o.jsx("p",{className:"text-destructive",children:g}),o.jsxs(le,{onClick:C,variant:"outline",children:[o.jsx(ws,{className:"h-4 w-4"}),"Retry"]})]})]}):o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Visibility Analytics",noIndex:!0}),o.jsxs("div",{className:"",children:[o.jsxs("div",{className:"flex items-center justify-between py-3 border-b bg-background px-6 sticky top-0 z-10",children:[o.jsx("h1",{className:"text-lg font-semibold",children:"Visibility Overview"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(Tr,{value:v,onValueChange:N,children:[o.jsx(yr,{className:"w-[130px] h-8 text-sm",children:o.jsx(Vr,{})}),o.jsx(vr,{children:KLt.map(P=>o.jsx(Ht,{value:P.value,children:P.label},P.value))})]}),o.jsxs(Tr,{value:S,onValueChange:_,children:[o.jsx(yr,{className:"w-[150px] h-8 text-sm",children:o.jsx(Vr,{placeholder:"All Models"})}),o.jsxs(vr,{children:[o.jsx(Ht,{value:"all",children:"All Models"}),j.map(P=>o.jsx(Ht,{value:P.id,children:P.displayName},P.id))]})]}),o.jsx(le,{onClick:C,variant:"outline",size:"sm",className:"h-8 w-8 p-0",disabled:x,children:o.jsx(ws,{className:`h-4 w-4 ${x?"animate-spin":""}`})})]})]}),o.jsxs("div",{className:"",children:[o.jsxs("div",{className:"grid sm:grid-cols-2 md:grid-cols-4 gap-[1px] bg-border border-b",children:[o.jsxs(Ct,{children:[o.jsxs(Lt,{className:"flex flex-row items-center justify-between pb-2",children:[o.jsx($t,{className:"text-sm font-medium text-muted-foreground",children:"Visibility Rate"}),E==="up"&&o.jsx(Ud,{className:"h-4 w-4 text-green-500"}),E==="down"&&o.jsx(Xse,{className:"h-4 w-4 text-red-500"}),E==="neutral"&&o.jsx(kz,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Et,{children:[o.jsxs("div",{className:"text-2xl font-bold",children:[(e==null?void 0:e.overview.visibilityRate)??0,"%"]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"of AI responses mention your brand"})]})]}),o.jsxs(Ct,{children:[o.jsx(Lt,{className:"flex flex-row items-center justify-between pb-2",children:o.jsx($t,{className:"text-sm font-medium text-muted-foreground",children:"Total Mentions"})}),o.jsxs(Et,{children:[o.jsx("div",{className:"text-2xl font-bold",children:(e==null?void 0:e.overview.totalMentions)??0}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:["out of ",(e==null?void 0:e.overview.totalRuns)??0," total runs"]})]})]}),o.jsxs(Ct,{children:[o.jsx(Lt,{className:"flex flex-row items-center justify-between pb-2",children:o.jsx($t,{className:"text-sm font-medium text-muted-foreground",children:"Average Rank"})}),o.jsxs(Et,{children:[o.jsx("div",{className:"text-2xl font-bold",children:e!=null&&e.overview.avgRank?`#${e.overview.avgRank}`:"—"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"when mentioned in responses"})]})]}),o.jsxs(Ct,{children:[o.jsx(Lt,{className:"flex flex-row items-center justify-between pb-2",children:o.jsx($t,{className:"text-sm font-medium text-muted-foreground",children:"Average Sentiment"})}),o.jsxs(Et,{className:"flex flex-col gap-2",children:[o.jsx(xa,{value:(e==null?void 0:e.overview.avgSentiment)??0,size:"lg",fullWidth:!0,tooltipTitle:`Avg. sentiment of ${(e==null?void 0:e.overview.avgSentiment)??0} based on ${(e==null?void 0:e.overview.totalMentions)??0} mention${((e==null?void 0:e.overview.totalMentions)??0)!==1?"s":""}`}),o.jsxs("p",{className:"text-sm text-muted-foreground",children:[(e==null?void 0:e.overview.avgSentiment)??0," / 100"]})]})]})]}),o.jsxs("div",{className:"grid border-b gap-[1px] bg-border lg:grid-cols-2 items-stretch",children:[o.jsxs(Ct,{className:"flex flex-col bg-background",children:[o.jsx(Lt,{className:"border-b",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("div",{children:o.jsx($t,{children:"Visibility Trend"})}),o.jsx(on,{children:o.jsxs(Ft,{children:[o.jsx(Ut,{children:o.jsx(xr,{className:"h-4 w-4 text-muted-foreground"})}),o.jsx(zt,{children:o.jsx("p",{children:"The percentage of times your brand appears when we test prompts across all AI models."})})]})})]})}),o.jsx(Et,{className:"pt-6 flex-1 flex flex-col",children:o.jsx("div",{className:"flex-1 min-h-[280px]",children:e!=null&&e.trend&&e.trend.length>0?o.jsx(Qi,{width:"100%",height:"100%",children:o.jsxs(fE,{data:e.trend,margin:{top:5,right:5,left:-20,bottom:0},children:[o.jsxs("defs",{children:[o.jsxs("linearGradient",{id:"visibilityGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[o.jsx("stop",{offset:"5%",
4967stopColor:"var(--chart-1)",stopOpacity:.3}),o.jsx("stop",{offset:"95%",stopColor:"var(--chart-1)",stopOpacity:0})]}),o.jsx("pattern",{id:"pendingPatternVisibility",patternUnits:"userSpaceOnUse",width:"8",height:"8",patternTransform:"rotate(45)",children:o.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:"var(--muted-foreground)",strokeWidth:"2",strokeOpacity:"0.15"})})]}),o.jsx(fd,{strokeDasharray:"3 3",stroke:"var(--border)"}),o.jsx(No,{dataKey:"date",tick:{fontSize:11},tickFormatter:P=>new Date(P).toLocaleDateString("en-US",{month:"short",day:"numeric"}),stroke:"var(--muted-foreground)"}),o.jsx(jo,{tick:{fontSize:11},domain:[0,100],tickFormatter:P=>`${P}%`,stroke:"var(--muted-foreground)"}),o.jsx(Bn,{content:({active:P,payload:O,label:L})=>{var T,D,F,q,B;if(P&&O&&O.length){const z=lC(L);return o.jsxs("div",{className:"rounded-lg border bg-background px-3 py-2 shadow-sm",children:[o.jsxs("p",{className:"text-sm font-medium mb-1",children:[ree(L),z&&o.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:"(partial)"})]}),o.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[o.jsx("span",{className:"h-2 w-2 rounded-full bg-[var(--chart-1)]"}),o.jsxs("span",{children:["Visibility: ",(T=O[0])==null?void 0:T.value,"%"]})]}),o.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[(F=(D=O[0])==null?void 0:D.payload)==null?void 0:F.mentions," / ",(B=(q=O[0])==null?void 0:q.payload)==null?void 0:B.totalRuns," runs"]})]})}return null}}),e.trend.some(P=>lC(P.date))&&o.jsx(Ih,{x1:cC(),x2:cC(),fill:"url(#pendingPatternVisibility)",fillOpacity:1,stroke:"var(--muted-foreground)",strokeOpacity:.2,strokeDasharray:"4 4",label:{value:"Today (partial)",position:"insideTop",fill:"var(--muted-foreground)",fontSize:10,dy:10}}),o.jsx(yl,{type:"monotone",dataKey:"visibilityRate",stroke:"var(--chart-1)",strokeWidth:2,fill:"url(#visibilityGradient)"})]})}):o.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:"No data available"})})})]}),o.jsxs(Ct,{className:"flex flex-col bg-background",children:[o.jsx(Lt,{className:"border-b",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("div",{children:o.jsx($t,{children:"Industry Ranking"})}),o.jsx(on,{children:o.jsxs(Ft,{children:[o.jsx(Ut,{children:o.jsx(xr,{className:"h-4 w-4 text-muted-foreground"})}),o.jsx(zt,{children:o.jsx("p",{children:"Brands ranked by how often they appear in AI responses. Your position shows how you compare to competitors across AI platforms."})})]})})]})}),o.jsx(Et,{className:"p-0 flex-1",children:M&&M.length>0?o.jsx("div",{className:"overflow-x-auto",children:o.jsxs("table",{className:"w-full card-table",children:[o.jsx("thead",{className:"bg-muted/50 h-12 border-b",children:o.jsxs("tr",{children:[o.jsx("th",{className:"px-4 text-left text-xs font-medium text-muted-foreground tracking-wider w-10",children:"#"}),o.jsx("th",{className:"px-4 text-left text-xs font-medium text-muted-foreground tracking-wider",children:"Brand"}),o.jsx("th",{className:"px-4 text-center text-xs font-medium text-muted-foreground tracking-wider",children:"Mentions"}),o.jsx("th",{className:"px-4 text-center text-xs font-medium text-muted-foreground tracking-wider",children:"Position"}),o.jsx("th",{className:"px-4 text-right text-xs font-medium text-muted-foreground tracking-wider",children:"Visibility"})]})}),o.jsx("tbody",{className:"divide-y divide-border",children:M.slice(0,7).map((P,O)=>o.jsxs("tr",{className:`hover:bg-accent/30 transition-colors ${P.isBrand?"bg-primary/5":""}`,children:[o.jsx("td",{className:"px-4 py-3 text-sm font-medium text-muted-foreground",children:O+1}),o.jsx("td",{className:"px-4 py-3",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ul,{name:P.name,logoUrl:P.logoUrl,website:P.website,size:"md"}),o.jsx("span",{className:"text-sm font-medium truncate",children:P.name}),P.isBrand&&o.jsx(Ge,{variant:"secondary",className:"text-[10px] h-4",children:"you"})]})}),o.jsx("td",{className:"px-4 py-3 text-center text-sm",children:P.mentions}),o.jsx("td",{className:"px-4 py-3 text-center",children:P.avgRank!==null?o.jsx("span",{className:"text-sm",children:P.avgRank.toFixed(1)}):o.jsx("span",{className:"text-muted-foreground",children:"—"})}),o.jsx("td",{className:"px-4 py-3 text-right",children:o.jsxs("span",{className:"text-sm font-semibold",children:[P.visibility,"%"]})})]},P.id))})]})}):o.jsx("div",{className:"flex h-32 items-center justify-center text-muted-foreground m-6",children:"No competitor data available"})})]})]}),o.jsxs("div",{className:"grid border-b gap-[1px] bg-border lg:grid-cols-2 items-stretch",children:[o.jsxs(Ct,{className:"flex flex-col bg-background",children:[o.jsx(Lt,{className:"border-b",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("div",{children:o.jsx($t,{children:"Share of Voice"})}),o.jsx(on,{children:o.jsxs(Ft,{children:[o.jsx(Ut,{children:o.jsx(xr,{className:"h-4 w-4 text-muted-foreground"})}),o.jsx(zt,{children:o.jsx("p",{children:"Your percentage of total brand mentions when AI platforms mention any brand. Shows how you compare to competitors in the conversation."})})]})})]})}),o.jsx(Et,{className:"pt-6 flex-1 flex flex-col",children:o.jsx("div",{className:"flex-1 min-h-[280px]",children:r!=null&&r.trend&&r.trend.length>0?o.jsx(Qi,{width:"100%",height:"100%",children:o.jsxs(fE,{data:r.trend,margin:{top:5,right:5,left:-20,bottom:0},children:[o.jsxs("defs",{children:[o.jsxs("linearGradient",{id:"sovGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[o.jsx("stop",{offset:"5%",
4967stopColor:"var(--chart-2)",stopOpacity:.3}),o.jsx("stop",{offset:"95%",stopColor:"var(--chart-2)",stopOpacity:0})]}),o.jsx("pattern",{id:"pendingPatternSov",patternUnits:"userSpaceOnUse",width:"8",height:"8",patternTransform:"rotate(45)",children:o.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:"var(--muted-foreground)",strokeWidth:"2",strokeOpacity:"0.15"})})]}),o.jsx(fd,{strokeDasharray:"3 3",stroke:"var(--border)"}),o.jsx(No,{dataKey:"date",tick:{fontSize:11},tickFormatter:P=>new Date(P).toLocaleDateString("en-US",{month:"short",day:"numeric"}),stroke:"var(--muted-foreground)"}),o.jsx(jo,{tick:{fontSize:11},domain:[0,"auto"],tickFormatter:P=>`${P}%`,stroke:"var(--muted-foreground)"}),o.jsx(Bn,{content:({active:P,payload:O,label:L})=>{var T,D;if(P&&O&&O.length){const F=(T=O[0])==null?void 0:T.payload,q=lC(L);return o.jsxs("div",{className:"rounded-lg border bg-background px-3 py-2 shadow-sm",children:[o.jsxs("p",{className:"text-sm font-medium mb-1",children:[ree(L),q&&o.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:"(partial)"})]}),o.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[o.jsx("span",{className:"h-2 w-2 rounded-full bg-[var(--chart-2)]"}),o.jsxs("span",{children:["Share of Voice: ",(D=O[0])==null?void 0:D.value,"%"]})]}),o.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[F==null?void 0:F.brandMentions," mentions"]})]})}return null}}),r.trend.some(P=>lC(P.date))&&o.jsx(Ih,{x1:cC(),x2:cC(),fill:"url(#pendingPatternSov)",fillOpacity:1,stroke:"var(--muted-foreground)",strokeOpacity:.2,strokeDasharray:"4 4",label:{value:"Today (partial)",position:"insideTop",fill:"var(--muted-foreground)",fontSize:10,dy:10}}),o.jsx(yl,{type:"monotone",dataKey:"shareOfVoice",stroke:"var(--chart-2)",strokeWidth:2,fill:"url(#sovGradient)"})]})}):o.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:"No data available"})})})]}),o.jsxs(Ct,{className:"flex flex-col bg-background",children:[o.jsx(Lt,{className:"border-b",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("div",{children:o.jsx($t,{children:"Share of Voice Ranking"})}),o.jsx(on,{children:o.jsxs(Ft,{children:[o.jsx(Ut,{children:o.jsx(xr,{className:"h-4 w-4 text-muted-foreground"})}),o.jsx(zt,{children:o.jsx("p",{children:"Brands ranked by their share of all brand conversations. Shows your percentage of total brand mentions when AI platforms mention any brand."})})]})})]})}),o.jsx(Et,{className:"p-0 flex-1",children:k!=null&&k.rankings&&k.rankings.length>0?o.jsx("div",{className:"overflow-x-auto",children:o.jsxs("table",{className:"w-full card-table",children:[o.jsx("thead",{className:"bg-muted/50 h-12 border-b",children:o.jsxs("tr",{children:[o.jsx("th",{className:"px-4 text-left text-xs font-medium text-muted-foreground tracking-wider w-10",children:"#"}),o.jsx("th",{className:"px-4 text-left text-xs font-medium text-muted-foreground tracking-wider",children:"Brand"}),o.jsx("th",{className:"px-4 text-center text-xs font-medium text-muted-foreground tracking-wider",children:"Sentiment"}),o.jsx("th",{className:"px-4 text-right text-xs font-medium text-muted-foreground tracking-wider",children:"Share"})]})}),o.jsx("tbody",{className:"divide-y divide-border",children:k.rankings.slice(0,7).map((P,O)=>o.jsxs("tr",{className:`hover:bg-accent/30 transition-colors ${P.isBrand?"bg-primary/5":""}`,children:[o.jsx("td",{className:"px-4 py-3 text-sm font-medium text-muted-foreground",children:O+1}),o.jsx("td",{className:"px-4 py-3",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ul,{name:P.name,logoUrl:"logoUrl"in P?P.logoUrl:null,website:"website"in P?P.website:null,size:"md"}),o.jsx("span",{className:"text-sm font-medium truncate",children:P.name}),P.isBrand&&o.jsx(Ge,{variant:"secondary",className:"text-[10px] h-4",children:"you"})]})}),o.jsx("td",{className:"px-4 py-3 text-center",children:P.sentiment!==null&&P.sentiment!==void 0?o.jsx(xa,{value:P.sentiment,size:"sm",className:"justify-center",tooltipTitle:`Avg. sentiment of ${P.sentiment} based on ${P.mentions} mention${P.mentions!==1?"s":""}`}):o.jsx("span",{className:"text-muted-foreground",children:"—"})}),o.jsx("td",{className:"px-4 py-3 text-right",children:o.jsxs("span",{className:"text-sm font-semibold",children:[P.shareOfVoice,"%"]})})]},P.id))})]})}):o.jsx("div",{className:"flex h-32 items-center justify-center text-muted-foreground m-6",children:"No data available"})})]})]}),o.jsxs(Ct,{className:"bg-background",children:[o.jsx(Lt,{className:"border-b",children:o.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[o.jsx($t,{children:"Source Domains"}),o.jsx(on,{children:o.jsxs(Ft,{children:[o.jsx(Ut,{children:o.jsx(xr,{className:"h-4 w-4 text-muted-foreground"})}),o.jsx(zt,{children:o.jsx("p",{children:"Domains most frequently cited in responses for your tracked queries."})})]})})]})}),o.jsx(Et,{className:"p-0",children:o.jsxs("div",{className:"flex flex-col md:flex-row",children:[o.jsx("div",{className:"flex-1 min-w-0",children:l!=null&&l.topDomains&&l.to
4967pDomains.length>0?o.jsx("div",{className:"overflow-x-auto",children:o.jsxs("table",{className:"w-full card-table",children:[o.jsx("thead",{className:"bg-muted/50 h-12 border-b",children:o.jsxs("tr",{children:[o.jsx("th",{className:"px-4 text-left text-xs font-medium text-muted-foreground tracking-wider",children:"Domain"}),o.jsx("th",{className:"text-left text-xs font-medium text-muted-foreground tracking-wider",children:"Source"}),o.jsx("th",{className:"px-4 text-center text-xs font-medium text-muted-foreground tracking-wider",children:o.jsx(on,{children:o.jsxs(Ft,{children:[o.jsxs(Ut,{className:"flex items-center gap-1 mx-auto uppercase",children:["Models",o.jsx(xr,{className:"h-3 w-3"})]}),o.jsx(zt,{children:o.jsx("p",{children:"AI models that cite this domain"})})]})})}),o.jsx("th",{className:"px-4 text-center text-xs font-medium text-muted-foreground tracking-wider",children:"Usage"}),o.jsx("th",{className:"px-4 text-left text-xs font-medium text-muted-foreground tracking-wider",children:o.jsx(on,{children:o.jsxs(Ft,{children:[o.jsxs(Ut,{className:"flex items-center gap-1 uppercase",children:["Type",o.jsx(xr,{className:"h-3 w-3"})]}),o.jsx(zt,{children:o.jsx("p",{children:"Top article formats from this domain that AI platforms cite"})})]})})})]})}),o.jsx("tbody",{className:"divide-y divide-border",children:l.topDomains.slice(0,12).map(P=>{var D,F;const O=l.overview.totalSources||1,L=Math.round(P.count/O*100*10)/10,T=()=>{var B,z;if(P.isOwn)return o.jsx(Ge,{className:"text-[10px] h-5 bg-green-500/10 text-green-600 border-green-500/20 hover:bg-green-500/20",children:"You"});if(P.isCompetitor)return o.jsx(Ge,{className:"text-[10px] h-5 bg-red-500/10 text-red-600 border-red-500/20 hover:bg-red-500/20",children:"Competitor"});const q=(z=(B=P.contentTypes)==null?void 0:B[0])==null?void 0:z.type;return q&&Sp[q]?o.jsx(Ge,{className:"text-[10px] h-5",variant:"outline",style:{backgroundColor:`${Sp[q].color}10`,borderColor:`${Sp[q].color}30`,color:Sp[q].color},children:Sp[q].label}):null};return o.jsxs("tr",{className:"hover:bg-accent/30 transition-colors",children:[o.jsx("td",{className:"px-4 py-3",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ul,{name:P.domain,website:P.domain,size:"lg"}),o.jsx("div",{className:"min-w-0 flex-1",children:o.jsx("div",{className:"flex items-center gap-2",children:o.jsxs("a",{href:`https://${P.domain}`,target:"_blank",rel:"noopener noreferrer",className:"text-sm font-medium hover:underline flex items-center gap-1",children:[P.domain,o.jsx(Wr,{className:"h-3 w-3 text-muted-foreground"})]})})})]})}),o.jsx("td",{children:T()}),o.jsx("td",{className:"px-4 py-3",children:o.jsxs("div",{className:"flex items-center justify-center",children:[(D=P.llmModels)==null?void 0:D.slice(0,3).map((q,B)=>o.jsx(on,{children:o.jsxs(Ft,{children:[o.jsx(Ut,{asChild:!0,children:o.jsx("div",{className:"h-6 w-6 rounded-full bg-muted flex items-center justify-center overflow-hidden -ml-1 first:ml-0 border-2 border-background",children:q.logoUrl?o.jsx(Hn,{src:q.logoUrl,alt:"",className:"h-4 w-4 object-contain"}):o.jsx("span",{className:"text-[9px] font-medium",children:q.name.charAt(0)})})}),o.jsx(zt,{children:o.jsx("p",{children:q.name})})]})},B)),(((F=P.llmModels)==null?void 0:F.length)||0)>3&&o.jsxs("span",{className:"text-[10px] text-muted-foreground ml-1",children:["+",P.llmModels.length-3]})]})}),o.jsxs("td",{className:"px-4 py-3 text-center text-sm font-medium",children:[L,"%"]}),o.jsx("td",{className:"px-4 py-3",children:o.jsx("div",{className:"flex flex-wrap items-center gap-1",children:P.contentTypes&&P.contentTypes.length>0?P.contentTypes.slice(0,2).map((q,B)=>{const z={ranked_list:"Ranked List",comparison:"Comparison",topic_guide:"Topic Guide",checklist:"Checklist",review:"Review",blog_post:"Blog",news:"News",tutorial:"Tutorial",other:"Other"};return o.jsx(Ge,{variant:"secondary",className:"text-[10px] h-5 font-normal",children:z[q.type]||q.type},B)}):o.jsx("span",{className:"text-muted-foreground text-xs",children:"—"})})})]},P.domain)})})]})}):o.jsx("div",{className:"flex h-48 items-center justify-center text-muted-foreground",children:"No source data available"})}),o.jsxs("div",{className:"w-full md:w-[240px] shrink-0 border-t md:border-t-0 md:border-l bg-background shadow-lg",children:[o.jsx("div",{className:"bg-muted/50 px-6 h-12 flex items-center border-b",children:o.jsx("span",{className:"text-xs font-medium text-muted-foreground tracking-wider up
4967percase",children:"Source Types"})}),o.jsx("div",{className:"py-3 px-6",children:I.length>0?o.jsxs("div",{className:"flex flex-col items-center",children:[o.jsx("div",{className:"h-[140px] w-full",children:o.jsx(Qi,{width:"100%",height:"100%",children:o.jsxs(LB,{children:[o.jsx(wc,{data:I,cx:"50%",cy:"50%",innerRadius:40,outerRadius:60,paddingAngle:5,cornerRadius:2,strokeWidth:0,dataKey:"value",children:I.map((P,O)=>o.jsx(B0,{fill:P.color},`cell-${O}`))}),o.jsx(Bn,{content:({active:P,payload:O})=>{var L;if(P&&O&&O.length){const T=(L=O[0])==null?void 0:L.payload;return o.jsxs("div",{className:"rounded-lg border bg-background px-3 py-2 shadow-sm",children:[o.jsx("p",{className:"text-sm font-medium",children:T.name}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:[T.value," sources"]})]})}return null}})]})})}),o.jsxs("div",{className:"text-center -mt-[90px] mb-[60px]",children:[o.jsx("p",{className:"text-xl font-bold",children:(l==null?void 0:l.overview.totalSources)||0}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Domains"})]}),o.jsx("div",{className:"w-full space-y-2",children:I.map((P,O)=>{const L=I.reduce((D,F)=>D+F.value,0),T=L>0?Math.round(P.value/L*100*10)/10:0;return o.jsxs("div",{className:"flex items-center justify-between text-xs",children:[o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:P.color}}),o.jsx("span",{className:"text-muted-foreground truncate",children:P.name})]}),o.jsx("div",{className:"flex items-center gap-1.5",children:o.jsxs("span",{className:"font-medium",children:[T,"%"]})})]},O)})})]}):o.jsx("div",{className:"flex h-32 items-center justify-center text-muted-foreground",children:o.jsxs("div",{className:"text-center",children:[o.jsx(Ose,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),o.jsx("p",{className:"text-xs",children:"No data"})]})})})]})]})})]})]})]})]})}function iee(t){const e=new Date(t),n=new Date;return e.toDateString()===n.toDateString()}function see(){return new Date().toISOString().split("T")[0]}function aee(t){const e=new Date(t),n=e.toLocaleDateString("en-US",{month:"short"}),r=e.getDate();return`${n} ${r}${r===1||r===21||r===31?"st":r===2||r===22?"nd":r===3||r===23?"rd":"th"}`}function XLt(t,e){const n=t||"Unknown";if(n.includes(": ")){const i=n.split(": ");return{modelName:i.slice(1).join(": "),provider:i[0]||"Provider"}}if(e!=null&&e.includes("/")){const i=e.split("/")[0]||"",s=i.charAt(0).toUpperCase()+i.slice(1);return{modelName:n,provider:s||"Provider"}}const r=["OpenAI","Google","Anthropic","Meta","Mistral","Cohere"];for(const i of r)if(n.startsWith(i+" "))return{modelName:n.slice(i.length+1),provider:i};return{modelName:n,provider:"Provider"}}const QLt=[{label:"Last 7 days",value:"7"},{label:"Last 14 days",value:"14"},{label:"Last 30 days",value:"30"},{label:"Last 90 days",value:"90"}];function JLt(){const{companyId:t}=Gr(),[e,n]=b.useState(null),[r,i]=b.useState(!0),[s,a]=b.useState(null),[l,c]=b.useState("7"),[u,d]=b.useState("all"),[f,h]=b.useState([]),[p,m]=b.useState(1),x=10,y=async()=>{if(t)try{i(!0),a(null);const v=new Date,N=new Date;N.setDate(v.getDate()-parseInt(l));const S=new URLSearchParams({startDate:N.toISOString().split("T")[0],endDate:v.toISOString().split("T")[0]});u!=="all"&&S.append("platform",u);const _=await Ce.get(`/companies/${t}/analytics/mentions?${S.toString()}`);n(_);const j=_.byPlatform.filter(A=>A.provider).map(A=>A.provider);h(j)}catch(v){a(v.message||"Failed to load mentions data")}finally{i(!1)}};b.useEffect(()=>{y()},[t,l,u]),b.useEffect(()=>{m(1)},[l,u]);const g=e!=null&&e.mentionedPrompts?e.mentionedPrompts.slice((p-1)*x,p*x):[],w=e!=null&&e.mentionedPrompts?Math.ceil(e.mentionedPrompts.length/x):0;return r&&!e?o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Mentions Analytics",noIndex:!0}),o.jsx("div",{className:"flex h-64 items-center justify-center",children:o.jsx(Me,{className:"h-8 w-8 animate-spin text-primary"})})]}):s?o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Mentions Analytics",noIndex:!0}),o.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-4",children:[o.jsx("p",{className:"text-destructive",children:s}),o.jsxs(le,{onClick:y,variant:"outline",children:[o.jsx(ws,{className:"h-4 w-4"}),"Retry"]})]})]}):o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Mentions Analytics",noIndex:!0}),o.jsxs("div",{className:"",children:[o.jsxs("div",{className:"flex items-center justify-between py-3 border-b bg-background px-6 sticky top-0 z-10",children:[o.jsx("h1",{className:"text-lg font-semibold",children:"Mentions Overview"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(Tr,{value:l,onValueChange:c,children:[o.jsx(yr,{className:"w-[130px] h-8 text-sm",children:o.jsx(Vr,{})}),o.jsx(vr,{children:QLt.map(v=>o.jsx(Ht,{value:v.value,children:v.label},v.value))})]}),o.jsxs(Tr,{value:u,onValueChange:d,children:[o.jsx(yr,{className:"w-[150px] h-8 text-sm",children:o.jsx(Vr,{placeholder:"All LLM Models"})}),o.jsxs(vr,{children:[o.jsx(Ht,{value:"all",children:"All LLM Models"}),f.map(v=>o.jsx(Ht,{value:v.id,children:v.displayName},v.id))]})]}),o.jsx(le,{onClick:y,variant:"outline",size:"sm",className:"h-8 w-8 p-0",disabled:r,children:o.jsx(ws,{className:`h-4 w-4 ${r?"animate-spin":""}`})})]})]}),o.jsxs("div",{className:"",children:[o.jsxs("div",{className:"grid sm:grid-cols-2 md:grid-cols-3 gap-[1px] bg-border border-b",children:[o.jsxs(Ct,{children:[o.jsxs(Lt,{className:"flex flex-row items-center justify-between pb-2",children:[o.jsx($t,{className:"text-sm font-medium text-muted-foreground",children:"Total Mentions"}),o.jsx(cTe,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Et,{children:[o.jsx("div",{className:"text-2xl font-bold",children:(e==null?void 0:e.overview.totalMentions)??0}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"combined prompt mentions & citations"})]})]}),o.jsxs(Ct,{children:[o.jsxs(Lt,{className:"flex flex-row items-center justify-between pb-2",children:[o.jsx($t,{className:"text-sm font-medium text-muted-foreground",children:"Prompt Mentions"}),o.jsx(Mo,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Et,{children:[o.jsx("div",{className:"text-2xl font-bold",children:(e==null?void 0:e.overview.totalPromptMentions)??0}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"direct mentions in AI responses"})]})]}),o.jsxs(Ct,{children:[o.jsxs(Lt,{className:"flex flex-row items-center justify-between pb-2",children:[o.jsx($t,{className:"text-sm font-medium text-muted-foreground",children:"Source Citations"}),o.jsx(iu,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Et,{children:[o.jsx("div",{className:"text-2xl font-bold",children:(e==null?void 0:e.overview.totalSourceCitations)??0}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"citations mentioning your brand"})]})]})]}),o.jsxs("div",{className:"grid border-b gap-[1px] bg-border lg:grid-cols-2 items-stretch",children:[o.jsxs(Ct,{className:"flex flex-col bg-background",children:[o.jsx(Lt,{className:"border-b",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("div",{children:o.jsx($t,{children:"Mentions & Citations Trend"})}),o.jsx(on,{children:o.jsxs(Ft,{children:[o.jsx(Ut,{children:o.jsx(xr,{className:"h-4 w-4 text-muted-foreground"})}),o.jsx(zt,{children:o.jsx("p",{children:"Daily mentions in AI responses and source citations."})})]})})]})}),o.jsx(Et,{className:"pt-6 flex-1 flex flex-col",children:o.jsx("div",{className:"flex-1 min-h-[280px]",children:e!=null&&e.trend&&e.trend.length>0?o.jsx(Qi,{width:"100%",height:"100%",children:o.jsxs(fE,{data:e.trend,margin:{top:5,right:5,left:-20,bottom:0},children:[o.jsxs("defs",{children:[o.jsxs("linearGradient",{id:"mentionsGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[o.jsx("stop",{offset:"5%",
4967stopColor:"var(--primary)",stopOpacity:.3}),o.jsx("stop",{offset:"95%",stopColor:"var(--primary)",stopOpacity:0})]}),o.jsxs("linearGradient",{id:"citationsGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[o.jsx("stop",{offset:"5%",stopColor:"var(--chart-2)",stopOpacity:.3}),o.jsx("stop",{offset:"95%",stopColor:"var(--chart-2)",stopOpacity:0})]}),o.jsx("pattern",{id:"pendingPatternMentions",patternUnits:"userSpaceOnUse",width:"8",height:"8",patternTransform:"rotate(45)",children:o.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:"var(--muted-foreground)",strokeWidth:"2",strokeOpacity:"0.15"})})]}),o.jsx(fd,{strokeDasharray:"3 3",stroke:"var(--border)"}),o.jsx(No,{dataKey:"date",tick:{fontSize:12},tickFormatter:v=>new Date(v).toLocaleDateString("en-US",{month:"short",day:"numeric"}),stroke:"var(--muted-foreground)"}),o.jsx(jo,{tick:{fontSize:12},stroke:"var(--muted-foreground)"}),o.jsx(Bn,{content:({active:v,payload:N,label:S})=>{var _,j;if(v&&N&&N.length){const A=iee(S);return o.jsxs("div",{className:"rounded-lg border bg-background px-3 py-2 shadow-sm",children:[o.jsxs("p",{className:"text-sm font-medium mb-1",children:[aee(S),A&&o.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:"(partial)"})]}),o.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[o.jsx("span",{className:"h-2 w-2 rounded-full",style:{backgroundColor:"var(--primary)"}}),o.jsxs("span",{children:["Prompt Mentions: ",(_=N[0])==null?void 0:_.value]})]}),o.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[o.jsx("span",{className:"h-2 w-2 rounded-full",style:{backgroundColor:"var(--chart-2)"}}),o.jsxs("span",{children:["Source Citations: ",(j=N[1])==null?void 0:j.value]})]})]})}return null}}),e.trend.some(v=>iee(v.date))&&o.jsx(Ih,{x1:see(),x2:see(),fill:"url(#pendingPatternMentions)",fillOpacity:1,stroke:"var(--muted-foreground)",strokeOpacity:.2,strokeDasharray:"4 4",label:{value:"Today (partial)",position:"insideTop",fill:"var(--muted-foreground)",fontSize:10,dy:10}}),o.jsx(yl,{type:"monotone",dataKey:"promptMentions",name:"Prompt Mentions",stroke:"var(--primary)",strokeWidth:2,fill:"url(#mentionsGradient)"}),o.jsx(yl,{type:"monotone",dataKey:"sourceCitations",name:"Source Citations",stroke:"var(--chart-2)",strokeWidth:2,fill:"url(#citationsGradient)"})]})}):o.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:"No data available"})})})]}),o.jsxs(Ct,{className:"flex flex-col bg-background",children:[o.jsx(Lt,{className:"border-b",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("div",{children:o.jsx($t,{children:"Performance by LLM Model"})}),o.jsx(on,{children:o.jsxs(Ft,{children:[o.jsx(Ut,{children:o.jsx(xr,{className:"h-4 w-4 text-muted-foreground"})}),o.jsx(zt,{children:o.jsx("p",{children:"Which AI models mention your brand most."})})]})})]})}),o.jsx(Et,{className:"p-0 flex-1",children:e!=null&&e.byPlatform&&e.byPlatform.length>0?o.jsx("div",{className:"overflow-x-auto",children:o.jsxs("table",{className:"w-full card-table",children:[o.jsx("thead",{className:"bg-muted/50 h-12 border-b",children:o.jsxs("tr",{children:[o.jsx("th",{className:"px-4 text-left text-xs font-medium text-muted-foreground tracking-wider",children:"Model"}),o.jsx("th",{className:"px-4 text-center text-xs font-medium text-muted-foreground tracking-wider",children:"Mentions"}),o.jsx("th",{className:"px-4 text-center text-xs font-medium text-muted-foreground tracking-wider",children:"Rate"})]})}),o.jsx("tbody",{className:"divide-y divide-border",children:e.byPlatform.slice(0,5).map(v=>{var S,_,j,A,C;const{modelName:N}=XLt((S=v.provider)==null?void 0:S.displayName,(_=v.provider)==null?void 0:_.name);return o.jsxs("tr",{className:"hover:bg-accent/30 transition-colors",children:[o.jsx("td",{className:"px-4 py-3",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"h-8 w-8 shrink-0 rounded bg-muted flex items-center justify-center",children:(j=v.provider)!=null&&j.logoUrl?o.jsx(Hn,{src:v.provider.logoUrl,alt:"",className:"h-5 w-5 object-contain"}):o.jsx("span",{className:"text-xs font-medium",children:((C=(A=v.provider)==null?void 0:A.displayName)==null?void 0:C.charAt(0))||"?"})}),o.jsx("p",{className:"text-sm font-medium truncate",children:N})]})}),o.jsx("td",{className:"px-4 py-3 text-center",children:o.jsx("span",{className:"text-sm font-semibold",children:v.mentions})}),o.jsx("td",{className:"px-4 py-3 text-center",children:o.jsx(nr,{value:v.mentionRate,size:"md",variant:"percentage",className:"mx-auto"})})]},v.llmProviderId)})})]})}):o.jsx("div",{className:"flex h-32 items-center justify-center text-muted-foreground",children:"No LLM model data available"})})]})]}),o.jsxs(Ct,{className:"bg-background",children:[o.jsx(Lt,{className:"border-b",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("div",{children:o.jsx($t,{children:"Prompts That Mentioned Your Brand"})}),o.jsx(on,{children:o.jsxs(Ft,{children:[o.jsx(Ut,{children:o.jsx(xr,{className:"h-4 w-4 text-muted-foreground"})}),o.jsx(zt,{children:o.jsx("p",{children:"Recent AI responses that included your brand."})})]})})]})}),o.jsx(Et,{className:"p-0",children:e!=null&&e.mentionedPrompts&&e.mentionedPrompts.length>0?o.jsxs("div",{className:"overflow-x-auto",children:[o.jsxs("table",{className:"w-full card-table",children:[o.jsx("thead",{className:"bg-muted/50 h-12 border-b",children:o.jsxs("tr",{children:[o.jsx("th",{className:"px-4 text-left text-xs font-medium text-muted-foreground tracking-wider",children:"Prompt"}),o.jsx("th",{className:"px-4 text-left text-xs font-medium text-muted-foreground tracking-wider whitespace-nowrap",children:"LLM"}),o.jsx("th",{className:"px-4 text-center text-xs font-medium text-muted-foreground tracking-wider",children:"Rank"}),o.jsx("th",{className:"px-4 text-center text-xs font-medium text-muted-foreground tracking-wider",children:"Sentiment"}),o.jsx("th",{className:"px-4 text-center text-xs font-medium text-muted-foreground tracking-wider",children:"Sources"}),o.jsx("th",{className:"px-4 text-center text-xs font-medium text-muted-foreground tracking-wider",children:"Date"}),o.jsx("th",{className:"px-4 w-24"})]})}),o.jsx("tbody",{className:"divide-y divide-border",children:g.map(v=>{var N,S,_,j,A,C;return o.jsxs("tr",{className:"hover:bg-accent/50 transition-colors",children:[o.jsx("td",{className:"px-4 py-3 min-w-[250px]",children:o.jsx(Mt,{to:`/company/${t}/prompts/${v.queryId}`,className:"text-sm hover:underline line-clamp-2",children:v.promptText})}),o.jsx("td",{className:"px-4 py-3 whitespace-nowrap",children:(N=v.llmProvider)!=null&&N.logoUrl?o.jsx(Hn,{src:v.llmProvider.logoUrl,alt:(S=v.llmProvider)==null?void 0:S.displayName,title:(_=v.llmProvider)==null?void 0:_.displayName,className:"h-6 w-6 rounded object-contain"}):o.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded bg-muted text-xs",title:(j=v.llmProvider)==null?void 0:j.displayName,children:((C=(A=v.llmProvider)==null?void 0:A.displayName)==null?void 0:C.charAt(0))||"?"})}),o.jsx("td",{className:"px-4 py-3 text-center whitespace-nowrap",children:v.rankPosition?o.jsx(nr,{value:v.rankPosition,size:"md",variant:"rank",className:"mx-auto"}):o.jsx("span",{className:"text-muted-foreground",children:"—"})}),o.jsx("td",{className:"px-4 py-3 text-center whitespace-nowrap",children:v.sentimentScore!==null?o.jsx(xa,{value:v.sentimentScore,size:"md",className:"justify-center",tooltipTitle:`Sentiment score of ${v.sentimentScore}`}):o.jsx("span",{className:"text-muted-foreground",children:"—"})}),o.jsx("td",{className:"px-4 py-3 whitespace-nowrap",children:v.sources&&v.sources.length>0?o.jsx(v1t,{sources:v.sources,max:4,size:"sm",totalCount:v.sourceCount}):o.jsx("span",{className:"text-muted-foreground",children:"—"})}),o.jsx("td",{className:"px-4 py-3 text-center text-sm text-muted-foreground whitespace-nowrap",children:aee(v.createdAt)}),o.jsx("td",{className:"px-4 py-3 whitespace-nowrap",children:o.jsx(Mt,{to:`/company/${t}/prompts/${v.queryId}/studio?run=${v.id}`,children:o.jsxs(le,{variant:"studio",size:"xs",children:[o.jsx(pr,{className:"mr-1 h-3 w-3"}),"Studio"]})})})]},v.id)})})]}),w>1&&o.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-t",children:[o.jsxs("p",{className:"text-sm text-muted-foreground",children:["Showing ",(p-1)*x+1," to ",Math.min(p*x,e.mentionedPrompts.length)," of ",e.mentionedPrompts.length," prompts"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(le,{variant:"outline",size:"sm",onClick:()=>m(v=>Math.max(1,v-1)),disabled:p===1,children:o.jsx(wd,{className:"h-4 w-4"})}),o.jsxs("span",{className:"text-sm",children:["Page ",p," of ",w]}),o.jsx(le,{variant:"outline",size:"sm",onClick:()=>m(v=>Math.min(w,v+1)),disabled:p===w,children:o.jsx(Ga,{className:"h-4 w-4"})})]})]})]}):o.jsx("div",{className:"flex h-32 items-center justify-center text-muted-foreground",children:"No mentioned prompts in the selected period"})})]})]})]})]})}function oee(t){const e=new Date(t),n=new Date;return e.toDateString()===n.toDateString()}function lee(){return new Date().toISOString().split("T")[0]}const ZLt=[{label:"Last 7 days",value:"7"},{label:"Last 14 days",value:"14"},{label:"Last 30 days",value:"30"},{label:"Last 90 days",value:"90"}],D3={you:{label:"You",color:"#22c55e",description:"Your own domain"},competitor:{label:"Competitor",color:"#ef4444",description:"Competitor company website"},non_competitor:{label:"Non-Competitor",color:"#6366f1",description:"Company website (not a competitor)"},editorial:{label:"Editorial",color:"#8b5cf6",description:"News, magazines, editorial content"},institutional:{label:"Institutional",color:"#0ea5e9",description:"Government, education, research institutions"},review:{label:"Review",color:"#f59e0b",description:"Review sites and comparison platforms"},social:{label:"Social",color:"#ec4899",description:"Social media platforms"},forum:{label:"Forum",color:"#14b8a6",description:"Forums and community discussions"},other:{label:"Other",color:"#94a3b8",description:"Other source types"}},ew={ranked_list:"Ranked List",comparison:"Comparison",topic_guide:"Topic Guide",checklist:"Checklist",review:"Review",blog_post:"Blog",news:"News",tutorial:"Tutorial",competitor_website:"Competitor",own_website:"Own Website",other:"Other"},cee=["var(--chart-2)","var(--chart-3)","var(--chart-4)","var(--chart-5)","var(--muted-foreground)"];function e$t(t){const e=new Date(t),n=e.toLocaleDateString("en-US",{month:"short"}),r=e.getDate();return`${n} ${r}${r===1||r===21||r===31?"st":r===2||r===22?"nd":r===3||r===23?"rd":"th"}`}function uee(t,e,n){const r=b.useRef(null);return b.useCallback(s=>
4967{n||(r.current&&r.current.disconnect(),r.current=new IntersectionObserver(a=>{var l;(l=a[0])!=null&&l.isIntersecting&&e&&!n&&t()},{threshold:.1}),s&&r.current.observe(s))},[t,e,n])}function t$t(){const{companyId:t}=Gr(),[e,n]=b.useState(null),[r,i]=b.useState(!0),[s,a]=b.useState(null),[l,c]=b.useState("7"),[u,d]=b.useState("domains"),[f,h]=b.useState([]),[p,m]=b.useState(!1),[x,y]=b.useState(!1),[g,w]=b.useState(0),[v,N]=b.useState([]),[S,_]=b.useState(!1),[j,A]=b.useState(!1),[C,k]=b.useState(0),[M,I]=b.useState([]),[R,E]=b.useState(!1),P=b.useCallback(()=>{const G=new Date,K=new Date;return K.setDate(G.getDate()-parseInt(l)),new URLSearchParams({startDate:K.toISOString().split("T")[0],endDate:G.toISOString().split("T")[0]})},[l]),O=async()=>{if(t)try{i(!0),a(null);const G=P(),K=await Ce.get(`/companies/${t}/analytics/sources?${G.toString()}`);n(K)}catch(G){a(G.message||"Failed to load sources data")}finally{i(!1)}},L=b.useCallback(async(G=!1)=>{if(!(!t||x))try{y(!0);const K=P(),ee=G?0:f.length;K.set("limit","50"),K.set("offset",String(ee));const V=await Ce.get(`/companies/${t}/analytics/sources/domains?${K.toString()}`);h(G?V.items:J=>[...J,...V.items]),m(V.hasMore),w(V.totalCount)}catch(K){console.error("Failed to fetch domains:",K)}finally{y(!1)}},[t,f.length,x,P]),T=b.useCallback(async(G=!1)=>{if(!(!t||j))try{A(!0);const K=P(),ee=G?0:v.length;K.set("limit","50"),K.set("offset",String(ee));const V=await Ce.get(`/companies/${t}/analytics/sources/urls?${K.toString()}`);N(G?V.items:J=>[...J,...V.items]),_(V.hasMore),k(V.totalCount)}catch(K){console.error("Failed to fetch urls:",K)}finally{A(!1)}},[t,v.length,j,P]),D=b.useCallback(async()=>{if(!(!t||R))try{E(!0);const G=P(),K=await Ce.get(`/companies/${t}/analytics/sources/content-types?${G.toString()}`);I(K.items)}catch(G){console.error("Failed to fetch content types:",G)}finally{E(!1)}},[t,R,P]);b.useEffect(()=>{O()},[t,l]),b.useEffect(()=>{u==="domains"?(h([]),L(!0)):u==="urls"?(N([]),T(!0)):u==="contentTypes"&&D()},[u,l,t]);const F=uee(()=>L(!1),p,x),q=uee(()=>T(!1),S,j),B=b.useMemo(()=>e!=null&&e.bySourceType?e.bySourceType.map(G=>{var K,ee;return{name:((K=D3[G.sourceType])==null?void 0:K.label)||G.sourceType,value:G.count,color:((ee=D3[G.sourceType])==null?void 0:ee.color)||"#94a3b8"}}):[],[e]),z=b.useMemo(()=>{if(u==="contentTypes"&&M.length>0){const K={ranked_list:"#8b5cf6",topic_guide:"#0ea5e9",comparison:"#f59e0b",review:"#ec4899",checklist:"#14b8a6",blog_post:"#6366f1",news:"#ef4444",tutorial:"#22c55e",other:"#94a3b8"};return M.map(ee=>({name:ew[ee.contentType]||ee.contentType,value:ee.totalUsed,color:K[ee.contentType]||"#94a3b8"}))}if(!(e!=null&&e.byContentType))return[];const G={ranked_list:"#8b5cf6",topic_guide:"#0ea5e9",comparison:"#f59e0b",review:"#ec4899",checklist:"#14b8a6",blog_post:"#6366f1",news:"#ef4444",tutorial:"#22c55e",other:"#94a3b8"};return e.byContentType.map(K=>({name:ew[K.contentType]||K.contentType,value:K.count,color:G[K.contentType]||"#94a3b8"}))},[e,M,u]),H=b.useMemo(()=>u==="domains"?B:z,[u,B,z]),W=b.useMemo(()=>u==="domains"?"Source Types":"Article Types",[u]);return r&&!e?o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Sources Analytics",noIndex:!0}),o.jsx("div",{className:"flex h-64 items-center justify-center",children:o.jsx(Me,{className:"h-8 w-8 animate-spin text-primary"})})]}):s?o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Sources Analytics",noIndex:!0}),o.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-4",children:[o.jsx("p",{className:"text-destructive",children:s}),o.jsxs(le,{onClick:O,variant:"outline",children:[o.jsx(ws,{className:"h-4 w-4"}),"Retry"]})]})]}):o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Sources Analytics",noIndex:!0}),o.jsxs("div",{className:"",children:[o.jsxs("div",{className:"flex items-center justify-between py-3 border-b bg-background px-6 sticky top-0 z-10",children:[o.jsx("h1",{className:"text-lg font-semibold",children:"Sources Overview"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(Tr,{value:l,onValueChange:c,children:[o.jsx(yr,{className:"w-[130px] h-8 text-sm",children:o.jsx(Vr,{})}),o.jsx(vr,{children:ZLt.map(G=>o.jsx(Ht,{value:G.value,children:G.label},G.value))})]}),o.jsx(le,{onClick:O,variant:"outline",size:"sm",className:"h-8 w-8 p-0",disabled:r,children:o.jsx(ws,{className:`h-4 w-4 ${r?"animate-spin":""}`})})]})]}),o.jsxs("div",{className:"",children:[o.jsxs("div",{className:"grid sm:grid-cols-2 md:grid-cols-4 gap-[1px] bg-border border-b",children:[o.jsxs(Ct,{children:[o.jsxs(Lt,{className:"flex flex-row items-center justify-between pb-2",children:[o.jsx($t,{className:"text-sm font-medium text-muted-foreground",children:"Total Citations"}),o.jsx(iu,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Et,{children:[o.jsx("div",{className:"text-2xl font-bold",children:(e==null?void 0:e.overview.totalSources)??0}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"source links in AI responses"})]})]}),o.jsxs(Ct,{children:[o.jsxs(Lt,{className:"flex flex-row items-center justify-between pb-2",children:[o.jsx($t,{className:"text-sm font-medium text-muted-foreground",children:"Your Website"}),o.jsx(vTe,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Et,{children:[o.jsx("div",{className:"text-2xl font-bold",children:(e==null?void 0:e.overview.ownWebsiteSources)??0}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"citations to your domain"})]})]}),o.jsxs(Ct,{children:[o.jsxs(Lt,{className:"flex flex-row items-center justify-between pb-2",children:[o.jsx($t,{className:"text-sm font-medium text-muted-foreground",children:"Competitors"}),o.jsx(lv,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Et,{children:[o.jsx("div",{className:"text-2xl font-bold",children:(e==null?void 0:e.overview.competitorSources)??0}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"citations to competitor sites"})]})]}),o.jsxs(Ct,{children:[o.jsxs(Lt,{className:"flex flex-row items-center justify-between pb-2",children:[o.jsx($t,{className:"text-sm font-medium text-muted-foreground",children:"Brand Mentions"}),o.jsx(To,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Et,{children:[o.jsx("div",{className:"text-2xl font-bold",children:(e==null?void 0:e.overview.brandMentions)??0}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"sources mentioning your brand"})]})]})]}),o.jsxs("div",{className:"grid border-b gap-[1px] bg-border lg:grid-cols-2 items-stretch",children:[o.jsxs(Ct,{className:"flex flex-col bg-background",children:[o.jsx(Lt,{className:"border-b",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("div",{children:o.jsx($t,{children:"Sources"})}),o.jsx(on,{children:o.jsxs(Ft,{children:[o.jsx(Ut,{children:o.jsx(xr,{className:"h-4 w-4 text-muted-foreground"})}),o.jsx(zt,{children:o.jsx("p",{children:"Shows how often AI models cite your website compared to top competitor websites in their responses."})})]})})]})}),o.jsx(Et,{className:"pt-6 flex-1 flex flex-col",children:o.jsx("div",{className:"flex-1 min-h-[280px]",children:e!=null&&e.trend&&e.trend.length>0?o.jsx(Qi,{width:"100%",height:"100%",children:o.jsxs(Dh,{data:e.trend,margin:{top:5,right:5,left:-20,bottom:5},children:[o.jsx("defs",{children:o.jsx("pattern",{id:"pendingPatternSources",patternUnits:"userSpaceOnUse",width:"8",he
4967ight:"8",patternTransform:"rotate(45)",children:o.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:"var(--muted-foreground)",strokeWidth:"2",strokeOpacity:"0.15"})})}),o.jsx(fd,{strokeDasharray:"3 3",stroke:"var(--border)"}),o.jsx(No,{dataKey:"date",tick:{fontSize:11},tickFormatter:G=>new Date(G).toLocaleDateString("en-US",{month:"short",day:"numeric"}),stroke:"var(--muted-foreground)"}),o.jsx(jo,{tick:{fontSize:11},stroke:"var(--muted-foreground)"}),o.jsx(Bn,{content:({active:G,payload:K,label:ee})=>{if(G&&K&&K.length){const V=oee(ee);return o.jsxs("div",{className:"rounded-lg border bg-background px-3 py-2 shadow-sm",children:[o.jsxs("p",{className:"text-sm font-medium mb-2",children:[e$t(ee),V&&o.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:"(partial)"})]}),K.map((J,Y)=>o.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[o.jsx("span",{className:"h-2 w-2 rounded-full",style:{backgroundColor:J.color}}),o.jsxs("span",{children:[J.name,": ",J.value||0]})]},Y))]})}return null}}),o.jsx(cd,{verticalAlign:"bottom",height:36,iconType:"circle",iconSize:8,formatter:G=>o.jsx("span",{className:"text-xs text-muted-foreground",children:G})}),e.trend.some(G=>oee(G.date))&&o.jsx(Ih,{x1:lee(),x2:lee(),fill:"url(#pendingPatternSources)",fillOpacity:1,stroke:"var(--muted-foreground)",strokeOpacity:.2,strokeDasharray:"4 4",label:{value:"Today (partial)",position:"insideTop",fill:"var(--muted-foreground)",fontSize:10,dy:10}}),o.jsx(Po,{type:"monotone",dataKey:"you",name:"You",stroke:"var(--primary)",strokeWidth:2,dot:!1,activeDot:{r:4}}),e.topCompetitorDomains.map((G,K)=>o.jsx(Po,{type:"monotone",dataKey:ee=>{var V;return((V=ee.competitors)==null?void 0:V[G])||0},name:G.length>12?G.substring(0,12)+"...":G,stroke:cee[K%cee.length],strokeWidth:2,strokeDasharray:"5 5",dot:!1,activeDot:{r:4}},G))]})}):o.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:"No data available"})})})]}),o.jsxs(Ct,{className:"flex flex-col bg-background",children:[o.jsx(Lt,{className:"border-b",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("div",{children:o.jsx($t,{children:"Brand Sources"})}),o.jsx(on,{children:o.jsxs(Ft,{children:[o.jsx(Ut,{children:o.jsx(xr,{className:"h-4 w-4 text-muted-foreground"})}),o.jsx(zt,{children:o.jsx("p",{children:"Pages from your website that are being cited by AI platforms in their responses."})})]})})]})}),o.jsx(Et,{className:"p-0 flex-1 overflow-hidden",children:e!=null&&e.brandSources&&e.brandSources.length>0?o.jsx("div",{className:"overflow-x-auto",children:o.jsxs("table",{className:"w-full card-table",children:[o.jsx("thead",{className:"bg-muted/50 sticky top-0 h-12 border-b",children:o.jsxs("tr",{children:[o.jsx("th",{className:"px-4 text-left text-xs font-medium text-muted-foreground tracking-wider",children:"Page"}),o.jsx("th",{className:"px-4 text-center text-xs font-medium text-muted-foreground tracking-wider",children:"Platform"}),o.jsx("th",{className:"px-4 text-right text-xs font-medium text-muted-foreground tracking-wider",children:"Usage"})]})}),o.jsx("tbody",{className:"divide-y divide-border",children:e.brandSources.slice(0,6).map((G,K)=>{var V,J;let ee=G.url;try{const Y=new URL(G.url);ee=Y.pathname==="/"?Y.hostname:Y.pathname}catch{}return o.jsxs("tr",{className:"hover:bg-accent/30 transition-colors",children:[o.jsx("td",{className:"px-4 py-3",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ul,{name:new URL(G.url).hostname,website:new URL(G.url).hostname,size:"md"}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("a",{href:G.url,target:"_blank",rel:"noopener noreferrer",className:"text-sm font-medium hover:underline line-clamp-1",children:G.title||ee}),o.jsx("p",{className:"text-xs text-muted-foreground line-clamp-1",children:G.url})]})]})}),o.jsx("td",{className:"px-4 py-3",children:o.jsxs("div",{className:"flex items-center justify-center",children:[(V=G.llmModels)==null?void 0:V.slice(0,3).map((Y,$)=>o.jsx(on,{children:o.jsxs(Ft,{children:[o.jsx(Ut,{asChild:!0,children:o.jsx("div",{className:"h-5 w-5 rounded-full bg-muted flex items-center justify-center overflow-hidden -ml-1 first:ml-0 border border-background",children:Y.logoUrl?o.jsx(Hn,{src:Y.logoUrl,alt:"",className:"h-3.5 w-3.5 object-contain"}):o.jsx("span",{className:"text-[8px] font-medium",children:Y.name.charAt(0)})})}),o.jsx(zt,{children:o.jsx("p",{children:Y.name})})]})},$)),(((J=G.llmModels)==null?void 0:J.length)||0)>3&&o.jsxs("span",{className:"text-[10px] text-muted-foreground ml-1",children:["+",G.llmModels.length-3]})]})}),o.jsxs("td",{className:"px-4 py-3 text-right text-sm",children:[G.usagePercent,"%"]})]},K)})})]})}):o.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground p-8",children:o.jsx("p",{className:"text-sm",children:"No brand sources in the selected period"})})})]})]}),o.jsxs(Ct,{className:"overflow-hidden bg-background",children:[o.jsx(Lt,{className:"border-b pb-4",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx($t,{children:"Source Citations"}),o.jsx(on,{children:o.jsxs(Ft,{children:[o.jsx(Ut,{children:o.jsx(xr,{className:"h-4 w-4 text-muted-foreground"})}),o.jsx(zt,{children:o.jsx("p",{children:"Sources cited in AI responses for your tracked queries."})})]})})]}),o.jsx(J0,{value:u,onValueChange:G=>d(G),children:o.jsxs(Bg,{className:"h-12 rounded-lg bg-muted/20 border",children:[o.jsxs(pi,{value:"domains",className:"text-sm px-2 h-full gap-1.5 rounded-none rounded-l-lg border border-r-0",children:[o.jsx(To,{className:"h-3.5 w-3.5"}),"Domains",g>0&&o.jsx(Ge,{variant:"secondary",className:"h-4 px-1 text-[10px] font-normal ml-1",children:g.toLocaleStr
4967ing()})]}),o.jsxs(pi,{value:"urls",className:"text-sm px-2 h-full gap-1.5 rounded-none border",children:[o.jsx(Vse,{className:"h-3.5 w-3.5"}),"URLs",C>0&&o.jsx(Ge,{variant:"secondary",className:"h-4 px-1 text-[10px] font-normal ml-1",children:C.toLocaleString()})]}),o.jsxs(pi,{value:"contentTypes",className:"text-sm px-2 h-full gap-1.5 rounded-none rounded-r-lg border border-l-0",children:[o.jsx(Ao,{className:"h-3.5 w-3.5"}),"Content Types"]})]})})]})}),o.jsx(Et,{className:"p-0",children:o.jsxs("div",{className:"flex flex-col md:flex-row",children:[o.jsxs("div",{className:"flex-1 min-w-0 flex flex-col",children:[u==="domains"&&o.jsxs(o.Fragment,{children:[o.jsx("table",{className:"w-full table-fixed card-table",children:o.jsx("thead",{className:"bg-muted/50 h-12 border-b",children:o.jsxs("tr",{children:[o.jsx("th",{className:"px-4 text-left text-xs font-medium text-muted-foreground tracking-wider w-14",children:"Rank"}),o.jsx("th",{className:"px-4 text-left text-xs font-medium text-muted-foreground tracking-wider",children:"Domain"}),o.jsx("th",{className:"px-4 text-center text-xs font-medium text-muted-foreground tracking-wider w-24",children:o.jsx(on,{children:o.jsxs(Ft,{children:[o.jsxs(Ut,{className:"flex items-center gap-1 mx-auto uppercase",children:["Models",o.jsx(xr,{className:"h-3 w-3"})]}),o.jsx(zt,{children:o.jsx("p",{children:"AI models that cite this domain"})})]})})}),o.jsx("th",{className:"px-4 text-center text-xs font-medium text-muted-foreground tracking-wider w-25",children:"Usage %"}),o.jsx("th",{className:"px-4 text-left text-xs font-medium text-muted-foreground tracking-wider w-40",children:o.jsx(on,{children:o.jsxs(Ft,{children:[o.jsxs(Ut,{className:"flex items-center gap-1 uppercase",children:["Article Types",o.jsx(xr,{className:"h-3 w-3"})]}),o.jsx(zt,{children:o.jsx("p",{children:"Top article formats from this domain"})})]})})})]})})}),o.jsxs("div",{className:"h-[443px] overflow-y-auto",children:[f.length>0?o.jsx("table",{className:"w-full table-fixed card-table",children:o.jsx("tbody",{className:"divide-y divide-border",children:f.map(G=>{var ee,V;const K=()=>{if(G.isOwn)return o.jsx(Ge,{className:"text-[10px] h-5 bg-green-500/10 text-green-600 border-green-500/20 hover:bg-green-500/20",children:"You"});if(G.isCompetitor)return o.jsx(Ge,{className:"text-[10px] h-5 bg-red-500/10 text-red-600 border-red-500/20 hover:bg-red-500/20",children:"Competitor"});const J=D3[G.sourceType];return J?o.jsx(Ge,{className:"text-[10px] h-5",variant:"outline",style:{backgroundColor:`${J.color}10`,borderColor:`${J.color}30`,color:J.color},children:J.label}):null};return o.jsxs("tr",{className:"hover:bg-accent/30 transition-colors",children:[o.jsx("td",{className:"px-4 py-3 text-sm text-muted-foreground w-14",children:G.rank}),o.jsx("td",{className:"px-4 py-3",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ul,{name:G.domain,website:G.domain,size:"lg"}),o.jsx("div",{className:"min-w-0 flex-1",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("a",{href:`https://${G.domain}`,target:"_blank",rel:"noopener noreferrer",className:"text-sm font-medium hover:underline flex items-center gap-1",children:[G.domain,o.jsx(Wr,{className:"h-3 w-3 text-muted-foreground"})]}),K()]})})]})}),o.jsx("td",{className:"px-4 py-3 w-24",children:o.jsxs("div",{className:"flex items-center justify-center",children:[(ee=G.llmModels)==null?void 0:ee.slice(0,3).map((J,Y)=>o.jsx(on,{children:o.jsxs(Ft,{children:[o.jsx(Ut,{asChild:!0,children:o.jsx("div",{className:"h-6 w-6 rounded-full bg-muted flex items-center justify-center overflow-hidden -ml-1 first:ml-0 border-2 border-background",children:J.logoUrl?o.jsx(Hn,{src:J.logoUrl,alt:"",className:"h-4 w-4 object-contain"}):o.jsx("span",{className:"text-[9px] font-medium",children:J.name.charAt(0)})})}),o.jsx(zt,{children:o.jsx("p",{children:J.name})})]})},Y)),(((V=G.llmModels)==null?void 0:V.length)||0)>3&&o.jsxs("span",{className:"text-[10px] text-muted-foreground ml-1",children:["+",G.llmModels.length-3]}),(!G.llmModels||G.llmModels.length===0)&&o.jsx("span",{className:"text-muted-foreground text-xs",children:"—"})]})}),o.jsxs("td",{className:"px-4 py-3 text-center text-sm font-medium w-20",children:[G.usagePercent,"%"]}),o.jsx("td",{className:"px-4 py-3 w-40",children:o.jsx("div",{className:"flex flex-wrap items-center gap-1",children:G.contentTypes&&G.contentTypes.length>0?G.contentTypes.slice(0,2).map((J,Y)=>o.jsx(Ge,{variant:"secondary",className:"text-[10px] h-5 font-normal",children:ew[J.type]||J.type},Y)):o.jsx("span",{className:"text-muted-foreground text-xs",children:"—"})})})]},G.domain)})})}):x?o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Me,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):o.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground text-xs",children:"No source data available yet."}),p&&o.jsx("div",{ref:F,className:"flex justify-center py-4",children:x&&o.jsx(Me,{className:"h-5 w-5 animate-spin text-muted-foreground"})})]})]}),u==="urls"&&o.jsxs(o.Fragment,{children:[o.jsx("table",{className:"w-full table-fixed card-table",children:o.jsx("thead",{className:"bg-muted/50 h-12 border-b",children:o.jsxs("tr",{children:[o.jsx("th",{className:"px-4 text-left text-xs font-medium text-muted-foreground tracking-wider w-14",children:"Rank"}),o.jsx("th",{className:"px-4 text-left text-xs font-medium text-muted-foreground tracking-wider",children:"Page URL"}),o.jsx("th",{className:"px-4 text-center text-xs font-medium text-muted-foreground tracking-wider w-24",children:"Usage %"}),o.jsx("th",{className:"px-4 text-left text-xs font-medium text-muted-foreground tracking-wider w-32",children:"Article Type"})]})})}),o.jsxs("div",{className:"h-[443px] overflow-y-auto",children:[v.length>0?o.jsx("table",{className:"w-full table-fixed card-table",children:o.jsx("tbody",{className:"divide-y divide-border",children:v.map(G=>{let K=G.url;try{const ee=new URL(G.url);K=ee.pathname==="/"?ee.hostname:ee.pathname}catch{}return o.jsxs("tr",{className:"hover:bg-accent/30 transition-colors",children:[o.jsx("td",{className:"px-4 py-3 text-sm text-muted-foreground w-14",children:G.rank}),o.jsx("td",{className:"px-4 py-3",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ul,{name:G.domain,website:G.domain,size:"md"}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("a",{href:G.url,target:"_blank",rel:"noopener noreferrer",className:"text-sm font-medium hover:underline line-clamp-1 flex items-center gap-1",children:[G.title||K,o.jsx(Wr,{className:"h-3 w-3 text-muted-foreground shrink-0"})]}),o.jsx("p",{className:"text-xs text-muted-foreground line-clamp-1",children:G.url})]})]})}),o.jsxs("td",{className:"px-4 py-3 text-center text-sm font-medium w-24",children:[G.usagePercent,"%"]}),o.jsx("td",{className:"px-4 py-3 w-32",children:o.jsx(Ge,{variant:"secondary",className:"text-[10px] h-5 font-normal",children:ew[G.contentType]||G.contentType})})]},G.url)})})}):j?o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Me,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):o.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground text-xs",children:"No URL data available yet."}),S&&o.jsx("div",{ref:q,className:"flex justify-center py-4",children:j&&o.jsx(Me,{className:"h-5 w-5 animate-spin text-muted-foreground"})})]})]}),u==="contentTypes"&&o.jsxs(o.Fragment,{children:[o.jsx("table",{className:"w-full table-fixed card-table",children:o.jsx("thead",{className:"bg-muted/50 h-12 border-b",children:o.jsxs("tr",{children:[o.jsx("th",{className:"px-4 text-left text-xs font-medium text-muted-foreground tracking-wider w-14",children:"Rank"}),o.jsx("th",{className:"px-4 text-left text-xs font-medium text-muted-foreground tracking-wider w-40",children:"Content Type"}),o.jsx("th",{className:"px-4 text-center text-xs font-medium text-muted-foreground tracking-wider w-34",children:o.jsx(on,{children:o.jsxs(Ft,{children:[o.jsxs(Ut,{className:"flex items-center gap-1 mx-auto uppercase",children:["Competitors",o.jsx(xr,{className:"h-3 w-3"})]}),o.jsx(zt,{children:o.jsx("p",{children:"Competitor domains with URLs of this type"})})]})})}),o.jsx("th",{className:"px-4 text-center text-xs font-medium text-muted-foreground tracking-wider w-30",children:"Total Used"}),o.jsx("th",{className:"px-4 text-center text-xs font-medium text-muted-foreground tracking-wider w-30",children:o.jsx(on,{children:o.jsxs(Ft,{children:[o.jsxs(Ut,{className:"flex items-center gap-1 mx-auto uppercase",children:["Prompts",o.jsx(xr,{className:"h-3 w-3"})]}),o.jsx(zt,{children:o.jsx("p",{children:"Number of prompts where this content type appears"})})]})})}),o.jsx("th",{className:"px-4 text-center text-xs font-medium text-muted-foreground tracking-wider w-40",children:o.jsx(on,{children:o.jsxs(Ft,{children:[o.jsxs(Ut,{className:"flex items-center gap-1 mx-auto uppercase",children:["Citation Rate",o.jsx(xr,{className:"h-3 w-3"})]}),o.jsx(zt,{children:o.jsx("p",{children:"Percentage of prompts citing this content type"})})]})})})]})})}),o.jsx("div",{className:"h-[443px] overflow-y-auto",children:M.length>0?o.jsx("table",{className:"w-full table-fixed card-table",children:o.jsx("tbody",{className:"divide-y divide-border",children:M.map(G=>o.jsxs("tr",{className:"hover:bg-accent/30 transition-colors",children:[o.jsx("td",{className:"px-4 py-3 text-sm text-muted-foreground w-14",children:G.rank}),o.jsx("td",{className:"px-4 py-3",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"h-7 w-7 shrink-0 rounded-md bg-muted flex items-center justify-center",children:o.jsx(Ao,{className:"h-4 w-4 text-muted-foreground"})}),o.jsx("span",{className:"text-sm font-medium",children:ew[G.contentType]||G.contentType})]})}),o.jsx("td",{className:"px-4 py-3 text-center w-24",children:G.competitorDomainsCount>0?o.jsx(Ge,{variant:"outline",className:"text-[10px] h-5",children:G.competitorDomainsCount}):o.jsx("span",{className:"text-muted-foreground text-xs",children:"—"})}),o.jsx("td",{className:"px-4 py-3 text-center text-sm font-medium w-24",children:G.totalUsed.toLocaleStr
4967ing()}),o.jsx("td",{className:"px-4 py-3 text-center text-sm w-24",children:G.promptsFoundIn}),o.jsxs("td",{className:"px-4 py-3 text-center text-sm font-medium w-24",children:[G.citationRate,"%"]})]},G.contentType))})}):R?o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Me,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):o.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground text-xs",children:"No content type data available yet."})})]})]}),o.jsxs("div",{className:"w-full md:w-[240px] shrink-0 border-t md:border-t-0 md:border-l bg-background",children:[o.jsx("div",{className:"bg-muted/50 px-4 h-12 flex items-center border-b",children:o.jsx("span",{className:"text-xs font-medium text-muted-foreground tracking-wider uppercase",children:W})}),o.jsx("div",{className:"px-6 py-3",children:H.length>0?o.jsxs("div",{className:"flex flex-col items-center",children:[o.jsx("div",{className:"h-[140px] w-full",children:o.jsx(Qi,{width:"100%",height:"100%",children:o.jsxs(LB,{children:[o.jsx(wc,{data:H,cx:"50%",cy:"50%",innerRadius:40,outerRadius:60,paddingAngle:5,cornerRadius:2,strokeWidth:0,dataKey:"value",children:H.map((G,K)=>o.jsx(B0,{fill:G.color},`cell-${K}`))}),o.jsx(Bn,{content:({active:G,payload:K})=>{var ee;if(G&&K&&K.length){const V=(ee=K[0])==null?void 0:ee.payload;return o.jsxs("div",{className:"rounded-lg border bg-background px-3 py-2 shadow-sm",children:[o.jsx("p",{className:"text-sm font-medium",children:V.name}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:[V.value," sources"]})]})}return null}})]})})}),o.jsxs("div",{className:"text-center -mt-[90px] mb-[50px]",children:[o.jsx("p",{className:"text-xl font-bold",children:(e==null?void 0:e.overview.totalSources)||0}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Total"})]}),o.jsxs("div",{className:"w-full space-y-1 max-h-[200px] overflow-y-auto",children:[H.slice(0,8).map((G,K)=>{const ee=H.reduce((J,Y)=>J+Y.value,0),V=ee>0?Math.round(G.value/ee*100*10)/10:0;return o.jsxs("div",{className:"flex items-center justify-between text-xs",children:[o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:G.color}}),o.jsx("span",{className:"text-muted-foreground truncate",children:G.name})]}),o.jsx("div",{className:"flex items-center gap-1.5",children:o.jsxs("span",{className:"font-medium",children:[V,"%"]})})]},K)}),H.length>8&&o.jsxs("p",{className:"text-[10px] text-muted-foreground text-center pt-1",children:["+",H.length-8," more"]})]})]}):o.jsx("div",{className:"flex flex-1 items-center justify-center text-muted-foreground",children:o.jsxs("div",{className:"flex  flex-col items-center justify-center",children:[o.jsx(Ose,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),o.jsx("p",{className:"text-xs",children:"No data yet."})]})})})]})]})})]})]})]})]})}function n$t(){return o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Traffic Analytics",noIndex:!0}),o.jsx("div",{className:"space-y-6",children:o.jsx(Dt,{className:"border-dashed shadow-none",children:o.jsxs(Zt,{className:"text-center",children:[o.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-primary/10",children:o.jsx(Ud,{className:"h-8 w-8 text-primary"})}),o.jsx(tn,{className:"text-xl",children:"Coming Soon"}),o.jsx(Kn,{className:"max-w-md mx-auto",children:"We're building powerful traffic analytics to help you understand how AI citations drive visitors to your website."})]})})})]})}function uC({label:t,score:e,icon:n,description:r}){return o.jsx(on,{children:o.jsxs(Ft,{children:[o.jsx(Ut,{asChild:!0,children:o.jsxs("div",{className:"flex items-center gap-3 px-6 py-3 cursor-help bg-card",children:[o.jsx(nr,{value:e??0,size:"lg",variant:"percentage"}),o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center gap-1.5 text-sm font-medium",children:[o.jsx(n,{className:"h-3.5 w-3.5 text-muted-foreground"}),t]}),o.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:e!==null?`${e}/100`:"Not audited"})]})]})}),o.jsx(zt,{children:o.jsx("p",{className:"max-w-xs",children:r})})]})})}const r$t={critical:"bg-red-500/20 text-red-500",high:"bg-orange-500/20 text-orange-500",medium:"bg-yellow-500/20 text-yellow-500",low:"bg-emerald-500/20 text-emerald-500"};function dC({count:t,severity:e}){return t===0?null:o.jsx("span",{className:ne("px-1.5 py-0.5 rounded text-[10px] font-medium border",r$t[e]),children:t})}function i$t(){var R;const{companyId:t}=Gr(),e=Nr(),n=Sa(),[r,i]=b.useState(new Set),[s,a]=b.useState("overall_score"),[l,c]=b.useState("asc"),{data:u,isLoading:d}=En({queryKey:["site-health",t],queryFn:async()=>await Ce.get(`/companies/${t}/site-health`),enabled:!!t,refetchInterval:3e4,refetchOnWindowFocus:!0,staleTime:1e4}),{data:f,isLoading:h,fetchNextPage:p,hasNextPage:m,isFetchingNextPage:x}=CNe({queryKey:["site-health-pages",t],queryFn:async({pageParam:E=1})=>await Ce.get(`/companies/${t}/site-health/pages?page=${E}&limit=50&sortBy=priority&sortOrder=desc`),initialPageParam:1,getNextPageParam:E=>{const{page:P,totalPages:O}=E.pagination;return P<O?P+1:void 0},enabled:!!t,refetchInterval:E=>{var L;return(((L=E.state.data)==null?void 0:L.pages.flatMap(T=>T.data))||[]).some(T=>T.audit_status==="pending"||T.audit_status==="running")?5e3:3e4}}),y=b.useMemo(()=>(f==null?void 0:f.pages.flatMap(E=>E.data))||[],[f]),g=b.useMemo(()=>y.filter(E=>E.audit_status==="pending"||E.audit_status==="running").length,[y]),w=((R=f==null?void 0:f.pages[0])==null?void 0:R.pagination.total)||0,v=un({mutationFn:async()=>await Ce.post(`/companies/${t}/site-health/crawls`,{discoveryOnly:!0}),onSuccess:E=>{ge.success(`Sitemap synced! Found ${E.pagesDiscovered} pages.`),n.invalidateQueries({queryKey:["site-health",t]}),n.invalidateQueries({queryKey:["site-health-pages",t]})},onError:E=>{ge.error(E.message||"Failed to sync sitemap")}}),N=un({mutationFn:async E=>(await Ce.post(`/companies/${t}/site-health/pages/${E}/audit`),E),onSuccess:()=>{ge.success("Page audit started - this may take a minute"),n.invalidateQueries({queryKey:["site-health",t]}),n.invalidateQueries({queryKey:["site-health-pages",t]})},onError:E=>{ge.error(E.message||"Failed to start audit")}}),S=v.isPending,_=b.useMemo(()=>y?s!=="overall_score"||l!=="asc"?[...y].sort((E,P)=>{const O=E.path==="/"||E.url&&new URL(E.url).pathname==="/",L=P.path==="/"||P.url&&new URL(P.url).pathname==="/";if(O&&!L)return-1;if(!O&&L)return 1;let T=0;const D=E[s],F=P[s];return s==="url"?T=(E.url||"").localeCompare(P.url||""):T=(D??(l==="asc"?1/0:-1/0))-(F??(l==="asc"?1/0:-1/0)),l==="asc"?T:-T}):y:[],[y,s,l]),j=E=>{i(E?new Set(_.map(P=>P.id)):new Set)},A=(E,P)=>{const O=new Set(r);P?O.add(E):O.delete(E),i(O)},C=E=>{s===E?c(l==="asc"?"desc":"asc"):(a(E),c("desc"))},k=_.length>0&&r.size===_.length,M=r.size>0&&r.size<_.length,I=({field:E,children:P,className:O})=>{const L=s===E,T=L&&l==="asc"?Kc:ms;return o.jsx("th",{className:ne("px-3 text-left text-xs font-medium text-muted-foreground tracking-wider cursor-pointer hover:text-foreground transition-colors whitespace-nowrap uppercase",O),onClick:()=>C(E),children:o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("span",{className:ne(L&&"text-foreground font-bold"),children:P}),o.jsx(T,{className:ne("h-3 w-3",L?"text-foreground":"text-muted-foreground
4967/50")})]})})};return d?o.jsx("div",{className:"flex h-64 items-center justify-center",children:o.jsx(Me,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Site Health"}),o.jsxs("div",{className:"",children:[o.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-b",children:[o.jsx("div",{className:"flex items-center gap-4",children:S?o.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[o.jsx("span",{className:"flex items-center justify-center h-10 w-10 rounded-md bg-gray-500/10 shrink-0",children:o.jsx(Me,{className:"h-4 w-4 animate-spin"})}),o.jsx("span",{className:"text-muted-foreground",children:"Syncing sitemap..."})]}):o.jsxs(o.Fragment,{children:[(u==null?void 0:u.crawl.lastAuditDate)&&o.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[o.jsx("div",{className:"flex items-center justify-center h-10 w-10 rounded-md bg-gray-500/10 shrink-0",children:o.jsx(Sz,{className:"h-5 w-5 text-gray-500"})}),"Last sync ",d9(new Date(u.crawl.lastAuditDate))," ago"]}),o.jsxs("div",{className:"text-sm",children:[(u==null?void 0:u.budget.remaining)??0," / ",(u==null?void 0:u.budget.dailyLimit)??0," page audits remaining today"]}),g>0&&o.jsxs("div",{className:"flex items-center gap-2 text-sm text-primary",children:[o.jsx(Me,{className:"h-4 w-4 animate-spin"}),o.jsxs("span",{children:[g," audit",g>1?"s":""," in progress"]})]})]})}),o.jsx(on,{children:o.jsxs(Ft,{children:[o.jsx(Ut,{asChild:!0,children:o.jsxs(le,{variant:"outline",onClick:()=>v.mutate(),disabled:S,children:[S?o.jsx(Me,{className:"h-4 w-4 animate-spin"}):o.jsx(OTe,{className:"h-4 w-4"}),S?"Syncing...":"Sync Sitemap"]})}),o.jsx(zt,{children:o.jsx("p",{className:"max-w-xs",children:"Discover pages from your sitemap.xml. Use the refresh button on individual pages to run audits."})})]})})]}),o.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 bg-border gap-[1px] border-b",children:[o.jsx(uC,{label:"Overall",score:(u==null?void 0:u.scores.overall)??null,icon:Zu,description:"Overall health score combining technical, content, and AEO metrics"}),o.jsx(uC,{label:"Technical",score:(u==null?void 0:u.scores.technical)??null,icon:bo,description:"Technical SEO health including page speed, meta tags, and structure"}),o.jsx(uC,{label:"Content",score:(u==null?void 0:u.scores.content)??null,icon:Ao,description:"Content quality including readability, keywords, and engagement signals"}),o.jsx(uC,{label:"AEO",score:(u==null?void 0:u.scores.aeo)??null,icon:pr,description:"AI Engine Optimization score for LLM visibility and citations"})]}),u&&u.issues.totalOpen>0&&o.jsxs("div",{className:"flex items-center gap-3 px-6 py-3 border-b",children:[o.jsx("div",{className:"flex items-center justify-center h-10 w-10 rounded-md bg-gray-500/10 shrink-0",children:o.jsx(ll,{className:"h-5 w-5 text-gray-500"})}),o.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[o.jsxs("span",{className:"text-sm font-medium",children:[u.issues.totalOpen," open issues:"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(dC,{count:u.issues.critical,severity:"critical"}),o.jsx(dC,{count:u.issues.high,severity:"high"}),o.jsx(dC,{count:u.issues.medium,severity:"medium"}),o.jsx(dC,{count:u.issues.low,severity:"low"})]})]}),o.jsx(le,{variant:"outline",size:"sm",className:"ml-auto",onClick:()=>e(`/company/${t}/issues?from_page=site-health`),children:"View All Issues"})]}),r.size>0&&o.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted/50 rounded-lg border",children:[o.jsxs("span",{className:"text-sm font-medium",children:[r.size," selected"]}),o.jsx("div",{className:"flex items-center gap-2",children:o.jsx(on,{children:o.jsxs(Ft,{children:[o.jsx(Ut,{asChild:!0,children:o.jsxs(le,{variant:"outline",size:"sm",disabled:((u==null?void 0:u.budget.remaining)??0)<r.size,children:[o.jsx(ws,{className:"h-4 w-4"}),"Audit Selected (",r.size,")"]})}),o.jsx(zt,{children:((u==null?void 0:u.budget.remaining)??0)<r.size?`Need ${r.size} audits but only ${(u==null?void 0:u.budget.remaining)??0} remaining today`:`Audit ${r.size} pages (uses ${r.size} from daily budget)`})]})})}),o.jsx(le,{variant:"ghost",size:"sm",onClick:()=>i(new Set),className:"ml-auto",children:"Clear selection"})]}),o.jsxs("div",{className:"overflow-hidden",children:[o.jsx("div",{className:"overflow-x-auto",children:o.jsxs("table",{className:"w-full card-table",children:[o.jsx("thead",{className:"bg-muted/50 border-b",children:o.jsxs("tr",{children:[o.jsx("th",{className:"w-10 px-3 py-3",children:o.jsx(Yr,{checked:k,indeterminate:M,onChange:E=>j(E.target.checked)})}),o.jsx(I,{field:"url",className:"min-w-[300px]",children:"Page URL"}),o.jsx(I,{field:"issue_count",className:"text-center",children:"Issues"}),o.jsx("th",{className:"px-3 py-3 text-center text-xs font-medium text-muted-foreground tracking-wider whitespace-nowrap uppercase",children:"Visitors"}),o.jsx(I,{field:"overall_score",className:"text-center",children:"Score"}),o.jsx(I,{field:"technical_score",className:"text-center",children:"Technical"}),o.jsx(I,{field:"content_score",className:"text-center",children:"Content"}),o.jsx(I,{field:"aeo_score",className:"text-center",children:"AEO"}),o.jsx("th",{className:"w-12 px-3 py-3"})]})}),o.jsx("tbody",{className:"divide-y divide-border",children:h?o.jsx("tr",{children:o.jsx("td",{colSpan:9,className:"py-12 text-center",children:o.jsx(Me,{className:"h-6 w-6 animate-spin text-muted-foreground mx-auto"})})}):_.length===0?o.jsx("tr",{children:o.jsx("td",{colSpan:9,className:"py-12 text-center text-muted-foreground",children:o.jsxs("div",{className:"flex flex-col items-center gap-2",children:[o.jsx(Zu,{className:"h-8 w-8 text-muted-foreground
4967/50"}),o.jsx("p",{children:"No pages discovered yet"}),o.jsx("p",{className:"text-sm",children:'Click "Sync Sitemap" to discover your website pages'})]})})}):_.map(E=>o.jsxs("tr",{className:"hover:bg-muted/50 cursor-pointer transition-colors",onClick:P=>{P.target.closest("input, button")||e(`/company/${t}/site-health/page/${E.id}?from_page=site-health`)},children:[o.jsx("td",{className:"px-3 py-3",onClick:P=>P.stopPropagation(),children:o.jsx(Yr,{checked:r.has(E.id),onChange:P=>A(E.id,P.target.checked)})}),o.jsx("td",{className:"px-3 py-3",children:o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[o.jsx("img",{src:`https://www.google.com/s2/favicons?domain=${new URL(E.url).hostname}&sz=32`,alt:"",className:"h-4 w-4 rounded flex-shrink-0"}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("p",{className:"text-sm font-medium truncate",children:E.title||E.path||E.url}),o.jsx("p",{className:"text-xs text-muted-foreground truncate",children:E.path||new URL(E.url).pathname})]}),o.jsx("a",{href:E.url,target:"_blank",rel:"noopener noreferrer",onClick:P=>P.stopPropagation(),className:"text-muted-foreground hover:text-foreground",children:o.jsx(Wr,{className:"h-3.5 w-3.5"})})]})}),o.jsx("td",{className:"px-3 py-3 text-center",children:E.issue_count>0?o.jsx(Ge,{variant:"secondary",className:"text-xs",children:E.issue_count}):o.jsx("span",{className:"text-xs text-muted-foreground",children:"-"})}),o.jsx("td",{className:"px-3 py-3 text-center",children:o.jsx("span",{className:"text-xs text-muted-foreground",children:"-"})}),o.jsx("td",{className:"px-3 py-3 text-center",children:E.overall_score!==null?o.jsx(nr,{value:E.overall_score,size:"sm",variant:"percentage"}):o.jsx("span",{className:"text-xs text-muted-foreground",children:"-"})}),o.jsx("td",{className:"px-3 py-3 text-center",children:E.technical_score!==null?o.jsx(nr,{value:E.technical_score,size:"sm",variant:"percentage"}):o.jsx("span",{className:"text-xs text-muted-foreground",children:"-"})}),o.jsx("td",{className:"px-3 py-3 text-center",children:E.content_score!==null?o.jsx(nr,{value:E.content_score,size:"sm",variant:"percentage"}):o.jsx("span",{className:"text-xs text-muted-foreground",children:"-"})}),o.jsx("td",{className:"px-3 py-3 text-center",children:E.aeo_score!==null?o.jsx(nr,{value:E.aeo_score,size:"sm",variant:"percentage"}):o.jsx("span",{className:"text-xs text-muted-foreground",children:"-"})}),o.jsx("td",{className:"px-3 py-3",onClick:P=>P.stopPropagation(),children:(()=>{const P=E.audit_status==="pending"||E.audit_status==="running";return o.jsx(on,{children:o.jsxs(Ft,{children:[o.jsx(Ut,{asChild:!0,children:o.jsx(le,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",disabled:P||N.isPending||((u==null?void 0:u.budget.remaining)??0)<=0,onClick:()=>N.mutate(E.id),children:P?o.jsx(Me,{className:"h-4 w-4 animate-spin text-primary"}):o.jsx(ws,{className:"h-4 w-4"})})}),o.jsx(zt,{children:P?"Audit in progress...":((u==null?void 0:u.budget.remaining)??0)<=0?"No audit budget remaining today":"Audit this page"})]})})})()})]},E.id))})]})}),o.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-t",children:[o.jsxs("p",{className:"text-sm text-muted-foreground",children:["Showing ",_.length," of ",w," pages"]}),m&&o.jsx(le,{variant:"outline",size:"sm",onClick:()=>p(),disabled:x,children:x?o.jsxs(o.Fragment,{children:[o.jsx(Me,{className:"h-4 w-4 mr-2 animate-spin"}),"Loading..."]}):o.jsx(o.Fragment,{children:"Load More"})})]})]})]})]})}const tw={critical:"bg-red-500/20 text-red-500",high:"bg-orange-500/20 text-orange-500",medium:"bg-yellow-500/20 text-yellow-500",low:"bg-emerald-500/20 text-emerald-500"},dee={critical:0,high:1,medium:2,low:3},fee={technical:"bg-blue-500/20 text-blue-500",content:"bg-violet-500/20 text-violet-500",aeo:"bg-emerald-500/20 text-emerald-500"},s$t={technical:bo,content:Ao,aeo:pr};function a$t(){const{companyId:t}=Gr(),[e]=N0(),n=e.get("issue"),r=_S(t),[i,s]=b.useState("all"),[a,l]=b.useState("all"),[c,u]=b.useState(""),[d,f]=b.useState(new Set),[h,p]=b.useState(null),[m,x]=b.useState("default_severity"),[y,g]=b.useState("asc"),[w,v]=b.useState(1),[N,S]=b.useState(1),_=15,j=5,{data:A,isLoading:C}=En({queryKey:["issues-summary",t],queryFn:async()=>await Ce.get(`/companies/${t}/site-health/issues/summary`),enabled:!!t}),{data:k,isLoading:M}=En({queryKey:["affected-pages",t,h==null?void 0:h.issue_type_id],queryFn:async()=>await Ce.get(`/companies/${t}/site-health/issues/by-type/${h==null?void 0:h.issue_type_id}/pages`),enabled:!!t&&!!(h!=null&&h.issue_type_id)}),I=(A==null?void 0:A.reduce((W,G)=>(W.total+=G.open_count,W[G.default_severity]=(W[G.default_severity]||0)+G.open_count,W),{total:0,critical:0,high:0,medium:0,low:0}))||{total:0,critical:0,high:0,medium:0,low:0},R=b.useMemo(()=>{let W=(A==null?void 0:A.filter(G=>{var J;const K=i==="all"||G.category===i,ee=a==="all"||G.default_severity===a,V=!c||G.name.toLowerCase().includes(c.toLowerCase())||((J=G.description)==null?void 0:J.toLowerCase().includes(c.toLowerCase()));return K&&ee&&V&&G.open_count>0}))||[];return W=[...W].sort((G,K)=>{let ee=0;switch(m){case"name":ee=G.name.localeCompare(K.name);break;case"open_count":ee=K.open_count-G.open_count;break;case"affected_pages":ee=K.affected_pages-G.affected_pages;break;case"default_severity":ee=dee[G.default_severity]-dee[K.default_severity];break}return y==="asc"?ee:-ee}),W}
4967,[A,i,a,c,m,y]),E=Math.ceil(R.length/_),P=b.useMemo(()=>{const W=(w-1)*_;return R.slice(W,W+_)},[R,w,_]);b.useEffect(()=>{if(!(!A||A.length===0)){if(n){const W=A.find(G=>G.issue_type_id===n);if(W){p(W),S(1);return}}!h&&P.length>0&&(p(P[0]),S(1))}},[A,n,P]);const O=W=>{m===W?g(y==="asc"?"desc":"asc"):(x(W),g("asc"))},L=W=>{f(W?new Set(P.map(G=>G.issue_type_id)):new Set)},T=(W,G)=>{const K=new Set(d);G?K.add(W):K.delete(W),f(K)},D=P.length>0&&d.size===P.length,F=d.size>0&&d.size<P.length,q=({field:W,children:G,className:K})=>{const ee=m===W,V=ee&&y==="asc"?Kc:ms;return o.jsx("th",{className:ne("px-3 text-left text-xs font-medium text-muted-foreground tracking-wider cursor-pointer hover:text-foreground transition-colors whitespace-nowrap uppercase",K),onClick:()=>O(W),children:o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("span",{className:ne(ee&&"text-foreground font-bold"),children:G}),o.jsx(V,{className:ne("h-3 w-3",ee?"text-foreground":"text-muted-foreground/50")})]})})},B=W=>{navigator.clipboard.writeText(W),ge.success("Copied to clipboard")};return!(r.hasSiteAuditData||A&&A.length>=0)&&(r.isSetupRunning||r.isInitialLoad)?o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Issues"}),o.jsx(u9,{title:"Scanning Your Website",description:"We're auditing your website to identify issues that may affect your AI discoverability. This usually takes a few moments."})]}):C?o.jsx("div",{className:"flex h-64 items-center justify-center",children:o.jsx(Me,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Issues"}),o.jsxs("div",{className:"flex flex-col min-h-full h-full overflow-y-auto",children:[o.jsx("div",{className:"flex shrink-0 items-center justify-between px-6 py-3 border-b",children:o.jsx("h2",{className:"text-sm font-medium",children:"Issues"})}),o.jsxs("div",{className:"flex shrink-0 items-center gap-3 px-6 py-3 border-b",children:[o.jsx("div",{className:"flex items-center justify-center h-10 w-10 rounded-md bg-orange-500/20 shrink-0",children:o.jsx(ll,{className:"h-5 w-5 text-orange-500"})}),o.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[o.jsxs("span",{className:"text-sm font-medium",children:[I.total," open issues:"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[I.critical>0&&o.jsxs("span",{className:ne("px-2 py-0.5 rounded text-xs font-medium border",tw.high),children:[I.high," High"]}),I.medium>0&&o.jsxs("span",{className:ne("px-2 py-0.5 rounded text-xs font-medium border",tw.medium),children:[I.medium," Medium"]}),I.low>0&&o.jsxs("span",{className:ne("px-2 py-0.5 rounded text-xs font-medium border",tw.low),children:[I.low," Low"]})]})]})]}),o.jsxs("div",{className:"flex shrink-0 flex-col sm:flex-row items-start sm:items-center justify-between gap-3 px-6 py-3 border-b",children:[o.jsx(J0,{value:i,onValueChange:W=>s(W),children:o.jsxs(Bg,{children:[o.jsx(pi,{value:"all",children:"All"}),o.jsx(pi,{value:"technical",children:"Technical"}),o.jsx(pi,{value:"content",children:"Content"}),o.jsx(pi,{value:"aeo",children:"AEO"})]})}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs("div",{className:"relative",children:[o.jsx(Xa,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),o.jsx(gt,{placeholder:"Search issues...",value:c,onChange:W=>u(W.target.value),className:"pl-9 w-64"})]}),o.jsxs(Tr,{value:a,onValueChange:l,children:[o.jsx(yr,{className:"w-32",children:o.jsx(Vr,{placeholder:"Severity"})}),o.jsxs(vr,{children:[o.jsx(Ht,{value:"all",children:"All"}),o.jsx(Ht,{value:"critical",children:"Critical"}),o.jsx(Ht,{value:"high",children:"High"}),o.jsx(Ht,{value:"medium",children:"Medium"}),o.jsx(Ht,{value:"low",children:"Low"})]})]})]})]}),o.jsxs("div",{className:"flex flex-1 min-h-0",children:[o.jsxs("div",{className:"flex min-h-[16rem] flex-1 min-w-0 flex-col border-r",children:[o.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:o.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:o.jsxs("table",{className:"w-full card-table",children:[o.jsx("thead",{className:"sticky top-0 z-10 border-b bg-background",children:o.jsxs("tr",{children:[o.jsx("th",{className:"w-10 px-3 py-3",children:o.jsx(Yr,{checked:D,indeterminate:F,onChange:W=>L(W.target.checked)})}),o.jsx(q,{field:"name",className:"min-w-[200px]",children:"Issue"}),o.jsx(q,{field:"default_severity",className:"text-center",children:"Severity"}),o.jsx("th",{className:"px-3 py-3 text-center text-xs font-medium text-muted-foreground tracking-wider whitespace-nowrap uppercase",children:"Category"}),o.jsx(q,{field:"open_count",className:"text-center",children:"Count"}),o.jsx(q,{field:"affected_pages",className:"text-center",children:"Pages"})]})}),o.jsx("tbody",{className:"divide-y divide-border",children:P.length===0?o.jsx("tr",{children:o.jsx("td",{colSpan:6,className:"py-12 text-center text-muted-foreground",children:o.jsxs("div",{className:"flex flex-col items-center gap-2",children:[o.jsx(Sn,{className:"h-8 w-8 text-emerald-500"}),o.jsx("p",{children:"No issues found"})]})})}):P.map(W=>{const G=s$t[W.category]||Zu,K=(h==null?void 0:h.issue_type_id)===W.issue_type_id;return o.jsxs("tr",{className:ne("cursor-pointer transition-colors",K?"bg-muted":"hover:bg-muted/50"),onClick:()=>{p(W),S(1)},children:[o.jsx("td",{className:"px-3 py-3",onClick:ee=>ee.stopPropagation(),children:o.jsx(Yr,{checked:d.has(W.issue_type_id),onChange:ee=>T(W.issue_type_id,ee.target.checked)})}),o.jsx("td",{className:"px-3 py-3",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(G,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),o.jsx("span",{className:"text-sm font-medium truncate",children:W.name})]})}),o.jsx("td",{className:"px-3 py-3 text-center",children:o.jsx("span",{className:ne("inl
4967ine-flex px-2 py-0.5 rounded text-xs font-medium border",tw[W.default_severity]),children:W.default_severity.charAt(0).toUpperCase()+W.default_severity.slice(1)})}),o.jsx("td",{className:"px-3 py-3 text-center",children:o.jsx("span",{className:ne("inline-flex px-2 py-0.5 rounded text-xs font-medium",fee[W.category]),children:W.category.charAt(0).toUpperCase()+W.category.slice(1)})}),o.jsx("td",{className:"px-3 py-3 text-center",children:o.jsx(Ge,{variant:"secondary",children:W.open_count})}),o.jsx("td",{className:"px-3 py-3 text-center text-sm text-muted-foreground",children:W.affected_pages})]},W.issue_type_id)})})]})})}),E>1&&o.jsxs("div",{className:"flex shrink-0 items-center justify-between border-t bg-background px-4 py-3",children:[o.jsxs("p",{className:"text-sm text-muted-foreground",children:[(w-1)*_+1," - ",Math.min(w*_,R.length)," of ",R.length]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(le,{variant:"outline",size:"sm",onClick:()=>v(W=>Math.max(1,W-1)),disabled:w===1,children:o.jsx(wd,{className:"h-4 w-4"})}),o.jsxs("span",{className:"text-sm",children:[w," / ",E]}),o.jsx(le,{variant:"outline",size:"sm",onClick:()=>v(W=>Math.min(E,W+1)),disabled:w===E,children:o.jsx(Ga,{className:"h-4 w-4"})})]})]})]}),o.jsx("div",{className:"flex w-96 min-h-0 flex-shrink-0 flex-col",children:h?o.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[o.jsxs("div",{className:"p-5",children:[o.jsx("div",{className:"flex items-center justify-between mb-4",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:ne("px-2 py-0.5 rounded text-xs font-medium border",tw[h.default_severity]),children:h.default_severity.charAt(0).toUpperCase()+h.default_severity.slice(1)}),o.jsx("span",{className:ne("px-2 py-0.5 rounded text-xs font-medium",fee[h.category]),children:h.category.charAt(0).toUpperCase()+h.category.slice(1)})]})}),o.jsx("h3",{className:"text-lg font-semibold mb-3",children:h.name}),o.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:h.description||"No description available."}),o.jsxs("div",{className:"flex items-center gap-4 mb-4 text-sm",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Open: "}),o.jsx("span",{className:"font-medium",children:h.open_count})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Fixed: "}),o.jsx("span",{className:"font-medium",children:h.fixed_count})]})]}),h.how_to_fix&&o.jsxs("div",{className:"border-t pt-4",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx(_T,{className:"h-4 w-4 text-muted-foreground"}),o.jsx("h4",{className:"text-sm font-semibold",children:"How to Fix"})]}),o.jsx("p",{className:"text-sm text-muted-foreground",children:h.how_to_fix})]}),o.jsx("div",{className:"flex items-center gap-2 mt-4 pt-4 border-t",children:o.jsx(on,{children:o.jsxs(Ft,{children:[o.jsx(Ut,{asChild:!0,children:o.jsxs(le,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>B(`Issue: ${h.name}
4968
4969${h.description}
4970
4971How to fix:
4972${h.how_to_fix||"No specific fix instructions."}`),children:[o.jsx(Nz,{className:"h-4 w-4"}),"Copy"]})}),o.jsx(zt,{children:"Copy issue details"})]})})})]}),o.jsx("div",{className:"border-t",children:o.jsxs("div",{className:"p-4",children:[o.jsxs("h4",{className:"text-sm font-semibold mb-3",children:["Affected Pages (",h.affected_pages,")"]}),M?o.jsx("div",{className:"flex items-center justify-center py-8",children:o.jsx(Me,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):k&&k.length>0?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"overflow-hidden border rounded-md",children:o.jsxs("table",{className:"w-full card-table",children:[o.jsx("thead",{className:"border-b",children:o.jsxs("tr",{children:[o.jsx("th",{className:"px-3 py-2 text-left text-xs font-medium text-muted-foreground uppercase",children:"Page"}),o.jsx("th",{className:"w-10 px-3 py-2"})]})}),o.jsx("tbody",{className:"divide-y divide-border",children:k.slice((N-1)*j,N*j).map(W=>o.jsxs("tr",{className:"hover:bg-muted/50",children:[o.jsx("td",{className:"px-3 py-2",children:o.jsxs(Mt,{to:`/company/${t}/site-health/page/${W.page_id}?from_page=issues`,className:"flex items-center gap-2 group",children:[o.jsx("img",{src:`https://www.google.com/s2/favicons?domain=${new URL(W.url).hostname}
4972&sz=32`,alt:"",className:"h-4 w-4 rounded flex-shrink-0"}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("p",{className:"text-sm font-medium truncate group-hover:text-primary",children:W.title||W.path||W.url}),o.jsx("p",{className:"text-xs text-muted-foreground truncate",children:W.path||new URL(W.url).pathname})]})]})}),o.jsx("td",{className:"px-3 py-2",children:o.jsx("a",{href:W.url,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground",children:o.jsx(Wr,{className:"h-3.5 w-3.5"})})})]},W.id))})]})}),k.length>j&&o.jsxs("div",{className:"flex items-center justify-between mt-3",children:[o.jsxs("p",{className:"text-xs text-muted-foreground",children:[(N-1)*j+1,"-",Math.min(N*j,k.length)," of ",k.length]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(le,{variant:"outline",size:"sm",className:"h-7 w-7 p-0",onClick:()=>S(W=>Math.max(1,W-1)),disabled:N===1,children:o.jsx(wd,{className:"h-4 w-4"})}),o.jsx(le,{variant:"outline",size:"sm",className:"h-7 w-7 p-0",onClick:()=>S(W=>Math.min(Math.ceil(k.length/j),W+1)),disabled:N>=Math.ceil(k.length/j),children:o.jsx(Ga,{className:"h-4 w-4"})})]})]})]}):o.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No pages found"})]})})]}):o.jsx("div",{className:"flex flex-1 items-center justify-center rounded-lg border bg-muted/30 p-8",children:o.jsxs("div",{className:"text-center",children:[o.jsx(ll,{className:"h-8 w-8 text-muted-foreground mx-auto mb-2"}),o.jsx("p",{className:"text-muted-foreground",children:"Select an issue to view details"})]})})})]})]})]})}const k0e={critical:"bg-red-500/10 text-red-500 border-red-500/20",high:"bg-orange-500/10 text-orange-500 border-orange-500/20",medium:"bg-yellow-500/10 text-yellow-500 border-yellow-500/20",low:"bg-primary/10 text-primary border-primary/20"},hee={critical:0,high:1,medium:2,low:3},E0e={technical:"bg-blue-500/10 text-blue-400",content:"bg-violet-500/10 text-violet-400",aeo:"bg-primary/10 text-primary"};function L3({label:t,value:e,unit:n,goodThreshold:r,poorThreshold:i}){if(e===null)return null;const s=()=>e<=r?"bg-primary":e<=i?"bg-warning":"bg-destructive",a=()=>e<=r?"text-primary":e<=i?"text-warning":"text-destructive";return o.jsx(on,{children:o.jsxs(Ft,{children:[o.jsx(Ut,{asChild:!0,children:o.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-card border cursor-help",children:[o.jsx("div",{className:ne("h-2 w-2 rounded-full",s())}),o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:t}),o.jsxs("span",{className:ne("text-sm font-semibold",a()),children:[e,n]})]})}),o.jsx(zt,{children:o.jsxs("p",{children:["Good: <",r,n," | Poor: >",i,n]})})]})})}function o$t({issue:t,index:e,isSelected:n,onSelect:r}){return o.jsx("button",{onClick:r,className:ne("w-full px-6 py-2.5 text-left transition-colors cursor-pointer border-b last:border-b-0",n?"bg-muted":"hover:bg-accent"),children:o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsxs("div",{className:"flex items-center gap-2.5 min-w-0 flex-1",children:[o.jsx("span",{className:ne("flex-shrink-0 w-5 h-5 rounded-full flex items-center justify-center text-[10px] font-medium",n?"bg-primary text-primary-foreground":"bg-muted-foreground/20 text-muted-foreground"),children:e+1}),o.jsx("p",{className:"text-sm truncate",children:t.name}),o.jsx("div",{className:"flex items-center gap-1 flex-shrink-0",children:o.jsx("span",{className:ne("px-2 py-0.5 rounded text-xs font-medium",E0e[t.category]),children:t.category.charAt(0).toUpperCase()+t.category.slice(1)})})]}),o.jsx("span",{className:ne("flex-shrink-0 rounded-full border px-2 py-0.5 text-[10px] font-medium",k0e[t.severity]),children:t.severity.charAt(0).toUpperCase()+t.severity.slice(1)})]})})}function l$t({issue:t,index:e,totalIssues:n,onMarkFixed:r,isMarkingFixed:i,onNavigate:s}){const a=l=>{navigator.clipboard.writeText(l),ge.success("Copied to clipboard")};return o.jsxs("div",{className:"space-y-4 px-6 py-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:"Issue Details"}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(le,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>s("prev"),disabled:e===0,children:o.jsx(wd,{className:"h-4 w-4"})}),o.jsxs("span",{className:"text-xs text-muted-foreground min-w-[3rem] text-center",children:[e
4972+1," / ",n]}),o.jsx(le,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>s("next"),disabled:e===n-1,children:o.jsx(Ga,{className:"h-4 w-4"})})]})]}),o.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-[1px] bg-border rounded-lg overflow-hidden",children:[o.jsxs("div",{className:"p-5 bg-card flex flex-col min-h-[280px]",children:[o.jsxs("div",{className:"flex items-center justify-between mb-3",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:ne("px-2 py-0.5 rounded text-xs font-medium border",k0e[t.severity]),children:t.severity.charAt(0).toUpperCase()+t.severity.slice(1)}),o.jsx("span",{className:"w-px h-4 bg-border"}),o.jsx("span",{className:ne("px-2 py-0.5 rounded text-xs font-medium",E0e[t.category]),children:t.category.charAt(0).toUpperCase()+t.category.slice(1)})]}),o.jsxs("span",{className:"text-xs text-muted-foreground",children:[e+1,"/",n]})]}),o.jsx("h4",{className:"text-base font-semibold mb-3",children:t.name}),o.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed mb-4 flex-1",children:t.description||"No description available."}),o.jsxs("div",{className:"flex items-center justify-between mt-auto",children:[o.jsxs(le,{variant:"secondary",size:"sm",onClick:r,disabled:i||t.is_fixed,children:[i?o.jsx(Me,{className:"h-3.5 w-3.5 animate-spin"}):o.jsx(Sn,{className:"h-3.5 w-3.5"}),t.is_fixed?"Fixed":"Mark Fixed"]}),o.jsx("div",{className:"flex items-center gap-2",children:o.jsx(on,{children:o.jsxs(Ft,{children:[o.jsx(Ut,{asChild:!0,children:o.jsxs(le,{variant:"outline",size:"sm",onClick:()=>a(`Issue: ${t.name}
4973
4974${t.description}
4975
4976How to fix:
4977${t.how_to_fix||"No specific fix instructions."}`),children:[o.jsx(Nz,{className:"h-3.5 w-3.5"}),"Copy"]})}),o.jsx(zt,{children:"Copy issue details to clipboard"})]})})})]})]}),o.jsxs("div",{className:"p-5 bg-card flex flex-col min-h-[280px]",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[o.jsx(_T,{className:"h-4 w-4 text-muted-foreground"}),o.jsx("h4",{className:"text-sm font-semibold",children:"How to Fix"})]}),o.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed flex-1",children:t.how_to_fix||"No specific instructions available for this issue."}),t.details&&Object.keys(t.details).length>0&&o.jsxs("div",{className:"mt-4 pt-4 border-t",children:[o.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Details:"}),o.jsx("pre",{className:"text-xs bg-muted p-2 rounded overflow-x-auto",children:JSON.stringify(t.details,null,2)})]})]})]})]})}function c$t(){var v;const{companyId:t,pageId:e}=Gr(),n=Nr(),[r]=N0(),i=Sa(),s=r.get("from_page"),a=()=>{switch(s){case"issues":return`/company/${t}/issues`;case"opportunities":return`/company/${t}/opportunities`;default:return`/company/${t}/site-health`}},l=()=>{switch(s){case"issues":return"Back to Issues";case"opportunities":return"Back to Opportunities";default:return"Back to Site Health"}},[c,u]=b.useState(0),{data:d,isLoading:f}=En({queryKey:["page-audit",t,e],queryFn:async()=>await Ce.get(`/companies/${t}/site-health/pages/${e}`),enabled:!!t&&!!e}),h=un({mutationFn:async N=>{await Ce.patch(`/companies/${t}/site-health/issues/${N}`,{isFixed:!0})},onSuccess:()=>{ge.success("Issue marked as fixed"),i.invalidateQueries({queryKey:["page-audit",t,e]}),i.invalidateQueries({queryKey:["site-health",t]})},onError:()=>{ge.error("Failed to mark issue as fixed")}}),p=((v=d==null?void 0:d.issues)==null?void 0:v.filter(N=>!N.is_fixed).sort((N,S)=>hee[N.severity]-hee[S.severity]))||[],m=p[c],x=N=>{N==="prev"&&c>0?u(c-1):N==="next"&&c<p.length-1&&u(c+1)};if(f)return o.jsx("div",{className:"flex h-64 items-center justify-center",children:o.jsx(Me,{className:"h-8 w-8 animate-spin text-muted-foreground"})});if(!d)return o.jsx("div",{className:"flex h-64 items-center justify-center",children:o.jsx("p",{className:"text-muted-foreground",children:"Page not found"})});const{page:y,issues:g}=d,w=g.filter(N=>N.is_fixed).length;return o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:y.title||"Page Audit"}),o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsx("div",{className:"flex items-center justify-between py-3 border-b bg-background px-6 sticky top-0 z-10",children:o.jsxs(le,{variant:"outline",size:"sm",onClick:()=>n(a()),children:[o.jsx(Ii,{className:"h-4 w-4"}),l()]})}),o.jsxs("div",{className:"flex-1 flex flex-col overflow-y-auto",children:[o.jsxs(Ct,{className:"bg-background border-b",children:[o.jsx(Lt,{className:"border-b",children:o.jsx("div",{className:"flex flex-col lg:flex-row lg:items-start gap-6",children:o.jsxs("div",{className:"flex-1 space-y-3",children:[o.jsx($t,{className:"text-xl leading-tight",children:y.title||"Untitled Page"}),y.meta_description&&o.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:y.meta_description})]})})}),o.jsxs(Et,{className:"pt-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center py-1.5",children:[o.jsxs("div",{className:"flex items-center gap-2 w-32 flex-shrink-0",children:[o.jsx(iu,{className:"h-3.5 w-3.5 text-muted-foreground"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:"URL"})]}),o.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[o.jsx("img",{src:`https://www.google.com/s2/favicons?domain=${new URL(y.url).hostname}&sz=32`,alt:"",className:"h-3.5 w-3.5 rounded flex-shrink-0"}),o.jsxs("a",{href:y.url,target:"_blank",rel:"noopener noreferrer",className:"text-sm hover:underline truncate flex items-center gap-1",children:[o.jsx("span",{className:"truncate",children:y.url}),o.jsx(Wr,{className:"h-3 w-3 flex-shrink-0 opacity-50"})]})]})]}),y.last_audited_at&&o.jsxs("div",{className:"flex items-center py-1.5",children:[o.jsxs("div",{className:"flex items-center gap-2 w-32 flex-shrink-0",children:[o.jsx(Sz,{className:"h-3.5 w-3.5 text-muted-foreground"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:"Last audit"})]}),o.jsxs("span",{className:"text-sm",children:[d9(new Date(y.last_audited_at))," ago"]})]}),o.jsxs("div",{className:"flex items-center py-1.5",children:[o.jsxs("div",{className:"flex items-center gap-2 w-32 flex-shrink-0",children:[o.jsx(_T,{className:"h-3.5 w-3.5 text-muted-foreground"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:"Technical"})]}),o.jsx(nr,{value:y.technical_score??0,size:"xs",variant:"percentage"})]}),o.jsxs("div",{className:"flex items-center py-1.5",children:[o.jsxs("div",{className:"flex items-center gap-2 w-32 flex-shrink-0",children:[o.jsx(Ao,{className:"h-3.5 w-3.5 text-muted-foreground"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:"Content"})]}),o.jsx(nr,{value:y.content_score??0,size:"xs",variant:"percentage"})]}),o.jsxs("div",{className:"flex items-center py-1.5",children:[o.jsxs("div",{className:"flex items-center gap-2 w-32 flex-shrink-0",children:[o.jsx(pr,{className:"h-3.5 w-3.5 text-muted-foreground"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:"AEO"})]}),o.jsx(nr,{value:y.aeo_score??0,size:"xs",variant:"percentage"})]})]}),(y.lcp_ms||y.inp_ms)&&o.jsxs("div",{className:"mt-4 pt-4 border-t",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[o.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Page Speed"}),o.jsx(on,{children:o.jsxs(Ft,{children:[o.jsx(Ut,{children:o.jsx(hTe,{className:"h-3.5 w-3.5 text-muted-foreground"})}),o.jsx(zt,{children:o.jsx("p",{children:"Core Web Vitals from Google PageSpeed Insights"})})]})})]}),o.jsxs("div",{className:"flex flex-wrap gap-3",children:[o.jsx(L3,{label:"LCP",value:y.lcp_ms?y.lcp_ms/1e3:null,unit:"s",goodThreshold:2.5,poorThreshold:4}),o.jsx(L3,{label:"INP",value:y.inp_ms,unit:"ms",goodThreshold:200,poorThreshold:500}),y.cls_score!==null&&o.jsx(L3,{label:"CLS",value:Math.round(y.cls_score*100)/100,unit:"",goodThreshold:.1,poorThreshold:.25}
4977)]})]})]})]}),o.jsxs(Ct,{className:"bg-background flex-1 flex flex-col",children:[o.jsx(Lt,{className:"border-b",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs($t,{className:"text-sm",children:["All Issues",o.jsxs("span",{className:"text-muted-foreground font-normal ml-1",children:["(",p.length,")"]})]}),o.jsx("div",{className:"flex items-center gap-2",children:o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("div",{className:"relative w-3.5 h-3.5",children:o.jsxs("svg",{className:"w-3.5 h-3.5 -rotate-90",viewBox:"0 0 14 14",children:[o.jsx("circle",{cx:"7",cy:"7",r:"5",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-muted"}),o.jsx("circle",{cx:"7",cy:"7",r:"5",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeDasharray:31.4159,strokeDashoffset:31.4159-w/g.length*31.4159,strokeLinecap:"round",className:"text-primary"})]})}),o.jsxs("span",{className:"text-xs text-muted-foreground",children:[w," of ",g.length," fixed"]})]})})]})}),o.jsxs(Et,{className:"p-0 flex-1 flex flex-col",children:[o.jsxs("div",{className:"max-h-[400px] overflow-y-auto border-b",children:[p.map((N,S)=>o.jsx(o$t,{issue:N,index:S,totalIssues:p.length,isSelected:S===c,onSelect:()=>u(S),onMarkFixed:()=>h.mutate(N.id),isMarkingFixed:h.isPending},N.id)),p.length===0&&o.jsxs("div",{className:"py-12 text-center text-muted-foreground",children:[o.jsx(Sn,{className:"h-8 w-8 mx-auto mb-2 text-primary"}),o.jsx("p",{children:"All issues have been fixed!"})]})]}),m&&o.jsx(l$t,{issue:m,index:c,totalIssues:p.length,onMarkFixed:()=>h.mutate(m.id),isMarkingFixed:h.isPending,onNavigate:x})]})]})]})]})]})}function u$t({className:t,...e}){return o.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:o.jsx("table",{"data-slot":"table",className:ne("w-full caption-bottom text-sm",t),...e})})}function d$t({className:t,...e}){return o.jsx("thead",{"data-slot":"table-header",className:ne("[&_tr]:border-b",t),...e})}function f$t({className:t,...e}){return o.jsx("tbody",{"data-slot":"table-body",className:ne("[&_tr:last-child]:border-0",t),...e})}function pee({className:t,...e}){return o.jsx("tr",{"data-slot":"table-row",className:ne("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",t),...e})}function Np({className:t,...e}){return o.jsx("th",{"data-slot":"table-head",className:ne("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e})}function jp({className:t,...e}){return o.jsx("td",{"data-slot":"table-cell",className:ne("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e})}function fC({className:t,...e}){return o.jsx("div",{className:ne("animate-pulse rounded-md bg-muted",t),...e})}const h$t=[{value:"listicle",label:"Ranked List"},{value:"blog_post",label:"Blog Post"},{value:"guide",label:"Guide"},{value:"how_to",label:"How-To"},{value:"comparison",label:"Comparison"},{value:"news",label:"News Article"}],p$t=[{value:"800",label:"800-1000 words"},{value:"1200",label:"1200-1400 words"},{value:"1500",label:"1400-1600 words"},{value:"2000",label:"1800-2200 words"},{value:"3000",label:"2500-3500 words"}];function m$t(){const{companyId:t}=Gr(),e=Nr(),[n,r]=b.useState("topic"),[i,s]=b.useState("listicle"),[a,l]=b.useState("1500"),[c,u]=b.useState(""),[d,f]=b.useState(""),[h,p]=b.useState([]),[m,x]=b.useState(!1),{data:y}=En({queryKey:["suggested-keywords",t],queryFn:async()=>{try{return(await Ce.get(`/companies/${t}/articles/suggested-keywords`)).suggestions||[]}catch{return[]}},enabled:!!t&&n==="topic"});b.useEffect(()=>{const _=Um();if(!_)return;const j=A=>{A.companyId===t&&(p(A.suggestions),x(!1))};return _.on("article:title_suggestions",j),()=>{_.off("article:title_suggestions",j)}},[t]);const g=un({mutationFn:async _=>await Ce.post(`/companies/${t}/articles`,_),onSuccess:_=>{e(`/company/${t}/content/${_.id}?generate=true`)},onError:_=>{ge.error("Failed to create article"),console.error(_)}}),w=un({mutationFn:async()=>await Ce.post(`/companies/${t}/articles/suggest-titles`,{topic:c,contentType:i}),onError:()=>{x(!1),ge.error("Failed to generate title suggestions")}}),v=()=>{if(!c.trim()){ge.error("Please enter a topic");return}x(!0),p([]),w.mutate(),r("title")},N=async _=>{if(!_.trim()){ge.error("Please select a title");return}g.mutate({title:_,topic:c,contentType:i,targetWordCount:parseInt(a)})},S=(_,j)=>{if(j)return"bg-amber-100 text-amber-800 border-amber-300 hover:bg-amber-200";switch(_){case"easy":return"bg-green-100 text-green-800 border-green-300 hover:bg-green-200";case"medium":return"bg-amber-100 text-amber-800 border-amber-300 hover:bg-amber-200";case"hard":return"bg-red-100 text-red-800 border-red-300 hover:bg-red-200";default:return"bg-muted hover:bg-muted/80"}};return o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Create Article",n
4977oIndex:!0}),n==="topic"&&o.jsx("div",{className:"min-h-[calc(100vh-4rem)] flex flex-col",children:o.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center px-6 py-12",children:[o.jsxs("div",{className:"text-center mb-5 w-full max-w-3xl space-y-2",children:[o.jsx("h1",{className:"text-xl font-medium tracking-tight",children:"Generate new content"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Generate a new article, blog post, guide, or how-to based on your research and keywords."})]}),o.jsxs("div",{className:"w-full max-w-3xl",children:[o.jsxs("div",{className:"relative rounded-2xl border-2 border-muted bg-card p-6 pb-3 shadow-sm",children:[o.jsx(dl,{placeholder:"Paste research, select an idea from below, or describe in a few words what you want us to cover.",value:c,onChange:_=>u(_.target.value),className:"min-h-[100px] resize-none border-0 bg-transparent text-lg focus-visible:ring-0 p-0 placeholder:text-muted-foreground/60 focus-visible:outline-none focus-visible:ring-0 focus-visible:ring-offset-0",onKeyDown:_=>{_.key==="Enter"&&_.metaKey&&v()}}),o.jsxs("div",{className:"flex items-center justify-between mt-4 pt-3 -mx-6 px-6 border-t",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs(Tr,{value:i,onValueChange:s,children:[o.jsx(yr,{className:"w-[160px] h-9",children:o.jsx(Vr,{})}),o.jsx(vr,{children:h$t.map(_=>o.jsx(Ht,{value:_.value,children:_.label},_.value))})]}),o.jsxs(Tr,{value:a,onValueChange:l,children:[o.jsx(yr,{className:"w-[160px] h-9",children:o.jsx(Vr,{})}),o.jsx(vr,{children:p$t.map(_=>o.jsx(Ht,{value:_.value,children:_.label},_.value))})]})]}),o.jsxs(le,{className:"h-10",onClick:v,disabled:!c.trim(),children:["Generate",o.jsx(Ai,{className:"h-5 w-5"})]})]})]}),o.jsx("p",{className:"text-sm text-muted-foreground mt-4 text-center",children:"Select keywords, paste research notes, or drop in phrases you want us to target."}),y&&y.length>0&&o.jsxs("div",{className:"mt-8",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[o.jsx("span",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wide",children:"Your suggested keywords and phrases"}),o.jsx(Ge,{variant:"outline",className:"text-xs text-green-600 border-green-300",children:"LIVE"}),o.jsx(le,{variant:"ghost",size:"icon",className:"h-6 w-6",children:o.jsx(ws,{className:"h-3 w-3"})})]}),o.jsx("div",{className:"flex flex-wrap gap-2",children:y.map((_,j)=>o.jsxs("button",{onClick:()=>u(A=>A?`${A}, ${_.keyword}`:_.keyword),className:ne("inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full border text-sm font-medium transition-colors cursor-pointer",S(_.difficulty,_.recommended)),children:[_.keyword,_.recommended&&o.jsx("span",{className:"text-xs font-semibold text-amber-600 uppercase",children:"Recommended"})]},j))})]})]})]})}),n==="title"&&o.jsxs("div",{className:"min-h-[calc(100vh-4rem)] flex flex-col",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4 py-3 border-b bg-background px-6 sticky top-0 z-10",children:[o.jsxs(le,{variant:"outline",size:"sm",onClick:()=>r("topic"),className:"gap-2",children:[o.jsx(Ii,{className:"h-4 w-4"}),"Back"]}),o.jsx("div",{className:"flex items-center gap-2",children:!m&&h.length>0&&o.jsxs(le,{variant:"outline",size:"sm",onClick:()=>{x(!0),p([]),w.mutate()},disabled:w.isPending,className:"gap-2",children:[o.jsx(ws,{className:ne("h-4 w-4",w.isPending&&"animate-spin")}),"Regenerate"]})})]}),o.jsx("div",{className:"flex-1 px-6 py-12",children:o.jsx("div",{className:"max-w-6xl mx-auto",children:m?o.jsxs("div",{className:"space-y-6",children:[o.jsx("div",{className:"flex items-center justify-center py-8",children:o.jsxs("div",{className:"flex flex-col items-center gap-3",children:[o.jsx(Me,{className:"h-6 w-6 animate-spin text-foreground-muted"}),o.jsx("p",{className:"text-muted-foreground",children:"Generating suggestions..."})]})}),o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:[1,2,3,4,5,6].map(_=>o.jsx(Dt,{className:"opacity-50",children:o.jsxs(Vt,{className:"p-4",children:[o.jsx(fC,{className:"h-5 w-full mb-2"}),o.jsx(fC,{className:"h-5 w-2/3 mb-3"}),o.jsx(fC,{className:"h-4 w-full"}
vendor: 11,028 bytes, line 4977
4977),o.jsx(fC,{className:"h-4 w-3/4 mt-1"})]})},_))})]}):o.jsx("div",{className:"grid grid-cols-1 gap-4",children:h.map((_,j)=>o.jsx(Dt,{className:ne("cursor-pointer transition-all hover:border-primary/50 hover:shadow-md relative",d===_.title&&"border-primary ring-2 ring-primary/20"),onClick:()=>{f(_.title),N(_.title)},children:o.jsxs(Vt,{className:"p-4",children:[_.recommended&&o.jsx(Ge,{className:"text-xs mb-2 absolute -top-3 right-3",children:"Recommended"}),o.jsx("h3",{className:"font-semibold leading-snug mb-2",children:_.title}),o.jsx("p",{className:"text-sm text-muted-foreground",children:_.description}),d===_.title&&o.jsx("div",{className:"absolute top-3 right-3",children:o.jsx(Sn,{className:"h-5 w-5 text-primary"})}),g.isPending&&d===_.title&&o.jsx("div",{className:"absolute inset-0 bg-background/80 flex items-center justify-center rounded-lg",children:o.jsx(Me,{className:"h-6 w-6 animate-spin text-primary"})})]})},j))})})})]})]})}function Ps(t){this.content=t}Ps.prototype={constructor:Ps,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),s=r.content.slice();return i==-1?s.push(n||t,e):(s[i+1]=e,n&&(s[i]=n)),new Ps(s)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Ps(n)},addToStart:function(t,e){return new Ps([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Ps(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),s=r.find(t);return i.splice(s==-1?i.length:s,0,e,n),new Ps(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Ps.from(t),t.size?new Ps(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Ps.from(t),t.size?new Ps(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Ps.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};Ps.from=function(t){if(t instanceof Ps)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Ps(e)};function A0e(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),s=e.child(r);if(i==s){n+=i.nodeSize;continue}if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){for(let a=0;i.text[a]==s.text[a];a++)n++;return n}if(i.content.size||s.content.size){let a=A0e(i.content,s.content,n+1);if(a!=null)return a}n+=i.nodeSize}}function T0e(t,e,n,r){for(let i=t.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:n,b:r};let a=t.child(--i),l=e.child(--s),c=a.nodeSize;if(a==l){n-=c,r-=c;continue}if(!a.sameMarkup(l))return{a:n,b:r};if(a.isText&&a.text!=l.text){let u=0,d=Math.min(a.text.length,l.text.length);for(;u<d&&a.text[a.text.length-u-1]==l.text[l.text.length-u-1];)u++,n--,r--;return{a:n,b:r}}if(a.content.size||l.content.size){let u=T0e(a.content,l.content,n-1,r-1);if(u)return u}n-=c,r-=c}}class Ke{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,s){for(let a=0,l=0;l<n;a++){let c=this.content[a],u=l+c.nodeSize;if(u>e&&r(c,i+l,s||null,a)!==!1&&c.content.size){let d=l+1;c.nodesBetween(Math.max(0,e-d),Math.min(c.content.size,n-d),r,i+d)}l=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let s="",a=!0;return this.nodesBetween(e,n,(l,c)=>{let u=l.isText?l.text.slice(Math.max(e,c)-c,n-c):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&u||l.isTextblock)&&r&&(a?a=!1:s+=r),s+=u},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new Ke(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let s=0,a=0;a<n;s++){let l=this.content[s],c=a+l.nodeSize;c>e&&((a<e||c>n)&&(l.isText?l=l.cut(Math.max(0,e-a),Math.min(l.text.length,n-a)):l=l.cut(Math.max(0,e-a-1),Math.min(l.content.size,n-a-1))),r.push(l),i+=l.nodeSize),a=c}return new Ke(r,i)}cutByIndex(e,n){return e==n?Ke.empty:e==0&&n==this.content.length?this:new Ke(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new Ke(i,s)}addToStart(e){return new Ke([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Ke(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))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 n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return A0e(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return T0e(this,e,n,r)}findIndex(e){if(e==0)return hC(0,e);if(e==this.size)return hC(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),s=r+i.nodeSize;if(s>=e)return s==e?hC(n+1,s):hC(n,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return Ke.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new Ke(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Ke.empty;let n,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(n||(n=e.slice(0,i)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}return new Ke(n||e,r)}static from(e){if(!e)return Ke.empty;if(e instanceof Ke)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Ke([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Ke.empty=new Ke([],0);const $3={index:0,offset:0};function hC(t,e){return $3.index=t,$3.offset=e,$3}function sA(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!sA(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!sA(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let br=class CF{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))n||(n=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(s)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&sA(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return CF.none;if(e instanceof CF)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};br.none=[];class aA extends Error{}class ft{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=P0e(this.content,e+this.openStart,n);return r&&new ft(r,this.openStart,this.openEnd)}removeBetween(e,n){return new ft(M0e(this.content,e+this.openStart,n+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,n){if(!n)return ft.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new ft(Ke.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)i++;return new ft(e,r,i)}}ft.empty=new ft(Ke.empty,0,0);function M0e(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:a,offset:l}=t.findIndex(n);if(i==e||s.isText){if(l!=n&&!t.child(a).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=a)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(M0e(s.content,e-i-1,n-i-1)))}function P0e(t,e,n,r){let{index:i,offset:s}=t.findIndex(e),a=t.maybeChild(i);if(s==e||a.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let l=P0e(a.content,e-s-1,n,a);return l&&t.replaceChild(i,a.copy(l))}function g$t(t,e,n){if(n.openStart>t.depth)throw new aA("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new aA("Inconsistent open depths");return O0e(t,e,n,0)}function O0e(t,e,n,r){let i=t.index(r),s=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let a=O0e(t,e,n,r+1);return s.copy(s.content.replaceChild(i,a))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let a=t.parent,l=a.content;return Am(a,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:a,end:l}=x$t(n,t);return Am(s,I0e(t,a,l,e,r))}else return Am(s,oA(t,e,r))}function R0e(t,e){if(!e.type.compatibleContent(t.type))throw new aA("Cannot join "+e.type.name+" onto "+t.type.name)}
vendor: 10,929 bytes, line 4977
4977function kF(t,e,n){let r=t.node(n);return R0e(r,e.node(n)),r}function Em(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function a1(t,e,n,r){let i=(e||t).node(n),s=0,a=e?e.index(n):i.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(Em(t.nodeAfter,r),s++));for(let l=s;l<a;l++)Em(i.child(l),r);e&&e.depth==n&&e.textOffset&&Em(e.nodeBefore,r)}function Am(t,e){return t.type.checkContent(e),t.copy(e)}function I0e(t,e,n,r,i){let s=t.depth>i&&kF(t,e,i+1),a=r.depth>i&&kF(n,r,i+1),l=[];return a1(null,t,i,l),s&&a&&e.index(i)==n.index(i)?(R0e(s,a),Em(Am(s,I0e(t,e,n,r,i+1)),l)):(s&&Em(Am(s,oA(t,e,i+1)),l),a1(e,n,i,l),a&&Em(Am(a,oA(n,r,i+1)),l)),a1(r,null,i,l),new Ke(l)}function oA(t,e,n){let r=[];if(a1(null,t,n,r),t.depth>n){let i=kF(t,e,n+1);Em(Am(i,oA(t,e,n+1)),r)}return a1(e,null,n,r),new Ke(r)}function x$t(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let s=n-1;s>=0;s--)i=e.node(s).copy(Ke.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class eS{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.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,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return br.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let l=r;r=i,i=l}let s=r.marks;for(var a=0;a<s.length;a++)s[a].type.spec.inclusive===!1&&(!i||!s[a].isInSet(i.marks))&&(s=s[a--].removeFromSet(s));return s}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){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)&&(!n||n(this.node(r))))return new lA(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 n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,s=n;for(let a=e;;){let{index:l,offset:c}=a.content.findIndex(s),u=s-c;if(r.push(a,l,i+c),!u||(a=a.child(l),a.isText))break;s=u-1,i+=c+1}return new eS(n,r,s)}static resolveCached(e,n){let r=mee.get(e);if(r)for(let s=0;s<r.elts.length;s++){let a=r.elts[s];if(a.pos==n)return a}else mee.set(e,r=new y$t);let i=r.elts[r.i]=eS.resolve(e,n);return r.i=(r.i+1)%v$t,i}}class y$t{constructor(){this.elts=[],this.i=0}}const v$t=12,mee=new WeakMap;class lA{constructor(e,n,r){this.$from=e,this.$to=n,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 b$t=Object.create(null);let wh=class EF{constructor(e,n,r,i=br.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||Ke.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,n,r,i=0){this.content.nodesBetween(e,n,r,i,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,n,r,i){return this.content.textBetween(e,n,r,i)}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,n,r){return this.type==e&&sA(this.attrs,n||e.defaultAttrs||b$t)&&br.sameSet(this.marks,r||br.none)}copy(e=null){return e==this.content?this:new EF(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new EF(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return ft.empty;let i=this.resolve(e),s=this.resolve(n),a=r?0:i.sharedDepth(n),l=i.start(a),u=i.node(a).content.cut(i.pos-l,s.pos-l);return new ft(u,i.depth-a,s.depth-a)}replace(e,n,r){return g$t(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return eS.resolveCached(this,e)}resolveNoCache(e){return eS.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}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()+")"),D0e(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=Ke.empty,i=0,s=r.childCount){let a=this.contentMatchAt(e).matchFragment(r,i,s),l=a&&a.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let c=i;c<s;c++)if(!this.type.allowsMarks(r.child(c).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),a=s&&s.matchFragment(this.content,n);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=br.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!br.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n 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(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=Ke.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};wh.prototype.text=void 0;class cA extends wh{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):D0e(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new cA(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new cA(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function D0e(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class hg{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new w$t(e,n);if(r.next==null)return hg.empty;let i=L0e(r);r.next&&r.err("Unexpected trailing text");let s=E$t(k$t(i));return A$t(s,r),s}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let s=n;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}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:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function s(a,l){let c=a.matchFragment(e,r);if(c&&(!n||c.validEnd))return Ke.from(l.map(u=>u.createAndFill()));for(let u=0;u<a.next.length;u++){let{type:d,next:f}=a.next[u];
vendor: 11,128 bytes, lines 4977-4978
4977if(!(d.isText||d.hasRequiredAttrs())&&i.indexOf(f)==-1){i.push(f);let h=s(f,l.concat(d));if(h)return h}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(e)){let a=[];for(let l=i;l.type;l=l.via)a.push(l.type);return a.reverse()}for(let a=0;a<s.next.length;a++){let{type:l,next:c}=s.next[a];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!i.type||c.validEnd)&&(r.push({match:l.contentMatch,type:l,via:i}),n[l.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 n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let a=0;a<r.next.length;a++)s+=(a?", ":"")+r.next[a].type.name+"->"+e.indexOf(r.next[a].next);return s}).join(`
4978`)}}hg.empty=new hg(!0);class w$t{constructor(e,n){this.string=e,this.nodeTypes=n,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 L0e(t){let e=[];do e.push(_$t(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function _$t(t){let e=[];do e.push(S$t(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function S$t(t){let e=C$t(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=N$t(t,e);else break;return e}function gee(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function N$t(t,e){let n=gee(t),r=n;return t.eat(",")&&(t.next!="}"?r=gee(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function j$t(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let s in n){let a=n[s];a.isInGroup(e)&&i.push(a)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function C$t(t){if(t.eat("(")){let e=L0e(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=j$t(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function k$t(t){let e=[[]];return i(s(t,0),n()),e;function n(){return e.push([])-1}function r(a,l,c){let u={term:c,to:l};return e[a].push(u),u}function i(a,l){a.forEach(c=>c.to=l)}function s(a,l){if(a.type=="choice")return a.exprs.reduce((c,u)=>c.concat(s(u,l)),[]);if(a.type=="seq")for(let c=0;;c++){let u=s(a.exprs[c],l);if(c==a.exprs.length-1)return u;i(u,l=n())}else if(a.type=="star"){let c=n();return r(l,c),i(s(a.expr,c),c),[r(c)]}else if(a.type=="plus"){let c=n();return i(s(a.expr,l),c),i(s(a.expr,c),c),[r(c)]}else{if(a.type=="opt")return[r(l)].concat(s(a.expr,l));if(a.type=="range"){let c=l;for(let u=0;u<a.min;u++){let d=n();i(s(a.expr,c),d),c=d}if(a.max==-1)i(s(a.expr,c),c);else for(let u=a.min;u<a.max;u++){let d=n();r(c,d),i(s(a.expr,c),d),c=d}return[r(c)]}else{if(a.type=="name")return[r(l,void 0,a.value)];throw new Error("Unknown expr type")}}}}function $0e(t,e){return e-t}function xee(t,e){let n=[];return r(e),n.sort($0e);function r(i){let s=t[i];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(i);for(let a=0;a<s.length;a++){let{term:l,to:c}=s[a];!l&&n.indexOf(c)==-1&&r(c)}}}function E$t(t){let e=Object.create(null);return n(xee(t,0));function n(r){let i=[];r.forEach(a=>{t[a].forEach(({term:l,to:c})=>{if(!l)return;let u;for(let d=0;d<i.length;d++)i[d][0]==l&&(u=i[d][1]);xee(t,c).forEach(d=>{u||i.push([l,u=[]]),u.indexOf(d)==-1&&u.push(d)})})});let s=e[r.join(",")]=new hg(r.indexOf(t.length-1)>-1);for(let a=0;a<i.length;a++){let l=i[a][1].sort($0e);s.next.push({type:i[a][0],next:e[l.join(",")]||n(l)})}return s}}function A$t(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],s=!i.validEnd,a=[];for(let l=0;l<i.next.length;l++){let{type:c,next:u}=i.next[l];a.push(c.name),s&&!(c.isText||c.hasRequiredAttrs())&&(s=!1),r.indexOf(u)==-1&&r.push(u)}s&&e.err("Only non-generatable nodes ("+a.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function F0e(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function U0e(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let s=t[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function z0e(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${i}`);for(let i in t){let s=t[i];s.validate&&s.validate(e[i])}}function B0e(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new M$t(t,r,e[r]);return n}let yee=class V0e{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=B0e(e,r.attrs),this.defaultAttrs=F0e(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==hg.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:U0e(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new wh(this,this.computeAttrs(e),Ke.from(n),br.setFrom(r))}createChecked(e=null,n,r){return n=Ke.from(n),this.checkContent(n),new wh(this,this.computeAttrs(e),n,br.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=Ke.from(n),n.size){let a=this.contentMatch.fillBefore(n);if(!a)return null;n=a.append(n)}let i=this.contentMatch.matchFragment(n),s=i&&i.fillBefore(Ke.empty,!0);return s?new wh(this,e,n.append(s),br.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.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){z0e(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 n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:br.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,a)=>r[s]=new V0e(s,n,a));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function T$t(t,e,n){let r=n.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${s}`)}}class M$t{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?T$t(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class lO{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=B0e(e,i.attrs),this.excluded=null;let s=F0e(this.attrs);this.instance=s?new br(this,s):null}create(e=null){return!e&&this.instance?this.instance:new br(this,U0e(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((s,a)=>r[s]=new lO(s,i++,n,a)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){z0e(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class H0e{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=Ps.from(e.nodes),n.marks=Ps.from(e.marks||{}),this.nodes=yee.compile(this.spec.nodes,this),this.marks=lO.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],a=s.spec.content||"",l=s.spec.marks;if(s.contentMatch=r[a]||(r[a]=hg.parse(a,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=l=="_"?null:l?vee(this,l.split(" ")):l==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],a=s.spec.excludes;s.excluded=a==null?[s]:a==""?[]:vee(this,a.split(" "))}this.nodeFromJSON=i=>wh.fromJSON(this,i),this.markFromJSON=i=>br.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof yee){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(n,r,i)}text(e,n){let r=this.nodes.text;return new cA(r,r.defaultAttrs,e,br.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function vee(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],s=t.marks[i],a=s;if(s)n.push(s);else for(let l in t.marks){let c=t.marks[l];(i=="_"||c.spec.group&&c.spec.group.split(" ").indexOf(i)>-1)&&n.push(a=c)}if(!a)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function P$t(t){return t.tag!=null}function O$t(t){return t.style!=null}class _h{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];
vendor: 5,153 bytes, lines 4978-4979
4978n.forEach(i=>{if(P$t(i))this.tags.push(i);else if(O$t(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,n={}){let r=new wee(this,n,!1);return r.addAll(e,br.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new wee(this,n,!0);return r.addAll(e,br.none,n.from,n.to),ft.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(D$t(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let a=s.getAttrs(e);if(a===!1)continue;s.attrs=a||void 0}return s}}}matchStyle(e,n,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let a=this.styles[s],l=a.style;if(!(l.indexOf(e)!=0||a.context&&!r.matchesContext(a.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(a.getAttrs){let c=a.getAttrs(n);if(c===!1)continue;a.attrs=c||void 0}return a}}}static schemaRules(e){let n=[];function r(i){let s=i.priority==null?50:i.priority,a=0;for(;a<n.length;a++){let l=n[a];if((l.priority==null?50:l.priority)<s)break}n.splice(a,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(a=>{r(a=_ee(a)),a.mark||a.ignore||a.clearMark||(a.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(a=>{r(a=_ee(a)),a.node||a.ignore||a.mark||(a.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new _h(e,_h.schemaRules(e)))}}const W0e={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},R$t={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},G0e={ol:!0,ul:!0},tS=1,AF=2,o1=4;function bee(t,e,n){return e!=null?(e?tS:0)|(e==="full"?AF:0):t&&t.whitespace=="pre"?tS|AF:n&~o1}class pC{constructor(e,n,r,i,s,a){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=a,this.content=[],this.activeMarks=br.none,this.match=s||(a&o1?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(Ke.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&tS)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let n=Ke.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(Ke.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!W0e.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class wee{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,s,a=bee(null,n.preserveWhitespace,0)|(r?o1:0);i?s=new pC(i.type,i.attrs,br.none,!0,n.topMatch||i.type.contentMatch,a):r?s=new pC(null,null,br.none,!0,null,a):s=new pC(e.schema.topNodeType,null,br.none,!0,null,a),this.nodes=[s],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top,s=i.options&AF?"full":this.localPreserveWS||(i.options&tS)>0,{schema:a}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,`
4979`);else if(a.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(a.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let c=0;c<l.length;c++)c&&this.insertNode(a.linebreakReplacement.create(),n,!0),l[c]&&this.insertNode(a.text(l[c]),n,!/\S/.test(l[c]));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 l=i.content[i.content.length-1],c=e.previousSibling;(!l||c&&c.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(a.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),l;G0e.hasOwnProperty(a)&&this.parser.normalizeLists&&I$t(e);let c=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(c?c.ignore:R$t.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,n);else if(!c||c.skip||c.closeParent){c&&c.closeParent?this.open=Math.max(0,this.open-1):c&&c.skip.nodeType&&(e=c.skip);let u,d=this.needsBlock;
vendor: 5,113 bytes, lines 4979-4980
4979if(W0e.hasOwnProperty(a))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),u=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let f=c&&c.skip?n:this.readStyles(e,n);f&&this.addAll(e,f),u&&this.sync(s),this.needsBlock=d}else{let u=this.readStyles(e,n);u&&this.addElementByRule(e,c,u,c.consuming===!1?l:void 0)}this.localPreserveWS=i}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4980`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],a=r.getPropertyValue(s);if(a)for(let l=void 0;;){let c=this.parser.matchStyle(s,a,this,l);if(!c)break;if(c.ignore)return null;if(c.clearMark?n=n.filter(u=>!c.clearMark(u)):n=n.concat(this.parser.schema.marks[c.mark].create(c.attrs)),c.consuming===!1)l=c;else break}}return n}addElementByRule(e,n,r,i){let s,a;if(n.node)if(a=this.parser.schema.nodes[n.node],a.isLeaf)this.insertNode(a.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let c=this.enter(a,n.attrs||null,r,n.preserveWhitespace);c&&(s=!0,r=c)}else{let c=this.parser.schema.marks[n.mark];r=r.concat(c.create(n.attrs))}let l=this.top;if(a&&a.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(c=>this.insertNode(c,r,!1));else{let c=e;typeof n.contentElement=="string"?c=e.querySelector(n.contentElement):typeof n.contentElement=="function"?c=n.contentElement(e):n.contentElement&&(c=n.contentElement),this.findAround(e,c,!0),this.addAll(c,r),this.findAround(e,c,!1)}s&&this.sync(l)&&this.open--}addAll(e,n,r,i){let s=r||0;for(let a=r?e.childNodes[r]:e.firstChild,l=i==null?null:e.childNodes[i];a!=l;a=a.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(a,n);this.findAtPoint(e,s)}findPlace(e,n,r){let i,s;for(let a=this.open,l=0;a>=0;a--){let c=this.nodes[a],u=c.findWrapping(e);if(u&&(!i||i.length>u.length+l)&&(i=u,s=c,!u.length))break;if(c.solid){if(r)break;l+=2}}if(!i)return null;this.sync(s);for(let a=0;a<i.length;a++)n=this.enterInner(i[a],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(n=this.enterInner(s,null,n))}let i=this.findPlace(e,n,r);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let a=br.none;for(let l of i.concat(e.marks))(s.type?s.type.allowsMarkType(l.type):See(l.type,e.type))&&(a=l.addToSet(a));return s.content.push(e.mark(a)),!0}return!1}enter(e,n,r,i){let s=this.findPlace(e.create(n),r,!1);return s&&(s=this.enterInner(e,n,r,!0,i)),s}enterInner(e,n,r,i=!1,s){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let l=bee(e,s,a.options);a.options&o1&&a.content.length==0&&(l|=o1);let c=br.none;return r=r.filter(u=>(a.type?a.type.allowsMarkType(u.type):See(u.type,e))?(c=u.addToSet(c),!1):!0),this.nodes.push(new pC(e,n,c,i,null,l)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].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 n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=tS)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),a=(l,c)=>{for(;l>=0;l--){let u=n[l];if(u==""){if(l==n.length-1||l==0)continue;for(;c>=s;c--)if(a(l-1,c))return!0;return!1}else{let d=c>0||c==0&&i?this.nodes[c].type:r&&c>=s?r.node(c-s).type:null;if(!d||d.name!=u&&!d.isInGroup(u))return!1;c--}}return!0};return a(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;
vendor: 7,974 bytes, line 4980
4980if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function I$t(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&G0e.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function D$t(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function _ee(t){let e={};for(let n in t)e[n]=t[n];return e}function See(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let s=[],a=l=>{s.push(l);for(let c=0;c<l.edgeCount;c++){let{type:u,next:d}=l.edge(c);if(u==e||s.indexOf(d)<0&&a(d))return!0}};if(a(i.contentMatch))return!0}}class Vg{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=F3(n).createDocumentFragment());let i=r,s=[];return e.forEach(a=>{if(s.length||a.marks.length){let l=0,c=0;for(;l<s.length&&c<a.marks.length;){let u=a.marks[c];if(!this.marks[u.type.name]){c++;continue}if(!u.eq(s[l][0])||u.type.spec.spanning===!1)break;l++,c++}for(;l<s.length;)i=s.pop()[1];for(;c<a.marks.length;){let u=a.marks[c++],d=this.serializeMark(u,a.isInline,n);d&&(s.push([u,i]),i.appendChild(d.dom),i=d.contentDOM||d.dom)}}i.appendChild(this.serializeNodeInner(a,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:i}=mk(F3(n),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,i)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,n);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&mk(F3(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return mk(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Vg(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=Nee(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return Nee(e.marks)}}function Nee(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function F3(t){return t.document||window.document}const jee=new WeakMap;function L$t(t){let e=jee.get(t);return e===void 0&&jee.set(t,e=$$t(t)),e}function $$t(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)n(r[i]);else for(let i in r)n(r[i])}return n(t),e}function mk(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=L$t(r))&&s.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=i.indexOf(" ");a>0&&(n=i.slice(0,a),i=i.slice(a+1));let l,c=n?t.createElementNS(n,i):t.createElement(i),u=e[1],d=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){d=2;for(let f in u)if(u[f]!=null){let h=f.indexOf(" ");h>0?c.setAttributeNS(f.slice(0,h),f.slice(h+1),u[f]):f=="style"&&c.style?c.style.cssText=u[f]:c.setAttribute(f,u[f])}}for(let f=d;f<e.length;f++){let h=e[f];if(h===0){if(f<e.length-1||f>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:c,contentDOM:c}}else{let{dom:p,contentDOM:m}=mk(t,h,n,r);if(c.appendChild(p),m){if(l)throw new RangeError("Multiple content holes");l=m}}}return{dom:c,contentDOM:l}}const q0e=65535,K0e=Math.pow(2,16);function F$t(t,e){return t+e*K0e}function Cee(t){return t&q0e}function U$t(t){return(t-(t&q0e))/K0e}const Y0e=1,X0e=2,gk=4,Q0e=8;class TF{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Q0e)>0}get deletedBefore(){return(this.delInfo&(Y0e|gk))>0}get deletedAfter(){return(this.delInfo&(X0e|gk))>0}get deletedAcross(){return(this.delInfo&gk)>0}}class xo{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&xo.empty)return xo.empty}recover(e){let n=0,r=Cee(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+U$t(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,s=this.inverted?2:1,a=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let c=this.ranges[l]-(this.inverted?i:0);if(c>e)break;let u=this.ranges[l+s],d=this.ranges[l+a],f=c+u;if(e<=f){let h=u?e==c?-1:e==f?1:n:n,p=c+i+(h<0?0:d);if(r)return p;let m=e==(n<0?c:f)?null:F$t(l/3,e-c),x=e==c?X0e:e==f?Y0e:gk;return(n<0?e!=c:e!=f)&&(x|=Q0e),new TF(p,x,m)}i+=d-u}return r?e+i:new TF(e+i,0,null)}touches(e,n){let r=0,i=Cee(n),s=this.inverted?2:1,a=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let c=this.ranges[l]-(this.inverted?r:0);if(c>e)break;let u=this.ranges[l+s],d=c+u;if(e<=d&&l==i*3)return!0;r+=this.ranges[l+a]-u}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let a=this.ranges[i],l=a-(this.inverted?s:0),c=a+(this.inverted?0:s),u=this.ranges[i+n],d=this.ranges[i+r];e(l,l+u,c,c+d),s+=d-u}}invert(){return new xo(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?xo.empty:new xo(e<0?[0,-e,0]:[0,0,e])}}xo.empty=new xo([]);class nS{constructor(e,n,r=0,i=e?e.length:0){this.mirror=n,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new nS(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let i=e.getMirror(n);this.appendMap(e._maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new nS;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let s=this.from;s<this.to;s++){let a=this._maps[s],l=a.mapResult(e,n);if(l.recover!=null){let c=this.getMirror(s);if(c!=null&&c>s&&c<this.to){s=c,e=this._maps[c].recover(l.recover);continue}}i|=l.delInfo,e=l.pos}return r?e:new TF(e,i,null)}}const U3=Object.create(null);class Zs{getMap(){return xo.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=U3[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in U3)throw new RangeError("Duplicate use of step JSON ID "+e);return U3[e]=n,n.prototype.jsonID=e,n}}class Mi{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Mi(e,null)}static fail(e){return new Mi(null,e)}static fromReplace(e,n,r,i){try{return Mi.ok(e.replace(n,r,i))}catch(s){if(s instanceof aA)return Mi.fail(s.message);throw s}}}function h9(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(h9(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return Ke.fromArray(r)}class Zf extends Zs{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.no
vendor: 7,394 bytes, line 4980
4980de(r.sharedDepth(this.to)),s=new ft(h9(n.content,(a,l)=>!a.isAtom||!l.type.allowsMarkType(this.mark.type)?a:a.mark(this.mark.addToSet(a.marks)),i),n.openStart,n.openEnd);return Mi.fromReplace(e,this.from,this.to,s)}invert(){return new ic(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Zf(n.pos,r.pos,this.mark)}merge(e){return e instanceof Zf&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Zf(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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Zf(n.from,n.to,e.markFromJSON(n.mark))}}Zs.jsonID("addMark",Zf);class ic extends Zs{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new ft(h9(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Mi.fromReplace(e,this.from,this.to,r)}invert(){return new Zf(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new ic(n.pos,r.pos,this.mark)}merge(e){return e instanceof ic&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ic(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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new ic(n.from,n.to,e.markFromJSON(n.mark))}}Zs.jsonID("removeMark",ic);class eh extends Zs{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Mi.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Mi.fromReplace(e,this.pos,this.pos+1,new ft(Ke.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new eh(this.pos,n.marks[i]);return new eh(this.pos,this.mark)}}return new pg(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new eh(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new eh(n.pos,e.markFromJSON(n.mark))}}Zs.jsonID("addNodeMark",eh);class pg extends Zs{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Mi.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Mi.fromReplace(e,this.pos,this.pos+1,new ft(Ke.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new eh(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new pg(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new pg(n.pos,e.markFromJSON(n.mark))}}Zs.jsonID("removeNodeMark",pg);class hs extends Zs{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&MF(e,this.from,this.to)?Mi.fail("Structure replace would overwrite content"):Mi.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new xo([this.from,this.to-this.from,this.slice.size])}invert(e){return new hs(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new hs(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof hs)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?ft.empty:new ft(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new hs(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?ft.empty:new ft(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new hs(e.from,this.to,n,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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new hs(n.from,n.to,ft.fromJSON(e,n.slice),!!n.structure)}}Zs.jsonID("replace",hs);class vs extends Zs{constructor(e,n,r,i,s,a,l=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=a,this.structure=l}apply(e){if(this.structure&&(MF(e,this.from,this.gapFrom)||MF(e,this.gapTo,this.to)))return Mi.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Mi.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Mi.fromReplace(e,this.from,this.to,r):Mi.fail("Content does not fit in gap")}getMap(){return new xo([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new vs(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new vs(n.pos,r.pos,i,s,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,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new vs(n.from,n.to,n.gapFrom,n.gapTo,ft.fromJSON(e,n.slice),n.insert,!!n.structure)}}Zs.jsonID("replaceAround",vs);function MF(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let a=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,i--}}return!1}function z$t(t,e,n,r){let i=[],s=[],a,l;t.doc.nodesBetween(e,n,(c,u,d)=>{if(!c.isInline)return;let f=c.marks;if(!r.isInSet(f)&&d.type.allowsMarkType(r.type)){let h=Math.max(u,e),p=Math.min(u+c.nodeSize,n),m=r.addToSet(f);for(let x=0;x<f.length;x++)f[x].isInSet(m)||(a&&a.to==h&&a.mark.eq(f[x])?a.to=p:i.push(a=new ic(h,p,f[x])));
vendor: 5,975 bytes, lines 4980-4981
4980l&&l.to==h?l.to=p:s.push(l=new Zf(h,p,r))}}),i.forEach(c=>t.step(c)),s.forEach(c=>t.step(c))}function B$t(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(a,l)=>{if(!a.isInline)return;s++;let c=null;if(r instanceof lO){let u=a.marks,d;for(;d=r.isInSet(u);)(c||(c=[])).push(d),u=d.removeFromSet(u)}else r?r.isInSet(a.marks)&&(c=[r]):c=a.marks;if(c&&c.length){let u=Math.min(l+a.nodeSize,n);for(let d=0;d<c.length;d++){let f=c[d],h;for(let p=0;p<i.length;p++){let m=i[p];m.step==s-1&&f.eq(i[p].style)&&(h=m)}h?(h.to=u,h.step=s):i.push({style:f,from:Math.max(l,e),to:u,step:s})}}}),i.forEach(a=>t.step(new ic(a.from,a.to,a.style)))}function p9(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),a=[],l=e+1;for(let c=0;c<s.childCount;c++){let u=s.child(c),d=l+u.nodeSize,f=r.matchType(u.type);if(!f)a.push(new hs(l,d,ft.empty));else{r=f;for(let h=0;h<u.marks.length;h++)n.allowsMarkType(u.marks[h].type)||t.step(new ic(l,d,u.marks[h]));if(i&&u.isText&&n.whitespace!="pre"){let h,p=/\r?\n|\r/g,m;for(;h=p.exec(u.text);)m||(m=new ft(Ke.from(n.schema.text(" ",n.allowedMarks(u.marks))),0,0)),a.push(new hs(l+h.index,l+h.index+h[0].length,m))}}l=d}if(!r.validEnd){let c=r.fillBefore(Ke.empty,!0);t.replace(l,l,new ft(c,0,0))}for(let c=a.length-1;c>=0;c--)t.step(a[c])}function V$t(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Z0(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,s=0;;--r){let a=t.$from.node(r),l=t.$from.index(r)+i,c=t.$to.indexAfter(r)-s;if(r<t.depth&&a.canReplace(l,c,n))return r;if(r==0||a.type.spec.isolating||!V$t(a,l,c))break;l&&(i=1),c<a.childCount&&(s=1)}return null}function H$t(t,e,n){let{$from:r,$to:i,depth:s}=e,a=r.before(s+1),l=i.after(s+1),c=a,u=l,d=Ke.empty,f=0;for(let m=s,x=!1;m>n;m--)x||r.index(m)>0?(x=!0,d=Ke.from(r.node(m).copy(d)),f++):c--;let h=Ke.empty,p=0;for(let m=s,x=!1;m>n;m--)x||i.after(m+1)<i.end(m)?(x=!0,h=Ke.from(i.node(m).copy(h)),p++):u++;t.step(new vs(c,u,a,l,new ft(d.append(h),f,p),d.size-f,!0))}function m9(t,e,n=null,r=t){let i=W$t(t,e),s=i&&G$t(r,e);return s?i.map(kee).concat({type:e,attrs:n}).concat(s.map(kee)):null}function kee(t){return{type:t,attrs:null}}function W$t(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let a=s.length?s[0]:e;return n.canReplaceWith(r,i,a)?s:null}function G$t(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.child(r),a=e.contentMatch.findWrapping(s.type);if(!a)return null;let c=(a.length?a[a.length-1]:e).contentMatch;for(let u=r;c&&u<i;u++)c=c.matchType(n.child(u).type);return!c||!c.validEnd?null:a}function q$t(t,e,n){let r=Ke.empty;for(let a=n.length-1;a>=0;a--){if(r.size){let l=n[a].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=Ke.from(n[a].type.create(n[a].attrs,r))}let i=e.start,s=e.end;t.step(new vs(i,s,i,s,new ft(r,0,0),n.length,!0))}function K$t(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(a,l)=>{let c=typeof i=="function"?i(a):i;if(a.isTextblock&&!a.hasMarkup(r,c)&&Y$t(t.doc,t.mapping.slice(s).map(l),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&&Z0e(t,a,l,s),p9(t,t.mapping.slice(s).map(l,1),r,void 0,u===null);let d=t.mapping.slice(s),f=d.map(l,1),h=d.map(l+a.nodeSize,1);return t.step(new vs(f,h,f+1,h-1,new ft(Ke.from(r.create(c,null,a.marks)),0,0),1,!0)),u===!0&&J0e(t,a,l,s),!1}})}function J0e(t,e,n,r){e.forEach((i,s)=>{if(i.isText){let a,l=/\r?\n|\r/g;for(;a=l.exec(i.text);){let c=t.mapping.slice(r).map(n+1+s+a.index);t.replaceWith(c,c+1,e.type.schema.linebreakReplacement.create())}}})}function Z0e(t,e,n,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let a=t.mapping.slice(r).map(n+1+s);t.replaceWith(a,a+1,e.type.schema.text(`
4981`))}})}function Y$t(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function X$t(t,e,n,r,i){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let a=n.create(r,null,i||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,a);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new vs(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new ft(Ke.from(a),0,0),1,!0))}function pd(t,e,n=1,r){let i=t.resolve(e),s=i.depth-n,a=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!a.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let u=i.depth-1,d=n-2;u>s;u--,d--){let f=i.node(u),h=i.index(u);if(f.type.spec.isolating)return!1;let p=f.content.cutByIndex(h,f.childCount),m=r&&r[d+1];m&&(p=p.replaceChild(0,m.type.create(m.attrs)));let x=r&&r[d]||f;if(!f.canReplace(h+1,f.childCount)||!x.type.validContent(p))return!1}let l=i.indexAfter(s),c=r&&r[0];return i.node(s).canReplaceWith(l,l,c?c.type:i.node(s+1).type)}function Q$t(t,e,n=1,r){let i=t.doc.resolve(e),s=Ke.empty,a=Ke.empty;for(let l=i.depth,c=i.depth-n,u=n-1;l>c;l--,u--){s=Ke.from(i.node(l).copy(s));let d=r&&r[u];a=Ke.from(d?d.type.create(d.attrs,a):i.node(l).copy(a))}t.step(new hs(e,e,new ft(s.append(a),n,n),!0))}function lp(t,e){let n=t.resolve(e),r=n.index();return ebe(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function J$t(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),a=s.type==r?t.type.schema.nodes.text:s.type;if(n=n.matchType(a),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function ebe(t,e){return!!(t&&e&&!t.isLeaf&&J$t(t,e))}function cO(t,e,n=-1){let r=t.resolve(e);for(let i=r.depth;;
vendor: 10,618 bytes, line 4981
4981i--){let s,a,l=r.index(i);if(i==r.depth?(s=r.nodeBefore,a=r.nodeAfter):n>0?(s=r.node(i+1),l++,a=r.node(i).maybeChild(l)):(s=r.node(i).maybeChild(l-1),a=r.node(i+1)),s&&!s.isTextblock&&ebe(s,a)&&r.node(i).canReplace(l,l+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function Z$t(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,s=t.doc.resolve(e-n),a=s.node().type;if(i&&a.inlineContent){let d=a.whitespace=="pre",f=!!a.contentMatch.matchType(i);d&&!f?r=!1:!d&&f&&(r=!0)}let l=t.steps.length;if(r===!1){let d=t.doc.resolve(e+n);Z0e(t,d.node(),d.before(),l)}a.inlineContent&&p9(t,e+n-1,a,s.node().contentMatchAt(s.index()),r==null);let c=t.mapping.slice(l),u=c.map(e-n);if(t.step(new hs(u,c.map(e+n,-1),ft.empty,!0)),r===!0){let d=t.doc.resolve(u);J0e(t,d.node(),d.before(),t.steps.length)}return t}function e5t(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,n))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,n))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function tbe(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let s=0;s<n.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let a=r.depth;a>=0;a--){let l=a==r.depth?0:r.pos<=(r.start(a+1)+r.end(a+1))/2?-1:1,c=r.index(a)+(l>0?1:0),u=r.node(a),d=!1;if(s==1)d=u.canReplace(c,c,i);else{let f=u.contentMatchAt(c).findWrapping(i.firstChild.type);d=f&&u.canReplaceWith(c,c,f[0])}if(d)return l==0?r.pos:l<0?r.before(a+1):r.after(a+1)}return null}function uO(t,e,n=e,r=ft.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return nbe(i,s,r)?new hs(e,n,r):new t5t(i,s,r).fit()}function nbe(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class t5t{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=Ke.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=Ke.from(e.node(i).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(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,a=r.depth,l=i.depth;for(;a&&l&&s.childCount==1;)s=s.firstChild.content,a--,l--;let c=new ft(s,a,l);return e>-1?new vs(r.pos,e,this.$to.pos,this.$to.end(),c,n):c.size||r.pos!=this.$to.pos?new hs(r.pos,i.pos,c):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=n.firstChild;if(n.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=z3(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let a=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:c,match:u}=this.frontier[l],d,f=null;if(n==1&&(a?u.matchType(a.type)||(f=u.fillBefore(Ke.from(a),!1)):s&&c.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:l,parent:s,inject:f};if(n==2&&a&&(d=u.findWrapping(a.type)))return{sliceDepth:r,frontierDepth:l,parent:s,wrap:d};if(s&&u.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=z3(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new ft(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=z3(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new ft(Sw(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new ft(Sw(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let x=0;x<s.length;x++)this.openFrontierNode(s[x]);let a=this.unplaced,l=r?r.content:a.content,c=a.openStart-e,u=0,d=[],{match:f,type:h}=this.frontier[n];if(i){for(let x=0;x<i.childCount;x++)d.push(i.child(x));f=f.matchFragment(i)}let p=l.size+e-(a.content.size-a.openEnd);for(;u<l.childCount;){let x=l.child(u),y=f.matchType(x.type);if(!y)break;u++,(u>1||c==0||x.content.size)&&(f=y,d.push(rbe(x.mark(h.allowedMarks(x.marks)),u==1?c:0,u==l.childCount?p:-1)))}let m=u==l.childCount;m||(p=-1),this.placed=Nw(this.placed,n,Ke.from(d)),this.frontier[n].match=f,m&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let x=0,y=l;x<p;x++){let g=y.lastChild;this.frontier.push({type:g.type,match:g.contentMatchAt(g.childCount)}),y=g.content}this.unplaced=m?e==0?ft.empty:new ft(Sw(a.content,e-1,1),e-1,p<0?a.openEnd:e-1):new ft(Sw(a.content,e,u),a.openStart,a.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!B3(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),a=B3(e,n,i,r,s);if(a){for(let l=n-1;l>=0;l--){let{match:c,type:u}=this.frontier[l],d=B3(e,l,u,c,!0);if(!d||d.childCount)continue e}return{depth:n,fit:a,move:s?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Nw(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Nw(this.placed,this.depth,Ke.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(Ke.empty,!0);n.childCount&&(this.placed=Nw(this.placed,this.frontier.length,n))}}function Sw(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Sw(t.firstChild.content,e-1,n)))}function Nw(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Nw(t.lastChild.content,e-1,n)))}function z3(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function rbe(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,rbe(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(Ke.empty,!0)))),t.copy(r)}function B3(t,e,n,r,i){let s=t.node(e),a=i?t.indexAfter(e):t.index(e);if(a==s.childCount&&!n.compatibleContent(s.type))return null;let l=r.fillBefore(s.content,!0,a);return l&&!n5t(n,s.content,a)?l:null}function n5t(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function r5t(t){return t.spec.defining||t.spec.definingForContent}function i5t(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if(nbe(i,s,r))return t.step(new hs(e,n,r));let a=sbe(i,s);a[a.length-1]==0&&a.pop();let l=-(i.depth+1);a.unshift(l);for(let h=i.depth,p=i.pos-1;h>0;h--,p--){let m=i.node(h).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;a.indexOf(h)>-1?l=h:i.before(h)==p&&a.splice(1,0,-h)}let c=a.indexOf(l),u=[],d=r.openStart;for(let h=r.content,p=0;;p++){let m=h.firstChild;if(u.push(m),p==r.openStart)break;h=m.content}for(let h=d-1;h>=0;h--){let p=u[h],m=r5t(p.type);if(m&&!p.sameMarkup(i.node(Math.abs(l)-1)))d=h;else if(m||!p.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let p=(h+d+1)%(r.openStart+1),m=u[p];if(m)for(let x=0;x<a.length;x++){let y=a[(x+c)%a.length],g=!0;y<0&&(g=!1,y=-y);let w=i.node(y-1),v=i.index(y-1);if(w.canReplaceWith(v,v,m.type,m.marks))return t.replace(i.before(y),g?s.after(y):n,new ft(ibe(r.content,0,r.openStart,p),p,r.openEnd))}}let f=t.steps.length;for(let h=a.length-1;h>=0&&(t.replace(e,n,r),!(t.steps.length>f));h--){let p=a[h];p<0||(e=i.before(p),n=s.after(p))}}function ibe(t,e,n,r,i){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(ibe(s.content,e+1,n,r,s)))}if(e>r){let s=i.contentMatchAt(0),a=s.fillBefore(t).append(t);t=a.append(s.matchFragment(a).fillBefore(Ke.empty,!0))}return t}function s5t(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=e5t(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new ft(Ke.from(r),0,0))}function a5t(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),s=sbe(r,i);for(let a=0;a<s.length;a++){let l=s[a],c=a==s.length-1;if(c&&l==0||r.node(l).type.contentMatch.validEnd)return t.delete(r.start(l),i.end(l));if(l>0&&(c||r.node(l-1).canReplace(r.index(l-1),i.indexAfter(l-1))))return t.delete(r.before(l),i.after(l))}for(let a=1;a<=r.depth&&a<=i.depth;a++)if(e-r.start(a)==r.depth-a&&n>r.end(a)&&i.end(a)-n!=i.depth-a&&r.start(a-1)==i.start(a-1)&&r.node(a-1).canReplace(r.index(a-1),i.index(a-1)))return t.delete(r.before(a),n);t.delete(e,n)}function sbe(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let s=t.start(i);if(s<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&n.push(i)}return n}class Uy extends Zs{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Mi.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return Mi.fromReplace(e,this.pos,this.pos+1,new ft(Ke.from(i),0,n.isLeaf?0:1))}getMap(){return xo.empty}invert(e){return new Uy(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Uy(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Uy(n.pos,n.attr,n.value)}}
vendor: 4,545 bytes, line 4981
4981Zs.jsonID("attr",Uy);class rS extends Zs{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Mi.ok(r)}getMap(){return xo.empty}invert(e){return new rS(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new rS(n.attr,n.value)}}Zs.jsonID("docAttr",rS);let d0=class extends Error{};d0=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};d0.prototype=Object.create(Error.prototype);d0.prototype.constructor=d0;d0.prototype.name="TransformError";class abe{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new nS}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new d0(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=ft.empty){let i=uO(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new ft(Ke.from(r),0,0))}delete(e,n){return this.replace(e,n,ft.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return i5t(this,e,n,r),this}replaceRangeWith(e,n,r){return s5t(this,e,n,r),this}deleteRange(e,n){return a5t(this,e,n),this}lift(e,n){return H$t(this,e,n),this}join(e,n=1){return Z$t(this,e,n),this}wrap(e,n){return q$t(this,e,n),this}setBlockType(e,n=e,r,i=null){return K$t(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return X$t(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new Uy(e,n,r)),this}setDocAttribute(e,n){return this.step(new rS(e,n)),this}addNodeMark(e,n){return this.step(new eh(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof br)n.isInSet(r.marks)&&this.step(new pg(e,n));else{let i=r.marks,s,a=[];for(;s=n.isInSet(i);)a.push(new pg(e,s)),i=s.removeFromSet(i);for(let l=a.length-1;l>=0;l--)this.step(a[l])}return this}split(e,n=1,r){return Q$t(this,e,n,r),this}addMark(e,n,r){return z$t(this,e,n,r),this}removeMark(e,n,r){return B$t(this,e,n,r),this}clearIncompatible(e,n,r){return p9(this,e,n,r),this}}const V3=Object.create(null);class Nn{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new o5t(e.min(n),e.max(n))]}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 n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=ft.empty){let r=n.content.lastChild,i=null;for(let l=0;l<n.openEnd;l++)i=r,r=r.lastChild;let s=e.steps.length,a=this.ranges;for(let l=0;l<a.length;l++){let{$from:c,$to:u}=a[l],d=e.mapping.slice(s);e.replaceRange(d.map(c.pos),d.map(u.pos),l?ft.empty:n),l==0&&Tee(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:a,$to:l}=i[s],c=e.mapping.slice(r),u=c.map(a.pos),d=c.map(l.pos);s?e.deleteRange(u,d):(e.replaceRangeWith(u,d,n),Tee(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new rn(e):Vx(e.node(0),e.parent,e.pos,e.index(),n,r);if(i)return i;for(let s=e.depth-1;s>=0;s--){let a=n<0?Vx(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):Vx(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,n,r);if(a)return a}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new ko(e.node(0))}static atStart(e){return Vx(e,e,0,0,1)||new ko(e)}static atEnd(e){return Vx(e,e,e.content.size,e.childCount,-1)||new ko(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=V3[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in V3)throw new RangeError("Duplicate use of selection JSON ID "+e);return V3[e]=n,n.prototype.jsonID=e,n}getBookmark(){return rn.between(this.$anchor,this.$head).getBookmark()}}Nn.prototype.visible=!0;class o5t{constructor(e,n){this.$from=e,this.$to=n}}let Eee=!1;
vendor: 6,499 bytes, line 4981
4981function Aee(t){!Eee&&!t.parent.inlineContent&&(Eee=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class rn extends Nn{constructor(e,n=e){Aee(e),Aee(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return Nn.near(r);let i=e.resolve(n.map(this.anchor));return new rn(i.parent.inlineContent?i:r,r)}replace(e,n=ft.empty){if(super.replace(e,n),n==ft.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof rn&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new dO(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new rn(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let s=Nn.findFrom(n,r,!0)||Nn.findFrom(n,-r,!0);if(s)n=s.$head;else return Nn.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(Nn.findFrom(e,-r,!0)||Nn.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new rn(e,n)}}Nn.jsonID("text",rn);class dO{constructor(e,n){this.anchor=e,this.head=n}map(e){return new dO(e.map(this.anchor),e.map(this.head))}resolve(e){return rn.between(e.resolve(this.anchor),e.resolve(this.head))}}class Wt extends Nn{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),s=e.resolve(i);return r?Nn.near(s):new Wt(s)}content(){return new ft(Ke.from(this.node),0,0)}eq(e){return e instanceof Wt&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new g9(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Wt(e.resolve(n.anchor))}static create(e,n){return new Wt(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Wt.prototype.visible=!1;Nn.jsonID("node",Wt);class g9{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new dO(r,r):new g9(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&Wt.isSelectable(r)?new Wt(n):Nn.near(n)}}class ko extends Nn{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=ft.empty){if(n==ft.empty){e.delete(0,e.doc.content.size);let r=Nn.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new ko(e)}map(e){return new ko(e)}eq(e){return e instanceof ko}getBookmark(){return l5t}}Nn.jsonID("all",ko);const l5t={map(){return this},resolve(t){return new ko(t)}};function Vx(t,e,n,r,i,s=!1){if(e.inlineContent)return rn.create(t,n);for(let a=r-(i>0?0:1);i>0?a<e.childCount:a>=0;a+=i){let l=e.child(a);if(l.isAtom){if(!s&&Wt.isSelectable(l))return Wt.create(t,n-(i<0?l.nodeSize:0))}else{let c=Vx(t,l,n+i,i<0?l.childCount:0,i,s);if(c)return c}n+=l.nodeSize*i}return null}function Tee(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof hs||i instanceof vs))return;let s=t.mapping.maps[r],a;s.forEach((l,c,u,d)=>{a==null&&(a=d)}),t.setSelection(Nn.near(t.doc.resolve(a),n))}const Mee=1,mC=2,Pee=4;class c5t extends abe{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|Mee)&~mC,this.storedMarks=null,this}get selectionSet(){return(this.updated&Mee)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=mC,this}ensureMarks(e){return br.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&mC)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~mC,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||br.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let s=this.storedMarks;if(!s){let a=this.doc.resolve(n);s=r==n?a.marks():a.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,s)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(Nn.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,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|=Pee,this}get scrolledIntoView(){return(this.updated&Pee)>0}}function Oee(t,e){return!e||!t?t:t.bind(e)}class jw{constructor(e,n,r){this.name=e,this.init=Oee(n.init,r),this.apply=Oee(n.apply,r)}}const u5t=[new jw("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new jw("selection",{init(t,e){return t.selection||Nn.atStart(e.doc)},apply(t){return t.selection}}),new jw("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new jw("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class H3{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=u5t.slice(),n&&n.forEac
vendor: 4,989 bytes, line 4981
4981h(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 jw(r.key,r.spec.state,r))})}}class gy{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,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),i=null;for(;;){let s=!1;for(let a=0;a<this.config.plugins.length;a++){let l=this.config.plugins[a];if(l.spec.appendTransaction){let c=i?i[a].n:0,u=i?i[a].state:this,d=c<n.length&&l.spec.appendTransaction.call(l,c?n.slice(c):n,u,r);if(d&&r.filterTransaction(d,a)){if(d.setMeta("appendedTransaction",e),!i){i=[];for(let f=0;f<this.config.plugins.length;f++)i.push(f<a?{state:r,n:n.length}:{state:this,n:0})}n.push(d),r=r.applyInner(d),s=!0}i&&(i[a]={state:r,n:n.length})}}if(!s)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new gy(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];n[s.name]=s.apply(e,this[s.name],this,n)}return n}get tr(){return new c5t(this)}static create(e){let n=new H3(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new gy(n);for(let i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(e,r);return r}reconfigure(e){let n=new H3(this.schema,e.plugins),r=n.fields,i=new gy(n);for(let s=0;s<r.length;s++){let a=r[s].name;i[a]=this.hasOwnProperty(a)?this[a]:r[s].init(e,i)}return i}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.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 i=e[r],s=i.spec.state;s&&s.toJSON&&(n[r]=s.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new H3(e.schema,e.plugins),s=new gy(i);return i.fields.forEach(a=>{if(a.name=="doc")s.doc=wh.fromJSON(e.schema,n.doc);else if(a.name=="selection")s.selection=Nn.fromJSON(s.doc,n.selection);else if(a.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let c=r[l],u=c.spec.state;if(c.key==a.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){s[a.name]=u.fromJSON.call(c,e,n[l],s);return}}s[a.name]=a.init(e,s)}}),s}}function obe(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=obe(i,e,{})),n[r]=i}return n}class si{constructor(e){this.spec=e,this.props={},e.props&&obe(e.props,this,this.props),this.key=e.key?e.key.key:lbe("plugin")}getState(e){return e[this.key]}}const W3=Object.create(null);function lbe(t){return t in W3?t+"$"+ ++W3[t]:(W3[t]=0,t+"$")}class ss{constructor(e="key"){this.key=lbe(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const x9=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function cbe(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const ube=(t,e,n)=>{let r=cbe(t,n);if(!r)return!1;let i=y9(r);if(!i){let a=r.blockRange(),l=a&&Z0(a);return l==null?!1:(e&&e(t.tr.lift(a,l).scrollIntoView()),!0)}let s=i.nodeBefore;if(vbe(t,i,e,-1))return!0;if(r.parent.content.size==0&&(f0(s,"end")||Wt.isSelectable(s)))for(let a=r.depth;;a--){let l=uO(t.doc,r.before(a),r.after(a),ft.empty);if(l&&l.slice.size<l.to-l.from){if(e){let c=t.tr.step(l);c.setSelection(f0(s,"end")?Nn.findFrom(c.doc.resolve(c.mapping.map(i.pos,-1)),-1):Wt.create(c.doc,i.pos-s.nodeSize)),e(c.scrollIntoView())}return!0}if(a==1||r.node(a-1).childCount>1)break}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},d5t=(t,e,n)=>{let r=cbe(t,n);if(!r)return!1;let i=y9(r);return i?dbe(t,i,e):!1},f5t=(t,e,n)=>{let r=hbe(t,n);if(!r)return!1;let i=v9(r);return i?dbe(t,i,e):!1};function dbe(t,e,n){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let d=i.lastChild;if(!d)return!1;i=d}let a=e.nodeAfter,l=a,c=e.pos+1;for(;!l.isTextblock;c++){if(l.type.spec.isolating)return!1;let d=l.firstChild;if(!d)return!1;l=d}let u=uO(t.doc,s,c,ft.empty);if(!u||u.from!=s||u instanceof hs&&u.slice.size>=c-s)return!1;if(n){let d=t.tr.step(u);d.setSelection(rn.create(d.doc,s)),n(d.scrollIntoView())}return!0}function f0(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;
vendor: 12,222 bytes, lines 4981-4982
4981if(n&&r.childCount!=1)return!1}return!1}const fbe=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;s=y9(r)}let a=s&&s.nodeBefore;return!a||!Wt.isSelectable(a)?!1:(e&&e(t.tr.setSelection(Wt.create(t.doc,s.pos-a.nodeSize)).scrollIntoView()),!0)};function y9(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function hbe(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const pbe=(t,e,n)=>{let r=hbe(t,n);if(!r)return!1;let i=v9(r);if(!i)return!1;let s=i.nodeAfter;if(vbe(t,i,e,1))return!0;if(r.parent.content.size==0&&(f0(s,"start")||Wt.isSelectable(s))){let a=uO(t.doc,r.before(),r.after(),ft.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=t.tr.step(a);l.setSelection(f0(s,"start")?Nn.findFrom(l.doc.resolve(l.mapping.map(i.pos)),1):Wt.create(l.doc,l.mapping.map(i.pos))),e(l.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},mbe=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;s=v9(r)}let a=s&&s.nodeAfter;return!a||!Wt.isSelectable(a)?!1:(e&&e(t.tr.setSelection(Wt.create(t.doc,s.pos)).scrollIntoView()),!0)};function v9(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const h5t=(t,e)=>{let n=t.selection,r=n instanceof Wt,i;if(r){if(n.node.isTextblock||!lp(t.doc,n.from))return!1;i=n.from}else if(i=cO(t.doc,n.from,-1),i==null)return!1;if(e){let s=t.tr.join(i);r&&s.setSelection(Wt.create(s.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},p5t=(t,e)=>{let n=t.selection,r;if(n instanceof Wt){if(n.node.isTextblock||!lp(t.doc,n.to))return!1;r=n.to}else if(r=cO(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},m5t=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),s=i&&Z0(i);return s==null?!1:(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)},gbe=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
4982`).scrollIntoView()),!0)};function b9(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const g5t=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),s=n.indexAfter(-1),a=b9(i.contentMatchAt(s));if(!a||!i.canReplaceWith(s,s,a))return!1;if(e){let l=n.after(),c=t.tr.replaceWith(l,l,a.createAndFill());c.setSelection(Nn.near(c.doc.resolve(l),1)),e(c.scrollIntoView())}return!0},xbe=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof ko||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=b9(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let a=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,l=t.tr.insert(a,s.createAndFill());l.setSelection(rn.create(l.doc,a+1)),e(l.scrollIntoView())}return!0},ybe=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let s=n.before();if(pd(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),i=r&&Z0(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function x5t(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof Wt&&e.selection.node.isBlock)return!r.parentOffset||!pd(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],a,l,c=!1,u=!1;for(let p=r.depth;;p--)if(r.node(p).isBlock){c=r.end(p)==r.pos+(r.depth-p),u=r.start(p)==r.pos-(r.depth-p),l=b9(r.node(p-1).contentMatchAt(r.indexAfter(p-1))),s.unshift(c&&l?{type:l}:null),a=p;break}else{if(p==1)return!1;s.unshift(null)}let d=e.tr;(e.selection instanceof rn||e.selection instanceof ko)&&d.deleteSelection();let f=d.mapping.map(r.pos),h=pd(d.doc,f,s.length,s);if(h||(s[0]=l?{type:l}:null,h=pd(d.doc,f,s.length,s)),!h)return!1;if(d.split(f,s.length,s),!c&&u&&r.node(a).type!=l){let p=d.mapping.map(r.before(a)),m=d.doc.resolve(p);l&&r.node(a-1).canReplaceWith(m.index(),m.index()+1,l)&&d.setNodeMarkup(d.mapping.map(r.before(a)),l)}return n&&n(d.scrollIntoView()),!0}}const y5t=x5t(),v5t=(t,e)=>{let{$from:n,to:r}=t.selection,i,s=n.sharedDepth(r);return s==0?!1:(i=n.before(s),e&&e(t.tr.setSelection(Wt.create(t.doc,i))),!0)};function b5t(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||lp(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function vbe(t,e,n,r){let i=e.nodeBefore,s=e.nodeAfter,a,l,c=i.type.spec.isolating||s.type.spec.isolating;if(!c&&b5t(t,e,n))return!0;let u=!c&&e.parent.canReplace(e.index(),e.index()+1);if(u&&(a=(l=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&l.matchType(a[0]||s.type).validEnd){if(n){let p=e.pos+s.nodeSize,m=Ke.empty;for(let g=a.length-1;g>=0;g--)m=Ke.from(a[g].create(null,m));m=Ke.from(i.copy(m));let x=t.tr.step(new vs(e.pos-1,p,e.pos,p,new ft(m,1,0),a.length,!0)),y=x.doc.resolve(p+2*a.length);y.nodeAfter&&y.nodeAfter.type==i.type&&lp(x.doc,y.pos)&&x.join(y.pos),n(x.scrollIntoView())}return!0}let d=s.type.spec.isolating||r>0&&c?null:Nn.findFrom(e,1),f=d&&d.$from.blockRange(d.$to),h=f&&Z0(f);if(h!=null&&h>=e.depth)return n&&n(t.tr.lift(f,h).scrollIntoView()),!0;if(u&&f0(s,"start",!0)&&f0(i,"end")){let p=i,m=[];for(;m.push(p),!p.isTextblock;)p=p.lastChild;let x=s,y=1;for(;!x.isTextblock;x=x.firstChild)y++;if(p.canReplace(p.childCount,p.childCount,x.content)){if(n){let g=Ke.empty;for(let v=m.length-1;v>=0;v--)g=Ke.from(m[v].copy(g));let w=t.tr.step(new vs(e.pos-m.length,e.pos+s.nodeSize,e.pos+y,e.pos+s.nodeSize-y,new ft(g,m.length,0),0,!0));n(w.scrollIntoView())}return!0}}return!1}function bbe(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(n&&n(e.tr.setSelection(rn.create(e.doc,t<0?i.start(s):i.end(s)))),!0):!1}}const w5t=bbe(-1),_5t=bbe(1);function S5t(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,a=i.blockRange(s),l=a&&m9(a,t,e);return l?(r&&r(n.tr.wrap(a,l).scrollIntoView()),!0):!1}}function Ree(t,e=null){return function(n,r){let i=!1;for(let s=0;s<n.selection.ranges.length&&!i;s++){let{$from:{pos:a},$to:{pos:l}}=n.selection.ranges[s];n.doc.nodesBetween(a,l,(c,u)=>{if(i)return!1;if(!(!c.isTextblock||c.hasMarkup(t,e)))if(c.type==t)i=!0;else{let d=n.doc.resolve(u),f=d.index();i=d.parent.canReplaceWith(f,f+1,t)}})}if(!i)return!1;if(r){let s=n.tr;for(let a=0;a<n.selection.ranges.length;a++){let{$from:{pos:l},$to:{pos:c}}=n.selection.ranges[a];s.setBlockType(l,c,t,e)}r(s.scrollIntoView())}return!0}}function w9(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}w9(x9,ube,fbe);w9(x9,pbe,mbe);w9(gbe,xbe,ybe,y5t);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function N5t(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,a=i.blockRange(s);if(!a)return!1;let l=r?n.tr:null;return j5t(l,a,t,e)?(r&&r(l.scrollIntoView()),!0):!1}}function j5t(t,e,n,r=null){let i=!1,s=e,a=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let c=a.resolve(e.start-2);s=new lA(c,c,e.depth),e.endIndex<e.parent.childCount&&(e=new lA(e.$from,a.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let l=m9(s,n,r,e);return l?(t&&C5t(t,e,l,i,n),!0):!1}function C5t(t,e,n,r,i){let s=Ke.empty;for(let d=n.length-1;d>=0;d--)s=Ke.from(n[d].type.create(n[d].attrs,s));t.step(new vs(e.start-(r?2:0),e.end,e.start,e.end,new ft(s,0,0),n.length,!0));let a=0;for(let d=0;d<n.length;d++)n[d].type==i&&(a=d+1);let l=n.length-a,c=e.start+n.length-(r?2:0),u=e.parent;for(let d=e.startIndex,f=e.endIndex,h=!0;d<f;d++,h=!1)!h&&pd(t.doc,c,l)&&(t.split(c,l),c+=2*l),c+=u.child(d).nodeSize;return t}function k5t(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,a=>a.childCount>0&&a.firstChild.type==t);return s?n?r.node(s.depth-1).type==t?E5t(e,n,t,s):A5t(e,n,s):!0:!1}}function E5t(t,e,n,r){let i=t.tr,s=r.end,a=r.$to.end(r.depth);s<a&&(i.step(new vs(s-1,a,s,a,new ft(Ke.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new lA(i.doc.resolve(r.$from.pos),i.doc.resolve(a),r.depth));const l=Z0(r);if(l==null)return!1;i.lift(r,l);let c=i.doc.resolve(i.mapping.map(s,-1)-1);return lp(i.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&i.join(c.pos),e(i.scrollIntoView()),!0}function A5t(t,e,n){let r=t.tr,i=n.parent;for(let p=n.end,m=n.endIndex-1,x=n.startIndex;m>x;m--)p-=i.child(m).nodeSize,r.delete(p-1,p+1);let s=r.doc.resolve(n.start),a=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,c=n.endIndex==i.childCount,u=s.node(-1),d=s.index(-1);if(!u.canReplace(d+(l?0:1),d+1,a.content.append(c?Ke.empty:Ke.from(i))))return!1;let f=s.pos,h=f+a.nodeSize;return r.step(new vs(f-(l?1:0),h+(c?1:0),f+1,h-1,new ft((l?Ke.empty:Ke.from(i.copy(Ke.empty))).append(c?Ke.empty:Ke.from(i.copy(Ke.empty))),l?0:1,c?0:1),l?0:1)),e(r.scrollIntoView()),!0}function T5t(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,u=>u.childCount>0&&u.firstChild.type==t);if(!s)return!1;let a=s.startIndex;if(a==0)return!1;let l=s.parent,c=l.child(a-1);if(c.type!=t)return!1;if(n){let u=c.lastChild&&c.lastChild.type==l.type,d=Ke.from(u?t.create():null),f=new ft(Ke.from(t.create(null,Ke.from(l.type.create(null,d)))),u?3:1,0),h=s.start,p=s.end;n(e.tr.step(new vs(h-(u?3:1),p,h,p,f,1,!0)).scrollIntoView())}return!0}}const Os=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},h0=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let PF=null;const Vu=function(t,e,n){let r=PF||(PF=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},M5t=function(){PF=null},mg=function(t,e,n,r){return n&&(Iee(t,e,n,r,-1)||Iee(t,e,n,r,1))},P5t=/^(img|br|input|textarea|hr)$/i;function Iee(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:nl(t))){let a=t.parentNode;if(!a||a.nodeType!=1||vN(t)||P5t.test(t.nodeName)||t.contentEditable=="false")return!1;e=Os(t)+(i<0?0:1),t=a}else if(t.nodeType==1){let a=t.childNodes[e+(i<0?-1:0)];if(a.nodeType==1&&a.contentEditable=="false")if(!((s=a.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else t=a,e=i<0?nl(t):0}else return!1}}function nl(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function O5t(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=nl(t)}else if(t.parentNode&&!vN(t))e=Os(t),t=t.parentNode;else return null}}function R5t(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!vN(t))e=Os(t)+1,t=t.parentNode;else return null}}function I5t(t,e,n){for(let r=e==0,i=e==nl(t);r||i;){if(t==n)return!0;let s=Os(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==nl(t)}}function vN(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const fO=function(t){return t.focusNode&&mg(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Hp(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function D5t(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function L5t(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);
vendor: 16,567 bytes, lines 4982-4983
4982if(r)return{node:r.offsetNode,offset:Math.min(nl(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(nl(r.startContainer),r.startOffset)}}}const hu=typeof navigator<"u"?navigator:null,Dee=typeof document<"u"?document:null,cp=hu&&hu.userAgent||"",OF=/Edge\/(\d+)/.exec(cp),wbe=/MSIE \d/.exec(cp),RF=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(cp),Wa=!!(wbe||RF||OF),Sh=wbe?document.documentMode:RF?+RF[1]:OF?+OF[1]:0,hl=!Wa&&/gecko\/(\d+)/i.test(cp);hl&&+(/Firefox\/(\d+)/.exec(cp)||[0,0])[1];const IF=!Wa&&/Chrome\/(\d+)/.exec(cp),gs=!!IF,_be=IF?+IF[1]:0,Ls=!Wa&&!!hu&&/Apple Computer/.test(hu.vendor),p0=Ls&&(/Mobile\/\w+/.test(cp)||!!hu&&hu.maxTouchPoints>2),Yo=p0||(hu?/Mac/.test(hu.platform):!1),Sbe=hu?/Win/.test(hu.platform):!1,ad=/Android \d/.test(cp),bN=!!Dee&&"webkitFontSmoothing"in Dee.documentElement.style,$5t=bN?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function F5t(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Ou(t,e){return typeof t=="number"?t:t[e]}function U5t(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function Lee(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let a=n||t.dom;a;){if(a.nodeType!=1){a=h0(a);continue}let l=a,c=l==s.body,u=c?F5t(s):U5t(l),d=0,f=0;if(e.top<u.top+Ou(r,"top")?f=-(u.top-e.top+Ou(i,"top")):e.bottom>u.bottom-Ou(r,"bottom")&&(f=e.bottom-e.top>u.bottom-u.top?e.top+Ou(i,"top")-u.top:e.bottom-u.bottom+Ou(i,"bottom")),e.left<u.left+Ou(r,"left")?d=-(u.left-e.left+Ou(i,"left")):e.right>u.right-Ou(r,"right")&&(d=e.right-u.right+Ou(i,"right")),d||f)if(c)s.defaultView.scrollBy(d,f);else{let p=l.scrollLeft,m=l.scrollTop;f&&(l.scrollTop+=f),d&&(l.scrollLeft+=d);let x=l.scrollLeft-p,y=l.scrollTop-m;e={left:e.left-x,top:e.top-y,right:e.right-x,bottom:e.bottom-y}}let h=c?"fixed":getComputedStyle(a).position;if(/^(fixed|sticky)$/.test(h))break;a=h=="absolute"?a.offsetParent:h0(a)}}function z5t(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,a=n+1;a<Math.min(innerHeight,e.bottom);a+=5){let l=t.root.elementFromPoint(s,a);if(!l||l==t.dom||!t.dom.contains(l))continue;let c=l.getBoundingClientRect();if(c.top>=n-20){r=l,i=c.top;break}}return{refDOM:r,refTop:i,stack:Nbe(t.dom)}}function Nbe(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=h0(r));return e}function B5t({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;jbe(n,r==0?0:r-e)}function jbe(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:i,left:s}=t[n];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let Px=null;function V5t(t){if(t.setActive)return t.setActive();if(Px)return t.focus(Px);let e=Nbe(t);t.focus(Px==null?{get preventScroll(){return Px={preventScroll:!0},!0}}:void 0),Px||(Px=!1,jbe(e,0))}function Cbe(t,e){let n,r=2e8,i,s=0,a=e.top,l=e.top,c,u;for(let d=t.firstChild,f=0;d;d=d.nextSibling,f++){let h;if(d.nodeType==1)h=d.getClientRects();else if(d.nodeType==3)h=Vu(d).getClientRects();else continue;for(let p=0;p<h.length;p++){let m=h[p];if(m.top<=a&&m.bottom>=l){a=Math.max(m.bottom,a),l=Math.min(m.top,l);let x=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(x<r){n=d,r=x,i=x&&n.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,d.nodeType==1&&x&&(s=f+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!c&&m.left<=e.left&&m.right>=e.left&&(c=d,u={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!n&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(s=f+1)}}return!n&&c&&(n=c,i=u,r=0),n&&n.nodeType==3?H5t(n,i):!n||r&&n.nodeType==1?{node:t,offset:s}:Cbe(n,i)}function H5t(t,e){let n=t.nodeValue.length,r=document.createRange(),i;for(let s=0;s<n;s++){r.setEnd(t,s+1),r.setStart(t,s);let a=gf(r,1);if(a.top!=a.bottom&&_9(e,a)){i={node:t,offset:s+(e.left>=(a.left+a.right)/2?1:0)};break}}return r.detach(),i||{node:t,offset:0}}function _9(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function W5t(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function G5t(t,e,n){let{node:r,offset:i}=Cbe(e,n),s=-1;if(r.nodeType==1&&!r.firstChild){let a=r.getBoundingClientRect();s=a.left!=a.right&&n.left>(a.left+a.right)/2?1:-1}return t.docView.posFromDOM(r,i,s)}function q5t(t,e,n,r){let i=-1;for(let s=e,a=!1;s!=t.dom;){let l=t.docView.nearestDesc(s,!0),c;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((c=l.dom.getBoundingClientRect()).width||c.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!a&&c.left>r.left||c.top>r.top?i=l.posBefore:(!a&&c.right<r.left||c.bottom<r.top)&&(i=l.posAfter),a=!0),!l.contentDOM&&i<0&&!l.node.isText))return(l.node.isBlock?r.top<(c.top+c.bottom)/2:r.left<(c.left+c.right)/2)?l.posBefore:l.posAfter;s=l.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function kbe(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),s=i;;){let a=t.childNodes[s];if(a.nodeType==1){let l=a.getClientRects();for(let c=0;c<l.length;c++){let u=l[c];if(_9(e,u))return kbe(a,e,u)}}if((s=(s+1)%r)==i)break}return t}function K5t(t,e){let n=t.dom.ownerDocument,r,i=0,s=L5t(n,e.left,e.top);s&&({node:r,offset:i}=s);let a=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),l;if(!a||!t.dom.contains(a.nodeType!=1?a.parentNode:a)){let u=t.dom.getBoundingClientRect();if(!_9(e,u)||(a=kbe(t.dom,e,u),!a))return null}if(Ls)for(let u=a;r&&u;u=h0(u))u.draggable&&(r=void 0);if(a=W5t(a,e),r){if(hl&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let d=r.childNodes[i],f;d.nodeName=="IMG"&&(f=d.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&i++}let u;bN&&i&&r.nodeType==1&&(u=r.childNodes[i-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(l=q5t(t,r,i,e))}l==null&&(l=G5t(t,a,e));let c=t.docView.nearestDesc(a,!0);return{pos:l,inside:c?c.posAtStart-c.border:-1}}function $ee(t){return t.top<t.bottom||t.left<t.right}function gf(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if($ee(r))return r}return Array.prototype.find.call(n,$ee)||t.getBoundingClientRect()}const Y5t=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Ebe(t,e,n){let{node:r,offset:i,atom:s}=t.docView.domFromPos(e,n<0?-1:1),a=bN||hl;if(r.nodeType==3)if(a&&(Y5t.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let c=gf(Vu(r,i,i),n);if(hl&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let u=gf(Vu(r,i-1,i-1),-1);if(u.top==c.top){let d=gf(Vu(r,i,i+1),-1);if(d.top!=c.top)return nw(d,d.left<u.left)}}return c}else{let c=i,u=i,d=n<0?1:-1;return n<0&&!i?(u++,d=-1):n>=0&&i==r.nodeValue.length?(c--,d=1):n<0?c--:u++,nw(gf(Vu(r,c,u),d),d<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==nl(r))){let c=r.childNodes[i-1];if(c.nodeType==1)return G3(c.getBoundingClientRect(),!1)}if(s==null&&i<nl(r)){let c=r.childNodes[i];if(c.nodeType==1)return G3(c.getBoundingClientRect(),!0)}return G3(r.getBoundingClientRect(),n>=0)}if(s==null&&i&&(n<0||i==nl(r))){let c=r.childNodes[i-1],u=c.nodeType==3?Vu(c,nl(c)-(a?0:1)):c.nodeType==1&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(u)return nw(gf(u,1),!1)}if(s==null&&i<nl(r)){let c=r.childNodes[i];for(;c.pmViewDesc&&c.pmViewDesc.ignoreForCoords;)c=c.nextSibling;let u=c?c.nodeType==3?Vu(c,0,a?0:1):c.nodeType==1?c:null:null;if(u)return nw(gf(u,-1),!0)}return nw(gf(r.nodeType==3?Vu(r):r,-n),n>=0)}function nw(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function G3(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function Abe(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function X5t(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return Abe(t,e,()=>{let{node:s}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(s,!0);if(!l)break;if(l.node.isBlock){s=l.contentDOM||l.dom;break}s=l.dom.parentNode}let a=Ebe(t,i.pos,1);for(let l=s.firstChild;l;l=l.nextSibling){let c;if(l.nodeType==1)c=l.getClientRects();else if(l.nodeType==3)c=Vu(l,0,l.nodeValue.length).getClientRects();else continue;for(let u=0;u<c.length;u++){let d=c[u];if(d.bottom>d.top+1&&(n=="up"?a.top-d.top>(d.bottom-a.top)*2:d.bottom-a.bottom>(a.bottom-d.top)*2))return!1}}return!0})}const Q5t=/[\u0590-\u08ac]/;function J5t(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,a=i==r.parent.content.size,l=t.domSelection();return l?!Q5t.test(r.parent.textContent)||!l.modify?n=="left"||n=="backward"?s:a:Abe(t,e,()=>{let{focusNode:c,focusOffset:u,anchorNode:d,anchorOffset:f}=t.domSelectionRange(),h=l.caretBidiLevel;l.modify("move",n,"character");let p=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:m,focusOffset:x}=t.domSelectionRange(),y=m&&!p.contains(m.nodeType==1?m:m.parentNode)||c==m&&u==x;try{l.collapse(d,f),c&&(c!=d||u!=f)&&l.extend&&l.extend(c,u)}catch{}return h!=null&&(l.caretBidiLevel=h),y}):r.pos==r.start()||r.pos==r.end()}let Fee=null,Uee=null,zee=!1;function Z5t(t,e,n){return Fee==e&&Uee==n?zee:(Fee=e,Uee=n,zee=n=="up"||n=="down"?X5t(t,e,n):J5t(t,e,n))}const pl=0,Bee=1,am=2,pu=3;class wN{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=pl,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].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 n=0,r=this.posAtStart;;n++){let i=this.children[n];if(i==e)return r;r+=i.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,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,a;if(e==this.contentDOM)s=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((a=s.pmViewDesc)&&a.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(a)+a.size:this.posAtStart}else{let s,a;if(e==this.contentDOM)s=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((a=s.pmViewDesc)&&a.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(a):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=n>Os(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),a;if(s&&(!n||s.node))if(r&&(a=s.nodeDOM)&&!(a.nodeType==1?a.contains(e.nodeType==1?e:e.parentNode):a==e))r=!1;else return s}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],s=r+i.size;if(r==e&&s!=r){for(;!i.border&&i.children.length;)for(let a=0;a<i.children.length;a++){let l=i.children[a];if(l.size){i=l;break}}return i}if(e<s)return i.descAt(e-r-i.border);r=s}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let s=0;r<this.children.length;r++){let a=this.children[r],l=s+a.size;if(l>e||a instanceof Mbe){i=e-s;break}s=l}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof Tbe&&s.side>=0;r--);if(n<=0){let s,a=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,a=!1);return s&&n&&a&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?Os(s.dom)+1:0}}else{let s,a=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,a=!1);return s&&a&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?Os(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let a=r,l=0;;l++){let c=this.children[l],u=a+c.size;if(i==-1&&e<=u){let d=a+c.border;if(e>=d&&n<=u-c.border&&c.node&&c.contentDOM&&this.contentDOM.contains(c.contentDOM))return c.parseRange(e,n,d);e=a;for(let f=l;f>0;f--){let h=this.children[f-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){i=Os(h.dom)+1;break}e-=h.size}i==-1&&(i=0)}if(i>-1&&(u>n||l==this.children.length-1)){n=u;for(let d=l+1;d<this.children.length;d++){let f=this.children[d];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){s=Os(f.dom);break}n+=f.size}s==-1&&(s=this.contentDOM.childNodes.length);break}a=u}return{node:this.contentDOM,from:e,to:n,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,i=!1){let s=Math.min(e,n),a=Math.max(e,n);for(let p=0,m=0;p<this.children.length;p++){let x=this.children[p],y=m+x.size;if(s>m&&a<y)return x.setSelection(e-m-x.border,n-m-x.border,r,i);m=y}let l=this.domFromPos(e,e?-1:1),c=n==e?l:this.domFromPos(n,n?-1:1),u=r.root.getSelection(),d=r.domSelectionRange(),f=!1;if((hl||Ls)&&e==n){let{node:p,offset:m}=l;if(p.nodeType==3){if(f=!!(m&&p.nodeValue[m-1]==`
4983`),f&&m==p.nodeValue.length)for(let x=p,y;x;x=x.parentNode){if(y=x.nextSibling){y.nodeName=="BR"&&(l=c={node:y.parentNode,offset:Os(y)+1});break}let g=x.pmViewDesc;if(g&&g.node&&g.node.isBlock)break}}else{let x=p.childNodes[m-1];f=x&&(x.nodeName=="BR"||x.contentEditable=="false")}}if(hl&&d.focusNode&&d.focusNode!=c.node&&d.focusNode.nodeType==1){let p=d.focusNode.childNodes[d.focusOffset];p&&p.contentEditable=="false"&&(i=!0)}if(!(i||f&&Ls)&&mg(l.node,l.offset,d.anchorNode,d.anchorOffset)&&mg(c.node,c.offset,d.focusNode,d.focusOffset))return;let h=!1;if((u.extend||e==n)&&!(f&&hl)){u.collapse(l.node,l.offset);try{e!=n&&u.extend(c.node,c.offset),h=!0}catch{}}if(!h){if(e>n){let m=l;l=c,c=m}let p=document.createRange();p.setEnd(c.node,c.offset),p.setStart(l.node,l.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,n){for(let r=0,i=0;i<this.children.length;i++){let s=this.children[i],a=r+s.size;if(r==a?e<=a&&n>=r:e<a&&n>r){let l=r+s.border,c=a-s.border;if(e>=l&&n<=c){this.dirty=e==r||n==a?am:Bee,e==l&&n==c&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=pu:s.markDirty(e-l,n-l);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?am:pu}r=a}this.dirty=am}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?am:Bee;n.dirty<r&&(n.dirty=r)}
vendor: 3,742 bytes, line 4983
4983}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Tbe extends wN{constructor(e,n,r,i){let s,a=n.type.toDOM;if(typeof a=="function"&&(a=a(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!n.type.spec.raw){if(a.nodeType!=1){let l=document.createElement("span");l.appendChild(a),a=l}a.contentEditable="false",a.classList.add("ProseMirror-widget")}super(e,[],a,null),this.widget=n,this.widget=n,s=this}matchesWidget(e){return this.dirty==pl&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(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 eFt extends wN{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class gg extends wN{constructor(e,n,r,i,s){super(e,[],r,i),this.mark=n,this.spec=s}static create(e,n,r,i){let s=i.nodeViews[n.type.name],a=s&&s(n,i,r);return(!a||!a.dom)&&(a=Vg.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new gg(e,n,a.dom,a.contentDOM||a.dom,a)}parseRule(){return this.dirty&pu||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=pu&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=pl){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=pl}}slice(e,n,r){let i=gg.create(this.parent,this.mark,!0,r),s=this.children,a=this.size;n<a&&(s=LF(s,n,a,r)),e>0&&(s=LF(s,0,e,r));for(let l=0;l<s.length;l++)s[l].parent=i;return i.children=s,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Nh extends wN{constructor(e,n,r,i,s,a,l,c,u){super(e,[],s,a),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=l}static create(e,n,r,i,s,a){let l=s.nodeViews[n.type.name],c,u=l&&l(n,s,()=>{if(!c)return a;if(c.parent)return c.parent.posBeforeChild(c)},r,i),d=u&&u.dom,f=u&&u.contentDOM;if(n.isText){if(!d)d=document.createTextNode(n.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:f}=Vg.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!f&&!n.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),n.type.spec.draggable&&(d.draggable=!0));let h=d;return d=Rbe(d,r,n),u?c=new tFt(e,n,r,i,d,f||null,h,u,s,a+1):n.isText?new hO(e,n,r,i,d,h,s):new Nh(e,n,r,i,d,f||null,h,s,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 n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>Ke.empty)}return e}matchesNode(e,n,r){return this.dirty==pl&&e.eq(this.node)&&uA(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}
vendor: 11,423 bytes, line 4983
4983updateChildren(e,n){let r=this.node.inlineContent,i=n,s=e.composing?this.localCompositionInfo(e,n):null,a=s&&s.pos>-1?s:null,l=s&&s.pos<0,c=new rFt(this,a&&a.node,e);aFt(this.node,this.innerDeco,(u,d,f)=>{u.spec.marks?c.syncToMarks(u.spec.marks,r,e,d):u.type.side>=0&&!f&&c.syncToMarks(d==this.node.childCount?br.none:this.node.child(d).marks,r,e,d),c.placeWidget(u,e,i)},(u,d,f,h)=>{c.syncToMarks(u.marks,r,e,h);let p;c.findNodeMatch(u,d,f,h)||l&&e.state.selection.from>i&&e.state.selection.to<i+u.nodeSize&&(p=c.findIndexWithChild(s.node))>-1&&c.updateNodeAt(u,d,f,p,e)||c.updateNextNode(u,d,f,e,h,i)||c.addNode(u,d,f,e,i),i+=u.nodeSize}),c.syncToMarks([],r,e,0),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||this.dirty==am)&&(a&&this.protectLocalComposition(e,a),Pbe(this.contentDOM,this.children,e),p0&&oFt(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof rn)||r<n||i>n+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let a=s.nodeValue,l=lFt(this.node.content,a,r-n,i-n);return l<0?null:{node:s,pos:l,text:a}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let s=n;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let a=new eFt(this,s,n,i);e.input.compositionNodes.push(a),this.children=LF(this.children,r,r+i.length,e,a)}update(e,n,r,i){return this.dirty==pu||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=pl}updateOuterDeco(e){if(uA(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Obe(this.dom,this.nodeDOM,DF(this.outerDeco,this.node,n),DF(e,this.node,n)),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 Vee(t,e,n,r,i){Rbe(r,e,t);let s=new Nh(void 0,t,e,n,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class hO extends Nh{constructor(e,n,r,i,s,a,l){super(e,n,r,i,s,null,a,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,i){return this.dirty==pu||this.dirty!=pl&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=pl||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=pl,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let i=this.node.cut(e,n),s=document.createTextNode(i.text);return new hO(this.parent,i,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=pu)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Mbe extends wN{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==pl&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class tFt extends Nh{constructor(e,n,r,i,s,a,l,c,u,d){super(e,n,r,i,s,a,l,u,d),this.spec=c}update(e,n,r,i){if(this.dirty==pu)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,n,r);return s&&this.updateInner(e,n,r,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,i)}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 Pbe(t,e,n){let r=t.firstChild,i=!1;for(let s=0;s<e.length;s++){let a=e[s],l=a.dom;if(l.parentNode==t){for(;l!=r;)r=Hee(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(l,r);if(a instanceof gg){let c=r?r.previousSibling:t.lastChild;Pbe(a.contentDOM,a.children,n),r=c?c.nextSibling:t.firstChild}}for(;r;)r=Hee(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const l1=function(t){t&&(this.nodeName=t)};l1.prototype=Object.create(null);const om=[new l1];function DF(t,e,n){if(t.length==0)return om;let r=n?om[0]:new l1,i=[r];for(let s=0;s<t.length;s++){let a=t[s].type.attrs;if(a){a.nodeName&&i.push(r=new l1(a.nodeName));for(let l in a){let c=a[l];c!=null&&(n&&i.length==1&&i.push(r=new l1(e.isInline?"span":"div")),l=="class"?r.class=(r.class?r.class+" ":"")+c:l=="style"?r.style=(r.style?r.style+";":"")+c:l!="nodeName"&&(r[l]=c))}}}return i}function Obe(t,e,n,r){if(n==om&&r==om)return e;let i=e;for(let s=0;s<r.length;s++){let a=r[s],l=n[s];if(s){let c;l&&l.nodeName==a.nodeName&&i!=t&&(c=i.parentNode)&&c.nodeName.toLowerCase()==a.nodeName||(c=document.createElement(a.nodeName),c.pmIsDeco=!0,c.appendChild(i),l=om[0]),i=c}nFt(i,l||om[0],a)}return i}function nFt(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)i.indexOf(r[s])==-1&&t.classList.remove(r[s]);for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&t.classList.add(i[s]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)t.style.removeProperty(i[1])}n.style&&(t.style.cssText+=n.style)}}function Rbe(t,e,n){return Obe(t,t,om,DF(e,n,t.nodeType!=1))}function uA(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function Hee(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class rFt{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=iFt(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r,i){let s=0,a=this.stack.length>>1,l=Math.min(a,e.length);for(;s<l&&(s==a-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<a;)this.destroyRest(),this.top.dirty=pl,this.index=this.stack.pop(),this.top=this.stack.pop(),a--;for(;a<e.length;){this.stack.push(this.top,this.index+1);let c=-1,u=this.top.children.length;i<this.preMatch.index&&(u=Math.min(this.index+3,u));for(let d=this.index;d<u;d++){let f=this.top.children[d];if(f.matchesMark(e[a])&&!this.isLocked(f.dom)){c=d;break}}if(c>-1)c>this.index&&(this.changed=!0,this.destroyBetween(this.index,c)),this.top=this.top.children[this.index];else{let d=gg.create(this.top,e[a],n,r);this.top.children.splice(this.index,0,d),this.top=d,this.changed=!0}this.index=0,a++}}findNodeMatch(e,n,r,i){let s=-1,a;if(i>=this.preMatch.index&&(a=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&a.matchesNode(e,n,r))s=this.top.children.indexOf(a,this.index);else for(let l=this.index,c=Math.min(this.top.children.length,l+5);l<c;l++){let u=this.top.children[l];if(u.matchesNode(e,n,r)&&!this.preMatch.matched.has(u)){s=l;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,n,r,i,s){let a=this.top.children[i];return a.dirty==pu&&a.dom==a.contentDOM&&(a.dirty=am),a.update(e,n,r,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=n}}updateNextNode(e,n,r,i,s,a){for(let l=this.index;l<this.top.children.length;l++){let c=this.top.children[l];if(c instanceof Nh){let u=this.preMatch.matched.get(c);if(u!=null&&u!=s)return!1;let d=c.dom,f,h=this.isLocked(d)&&!(e.isText&&c.node&&c.node.isText&&c.nodeDOM.nodeValue==e.text&&c.dirty!=pu&&uA(n,c.outerDeco));if(!h&&c.update(e,n,r,i))return this.destroyBetween(this.index,l),c.dom!=d&&(this.changed=!0),this.index++,!0;if(!h&&(f=this.recreateWrapper(c,e,n,r,i,a)))return this.destroyBetween(this.index,l),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=am,f.updateChildren(i,a+1),f.dirty=pl),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,i,s,a){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!uA(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let l=Nh.create(this.top,n,r,i,s,a);if(l.contentDOM){l.children=e.children,e.children=[];for(let c of l.children)c.parent=l}return e.destroy(),l}addNode(e,n,r,i,s){let a=Nh.create(this.top,e,n,r,i,s);a.contentDOM&&a.updateChildren(i,s+1),this.top.children.splice(this.index++,0,a),this.changed=!0}placeWidget(e,n,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new Tbe(this.top,e,n,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof gg;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof hO)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Ls||gs)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.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 i=new Mbe(this.top,[],r,null);n!=this.top?n.children.push(i):n.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function iFt(t,e){let n=e,r=n.children.length,i=t.childCount,s=new Map,a=[];e:for(;i>0;){let l;for(;;)if(r){let u=n.children[r-1];if(u instanceof gg)n=u,r=u.children.length;else{l=u,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let c=l.node;if(c){if(c!=t.child(i-1))break;
vendor: 4,340 bytes, line 4983
4983--i,s.set(l,i),a.push(l)}}return{index:i,matched:s,matches:a.reverse()}}function sFt(t,e){return t.type.side-e.type.side}function aFt(t,e,n,r){let i=e.locals(t),s=0;if(i.length==0){for(let u=0;u<t.childCount;u++){let d=t.child(u);r(d,i,e.forChild(s,d),u),s+=d.nodeSize}return}let a=0,l=[],c=null;for(let u=0;;){let d,f;for(;a<i.length&&i[a].to==s;){let y=i[a++];y.widget&&(d?(f||(f=[d])).push(y):d=y)}if(d)if(f){f.sort(sFt);for(let y=0;y<f.length;y++)n(f[y],u,!!c)}else n(d,u,!!c);let h,p;if(c)p=-1,h=c,c=null;else if(u<t.childCount)p=u,h=t.child(u++);else break;for(let y=0;y<l.length;y++)l[y].to<=s&&l.splice(y--,1);for(;a<i.length&&i[a].from<=s&&i[a].to>s;)l.push(i[a++]);let m=s+h.nodeSize;if(h.isText){let y=m;a<i.length&&i[a].from<y&&(y=i[a].from);for(let g=0;g<l.length;g++)l[g].to<y&&(y=l[g].to);y<m&&(c=h.cut(y-s),h=h.cut(0,y-s),m=y,p=-1)}else for(;a<i.length&&i[a].to<m;)a++;let x=h.isInline&&!h.isLeaf?l.filter(y=>!y.inline):l.slice();r(h,x,e.forChild(s,h),p),s=m}}function oFt(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function lFt(t,e,n,r){for(let i=0,s=0;i<t.childCount&&s<=r;){let a=t.child(i++),l=s;if(s+=a.nodeSize,!a.isText)continue;let c=a.text;for(;i<t.childCount;){let u=t.child(i++);if(s+=u.nodeSize,!u.isText)break;c+=u.text}if(s>=n){if(s>=r&&c.slice(r-e.length-l,r-l)==e)return r-e.length;let u=l<r?c.lastIndexOf(e,r-l-1):-1;if(u>=0&&u+e.length+l>=n)return l+u;if(n==r&&c.length>=r+e.length-l&&c.slice(r-l,r-l+e.length)==e)return r}}return-1}function LF(t,e,n,r,i){let s=[];for(let a=0,l=0;a<t.length;a++){let c=t[a],u=l,d=l+=c.size;u>=n||d<=e?s.push(c):(u<e&&s.push(c.slice(0,e-u,r)),i&&(s.push(i),i=void 0),d>n&&s.push(c.slice(n-u,c.size,r)))}return s}function S9(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),s=i&&i.size==0,a=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(a<0)return null;let l=r.resolve(a),c,u;if(fO(n)){for(c=a;i&&!i.node;)i=i.parent;let f=i.node;if(i&&f.isAtom&&Wt.isSelectable(f)&&i.parent&&!(f.isInline&&I5t(n.focusNode,n.focusOffset,i.dom))){let h=i.posBefore;u=new Wt(a==h?l:r.resolve(h))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let f=a,h=a;for(let p=0;p<n.rangeCount;p++){let m=n.getRangeAt(p);f=Math.min(f,t.docView.posFromDOM(m.startContainer,m.startOffset,1)),h=Math.max(h,t.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(f<0)return null;[c,a]=h==t.state.selection.anchor?[h,f]:[f,h],l=r.resolve(a)}else c=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let d=r.resolve(c);if(!u){let f=e=="pointer"||t.state.selection.head<l.pos&&!s?1:-1;u=N9(t,d,l,f)}return u}function Ibe(t){return t.editable?t.hasFocus():Lbe(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function md(t,e=!1){let n=t.state.selection;if(Dbe(t,n),!!Ibe(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&gs){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&mg(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)uFt(t);else{let{anchor:r,head:i}=n,s,a;Wee&&!(n instanceof rn)&&(n.$from.parent.inlineContent||(s=Gee(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(a=Gee(t,n.to))),t.docView.setSelection(r,i,t,e),Wee&&(s&&qee(s),a&&qee(a)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&cFt(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const Wee=Ls||gs&&_be<63;function Gee(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(Ls&&i&&i.contentEditable=="false")return q3(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return q3(i);if(s)return q3(s)}}function q3(t){return t.contentEditable="true",Ls&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function qee(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function cFt(t){let e=t.dom.ownerDocument;
vendor: 8,226 bytes, lines 4983-4986
4983e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Ibe(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function uFt(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Os(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&Wa&&Sh<=11&&(n.disabled=!0,n.disabled=!1)}function Dbe(t,e){if(e instanceof Wt){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Kee(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Kee(t)}function Kee(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function N9(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||rn.between(e,n,r)}function Yee(t){return t.editable&&!t.hasFocus()?!1:Lbe(t)}function Lbe(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function dFt(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return mg(e.node,e.offset,n.anchorNode,n.anchorOffset)}function $F(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&Nn.findFrom(s,e)}function _f(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Xee(t,e,n){let r=t.state.selection;if(r instanceof rn)if(n.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let a=t.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return _f(t,new rn(r.$anchor,a))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=$F(t.state,e);return i&&i instanceof Wt?_f(t,i):!1}else if(!(Yo&&n.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,a;if(!s||s.isText)return!1;let l=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(a=t.docView.descAt(l))&&!a.contentDOM?Wt.isSelectable(s)?_f(t,new Wt(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):bN?_f(t,new rn(t.state.doc.resolve(e<0?l:l+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Wt&&r.node.isInline)return _f(t,new rn(e>0?r.$to:r.$from));{let i=$F(t.state,e);return i?_f(t,i):!1}}}function dA(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function c1(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Ox(t,e){return e<0?fFt(t):hFt(t)}function fFt(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,a=!1;for(hl&&n.nodeType==1&&r<dA(n)&&c1(n.childNodes[r],-1)&&(a=!0);;)if(r>0){if(n.nodeType!=1)break;{let l=n.childNodes[r-1];if(c1(l,-1))i=n,s=--r;else if(l.nodeType==3)n=l,r=n.nodeValue.length;else break}}else{if($be(n))break;{let l=n.previousSibling;for(;l&&c1(l,-1);)i=n.parentNode,s=Os(l),l=l.previousSibling;if(l)n=l,r=dA(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}a?FF(t,n,r):i&&FF(t,i,s)}function hFt(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=dA(n),s,a;for(;;)if(r<i){if(n.nodeType!=1)break;let l=n.childNodes[r];if(c1(l,1))s=n,a=++r;else break}else{if($be(n))break;{let l=n.nextSibling;for(;l&&c1(l,1);)s=l.parentNode,a=Os(l)+1,l=l.nextSibling;if(l)n=l,r=0,i=dA(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&FF(t,s,a)}function $be(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function pFt(t,e){for(;t&&e==t.childNodes.length&&!vN(t);)e=Os(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function mFt(t,e){for(;t&&!e&&!vN(t);)e=Os(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function FF(t,e,n){if(e.nodeType!=3){let s,a;(a=pFt(e,n))?(e=a,n=0):(s=mFt(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(fO(r)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&md(t)},50)}function Qee(t,e){let n=t.state.doc.resolve(e);if(!(gs||Sbe)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),a=(s.top+s.bottom)/2;if(a>i.top&&a<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),a=(s.top+s.bottom)/2;if(a>i.top&&a<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Jee(t,e,n){let r=t.state.selection;if(r instanceof rn&&!r.empty||n.indexOf("s")>-1||Yo&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let a=$F(t.state,e);if(a&&a instanceof Wt)return _f(t,a)}if(!i.parent.inlineContent){let a=e<0?i:s,l=r instanceof ko?Nn.near(a,e):Nn.findFrom(a,e);return l?_f(t,l):!1}return!1}function Zee(t,e){if(!(t.state.selection instanceof rn))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let a=t.state.tr;return e<0?a.delete(n.pos-s.nodeSize,n.pos):a.delete(n.pos,n.pos+s.nodeSize),t.dispatch(a),!0}return!1}function ete(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function gFt(t){if(!Ls||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;ete(t,r,"true"),setTimeout(()=>ete(t,r,"false"),20)}return!1}function xFt(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function yFt(t,e){let n=e.keyCode,r=xFt(e);if(n==8||Yo&&n==72&&r=="c")return Zee(t,-1)||Ox(t,-1);if(n==46&&!e.shiftKey||Yo&&n==68&&r=="c")return Zee(t,1)||Ox(t,1);if(n==13||n==27)return!0;if(n==37||Yo&&n==66&&r=="c"){let i=n==37?Qee(t,t.state.selection.from)=="ltr"?-1:1:-1;return Xee(t,i,r)||Ox(t,i)}else if(n==39||Yo&&n==70&&r=="c"){let i=n==39?Qee(t,t.state.selection.from)=="ltr"?1:-1:1;return Xee(t,i,r)||Ox(t,i)}else{if(n==38||Yo&&n==80&&r=="c")return Jee(t,-1,r)||Ox(t,-1);if(n==40||Yo&&n==78&&r=="c")return gFt(t)||Jee(t,1,r)||Ox(t,1);if(r==(Yo?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function j9(t,e){t.someProp("transformCopied",p=>{e=p(e,t)});let n=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let p=r.firstChild;n.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let a=t.someProp("clipboardSerializer")||Vg.fromSchema(t.state.schema),l=Hbe(),c=l.createElement("div");c.appendChild(a.serializeFragment(r,{document:l}));let u=c.firstChild,d,f=0;for(;u&&u.nodeType==1&&(d=Vbe[u.nodeName.toLowerCase()]);){for(let p=d.length-1;p>=0;p--){let m=l.createElement(d[p]);for(;c.firstChild;)m.appendChild(c.firstChild);c.appendChild(m),f++}u=c.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",`${i} ${s}${f?` -${f}`:""} ${JSON.stringify(n)}`);let h=t.someProp("clipboardTextSerializer",p=>p(e,t))||e.content.textBetween(0,e.content.size,`
4984
4985`);return{dom:c,text:h,slice:e}}function Fbe(t,e,n,r,i){let s=i.parent.type.spec.code,a,l;if(!n&&!e)return null;let c=!!e&&(r||s||!n);if(c){if(t.someProp("transformPastedText",h=>{e=h(e,s||r,t)}),s)return l=new ft(Ke.from(t.state.schema.text(e.replace(/\r\n?/g,`
4986`))),0,0),t.someProp("transformPasted",h=>{l=h(l,t,!0)}),l;let f=t.someProp("clipboardTextParser",h=>h(e,i,r,t));if(f)l=f;else{let h=i.marks(),{schema:p}=t.state,m=Vg.fromSchema(p);
vendor: 16,010 bytes, line 4986
4986a=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(x=>{let y=a.appendChild(document.createElement("p"));x&&y.appendChild(m.serializeNode(p.text(x,h)))})}}else t.someProp("transformPastedHTML",f=>{n=f(n,t)}),a=_Ft(n),bN&&SFt(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 f=+d[3];f>0;f--){let h=a.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;a=h}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||_h.fromSchema(t.state.schema)).parseSlice(a,{preserveWhitespace:!!(c||d),context:i,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!vFt.test(h.parentNode.nodeName)?{ignore:!0}:null}})),d)l=NFt(tte(l,+d[1],+d[2]),d[4]);else if(l=ft.maxOpen(bFt(l.content,i),!0),l.openStart||l.openEnd){let f=0,h=0;for(let p=l.content.firstChild;f<l.openStart&&!p.type.spec.isolating;f++,p=p.firstChild);for(let p=l.content.lastChild;h<l.openEnd&&!p.type.spec.isolating;h++,p=p.lastChild);l=tte(l,f,h)}return t.someProp("transformPasted",f=>{l=f(l,t,c)}),l}const vFt=/^(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 bFt(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),s,a=[];if(t.forEach(l=>{if(!a)return;let c=i.findWrapping(l.type),u;if(!c)return a=null;if(u=a.length&&s.length&&zbe(c,s,l,a[a.length-1],0))a[a.length-1]=u;else{a.length&&(a[a.length-1]=Bbe(a[a.length-1],s.length));let d=Ube(l,c);a.push(d),i=i.matchType(d.type),s=c}}),a)return Ke.from(a)}return t}function Ube(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,Ke.from(t));return t}function zbe(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=zbe(t,e,n,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(Ke.from(Ube(n,t,i+1))))}}function Bbe(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Bbe(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(Ke.empty,!0);return t.copy(n.append(r))}function UF(t,e,n,r,i,s){let a=e<0?t.firstChild:t.lastChild,l=a.content;return t.childCount>1&&(s=0),i<r-1&&(l=UF(l,e,n,r,i+1,s)),i>=n&&(l=e<0?a.contentMatchAt(0).fillBefore(l,s<=i).append(l):l.append(a.contentMatchAt(a.childCount).fillBefore(Ke.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,a.copy(l))}function tte(t,e,n){return e<t.openStart&&(t=new ft(UF(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new ft(UF(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Vbe={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 nte=null;function Hbe(){return nte||(nte=document.implementation.createHTMLDocument("title"))}let K3=null;function wFt(t){let e=window.trustedTypes;return e?(K3||(K3=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),K3.createHTML(t)):t}function _Ft(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Hbe().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&Vbe[r[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=wFt(t),i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function SFt(t){let e=t.querySelectorAll(gs?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function NFt(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:s,openEnd:a}=t;for(let l=r.length-2;l>=0;l-=2){let c=n.nodes[r[l]];if(!c||c.hasRequiredAttrs())break;i=Ke.from(c.create(r[l+1],i)),s++,a++}return new ft(i,s,a)}const va={},ba={},jFt={touchstart:!0,touchmove:!0};class CFt{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.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function kFt(t){for(let e in va){let n=va[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{AFt(t,r)&&!C9(t,r)&&(t.editable||!(r.type in ba))&&n(t,r)},jFt[e]?{passive:!0}:void 0)}Ls&&t.dom.addEventListener("input",()=>null),zF(t)}function th(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function EFt(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function zF(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>C9(t,r))})}function C9(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function AFt(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function TFt(t,e){!C9(t,e)&&va[e.type]&&(t.editable||!(e.type in ba))&&va[e.type](t,e)}ba.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!Gbe(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(ad&&gs&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),p0&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,Hp(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||yFt(t,n)?n.preventDefault():th(t,"key")};ba.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};ba.keypress=(t,e)=>{let n=e;if(Gbe(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Yo&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof rn)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),s=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",a=>a(t,r.$from.pos,r.$to.pos,i,s))&&t.dispatch(s()),n.preventDefault()}};function pO(t){return{left:t.clientX,top:t.clientY}}function MFt(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function k9(t,e,n,r,i){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let a=s.depth+1;a>0;a--)if(t.someProp(e,l=>a>s.depth?l(t,n,s.nodeAfter,s.before(a),i,!0):l(t,n,s.node(a),s.before(a),i,!1)))return!0;return!1}function zy(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function PFt(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Wt.isSelectable(r)?(zy(t,new Wt(n)),!0):!1}function OFt(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof Wt&&(r=n.node);let s=t.state.doc.resolve(e);for(let a=s.depth+1;a>0;a--){let l=a>s.depth?s.nodeAfter:s.node(a);if(Wt.isSelectable(l)){r&&n.$from.depth>0&&a>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(a);break}}return i!=null?(zy(t,Wt.create(t.state.doc,i)),!0):!1}function RFt(t,e,n,r,i){return k9(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?OFt(t,n):PFt(t,n))}function IFt(t,e,n,r){return k9(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function DFt(t,e,n,r){return k9(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||LFt(t,n,r)}function LFt(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(zy(t,rn.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let a=s>i.depth?i.nodeAfter:i.node(s),l=i.before(s);if(a.inlineContent)zy(t,rn.create(r,l+1,l+1+a.content.size));else if(Wt.isSelectable(a))zy(t,Wt.create(r,l));else continue;return!0}}function E9(t){return fA(t)}const Wbe=Yo?"metaKey":"ctrlKey";va.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=E9(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&MFt(n,t.input.lastClick)&&!n[Wbe]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s,button:n.button};let a=t.posAtCoords(pO(n));a&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new $Ft(t,a,n,!!r)):(s=="doubleClick"?IFt:DFt)(t,a.pos,a.inside,n)?n.preventDefault():th(t,"pointer"))};class $Ft{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Wbe],this.allowDefault=r.shiftKey;let s,a;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),a=n.inside;else{let d=e.state.doc.resolve(n.pos);s=d.parent,a=d.depth?d.before():0}const l=i?null:r.target,c=l?e.docView.nearestDesc(l,!0):null;this.target=c&&c.nodeDOM.nodeType==1?c.nodeDOM:null;let{selection:u}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||u instanceof Wt&&u.from<=a&&u.to>a)&&(this.mightDrag={node:s,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&hl&&!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)),th(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(()=>md(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(pO(e))),this.updateAllowDefault(e),this.allowDefault||!n?th(this.view,"pointer"):RFt(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Ls&&this.mightDrag&&!this.mightDrag.node.isAtom||gs&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(zy(this.view,Nn.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):th(this.view,"pointer")}move(e){this.updateAllowDefault(e),th(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)}}va.touchstart=t=>{t.input.lastTouch=Date.now(),E9(t),th(t,"pointer")};va.touchmove=t=>{t.input.lastTouch=Date.now(),th(t,"pointer")};va.contextmenu=t=>E9(t);function Gbe(t,e){return t.composing?!0:Ls&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const FFt=ad?5e3:-1;ba.compositionstart=ba.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof rn&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||gs&&Sbe&&UFt(t)))t.markCursor=t.state.storedMarks||n.marks(),fA(t,!0),t.markCursor=null;else if(fA(t,!e.selection.empty),hl&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let a=s<0?i.lastChild:i.childNodes[s-1];if(!a)break;if(a.nodeType==3){let l=t.domSelection();l&&l.collapse(a,a.nodeValue.length);break}else i=a,s=-1}}t.input.composing=!0}qbe(t,FFt)};function UFt(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}ba.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,qbe(t,20))};function qbe(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>fA(t),e))}function Kbe(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=BFt());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function zFt(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=O5t(e.focusNode,e.focusOffset),r=R5t(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,s=t.domObserver.lastChangedTextNode;if(n==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let a=n.pmViewDesc;if(!(!a||!a.isText(n.nodeValue)))return r}}return n||r}function BFt(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function fA(t,e=!1){if(!(ad&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Kbe(t),e||t.docView&&t.docView.dirty){let n=S9(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function VFt(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const iS=Wa&&Sh<15||p0&&$5t<604;va.copy=ba.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=iS?null:n.clipboardData,a=r.content(),{dom:l,text:c}=j9(t,a);s?(n.preventDefault(),s.clearData(),s.setData("text/html",l.innerHTML),s.setData("text/plain",c)):VFt(t,l),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function HFt(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function WFt(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?sS(t,r.value,null,i,e):sS(t,r.textContent,r.innerHTML,i,e)},50)}function sS(t,e,n,r,i){let s=Fbe(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",c=>c(t,i,s||ft.empty)))return!0;
vendor: 9,481 bytes, line 4986
4986if(!s)return!1;let a=HFt(s),l=a?t.state.tr.replaceSelectionWith(a,r):t.state.tr.replaceSelection(s);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Ybe(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}ba.paste=(t,e)=>{let n=e;if(t.composing&&!ad)return;let r=iS?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&sS(t,Ybe(r),r.getData("text/html"),i,n)?n.preventDefault():WFt(t,n)};class Xbe{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const GFt=Yo?"altKey":"ctrlKey";function Qbe(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[GFt]}va.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,s=i.empty?null:t.posAtCoords(pO(n)),a;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof Wt?i.to-1:i.to))){if(r&&r.mightDrag)a=Wt.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let f=t.docView.nearestDesc(n.target,!0);f&&f.node.type.spec.draggable&&f!=t.docView&&(a=Wt.create(t.state.doc,f.posBefore))}}let l=(a||t.state.selection).content(),{dom:c,text:u,slice:d}=j9(t,l);(!n.dataTransfer.files.length||!gs||_be>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(iS?"Text":"text/html",c.innerHTML),n.dataTransfer.effectAllowed="copyMove",iS||n.dataTransfer.setData("text/plain",u),t.dragging=new Xbe(d,Qbe(t,n),a)};va.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};ba.dragover=ba.dragenter=(t,e)=>e.preventDefault();ba.drop=(t,e)=>{try{qFt(t,e,t.dragging)}finally{t.dragging=null}};function qFt(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(pO(e));if(!r)return;let i=t.state.doc.resolve(r.pos),s=n&&n.slice;s?t.someProp("transformPasted",p=>{s=p(s,t,!1)}):s=Fbe(t,Ybe(e.dataTransfer),iS?null:e.dataTransfer.getData("text/html"),!1,i);let a=!!(n&&Qbe(t,e));if(t.someProp("handleDrop",p=>p(t,e,s||ft.empty,a))){e.preventDefault();return}if(!s)return;e.preventDefault();let l=s?tbe(t.state.doc,i.pos,s):i.pos;l==null&&(l=i.pos);let c=t.state.tr;if(a){let{node:p}=n;p?p.replace(c):c.deleteSelection()}let u=c.mapping.map(l),d=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,f=c.doc;if(d?c.replaceRangeWith(u,u,s.content.firstChild):c.replaceRange(u,u,s),c.doc.eq(f))return;let h=c.doc.resolve(u);if(d&&Wt.isSelectable(s.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new Wt(h));else{let p=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((m,x,y,g)=>p=g),c.setSelection(N9(t,h,c.doc.resolve(p)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))}va.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&md(t)},20))};va.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};va.beforeinput=(t,e)=>{if(gs&&ad&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,Hp(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in ba)va[t]=ba[t];function aS(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class hA{constructor(e,n){this.toDOM=e,this.spec=n||Tm,this.side=this.spec.side||0}map(e,n,r,i){let{pos:s,deleted:a}=e.mapResult(n.from+i,this.side<0?-1:1);return a?null:new pa(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof hA&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&aS(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class jh{constructor(e,n){this.attrs=e,this.spec=n||Tm}map(e,n,r,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,a=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=a?null:new pa(s,a,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof jh&&aS(this.attrs,e.attrs)&&aS(this.spec,e.spec)}static is(e){return e.type instanceof jh}destroy(){}}class A9{constructor(e,n){this.attrs=e,this.spec=n||Tm}map(e,n,r,i){let s=e.mapResult(n.from+i,1);if(s.deleted)return null;let a=e.mapResult(n.to+i,-1);return a.deleted||a.pos<=s.pos?null:new pa(s.pos-r,a.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),s;return i==n.from&&!(s=e.child(r)).isText&&i+s.nodeSize==n.to}eq(e){return this==e||e instanceof A9&&aS(this.attrs,e.attrs)&&aS(this.spec,e.spec)}destroy(){}}class pa{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new pa(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new pa(e,e,new hA(n,r))}static inline(e,n,r,i){return new pa(e,n,new jh(r,i))}static node(e,n,r,i){return new pa(e,n,new A9(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof jh}get widget(){return this.type instanceof hA}}const Hx=[],Tm={};class ni{constructor(e,n){this.local=e.length?e:Hx,this.children=n.length?n:Hx}static create(e,n){return n.length?pA(n,e,0,Tm):Ws}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,s){for(let a=0;a<this.local.length;a++){let l=this.local[a];l.from<=n&&l.to>=e&&(!s||s(l.spec))&&r.push(l.copy(l.from+i,l.to+i))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<n&&this.children[a+1]>e){let l=this.children[a]+1;this.children[a+2].findInner(e-l,n-l,r,i+l,s)}}map(e,n,r){return this==Ws||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Tm)}mapInner(e,n,r,i,s){let a;for(let l=0;l<this.local.length;l++){let c=this.local[l].map(e,r,i);c&&c.type.valid(n,c)?(a||(a=[])).push(c):s.onRemove&&s.onRemove(this.local[l].spec)}return this.children.length?KFt(this.children,a||[],e,n,r,i,s):a?new ni(a.sort(Mm),Hx):Ws}add(e,n){return n.length?this==Ws?ni.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,s=0;e.forEach((l,c)=>{let u=c+r,d;if(d=Zbe(n,l,u)){for(i||(i=this.children.slice());s<i.length&&i[s]<c;)s+=3;i[s]==c?i[s+2]=i[s+2].addInner(l,d,u+1):i.splice(s,0,c,c+l.nodeSize,pA(d,l,u+1,Tm)),s+=3}});let a=Jbe(s?ewe(n):n,-r);for(let l=0;l<a.length;l++)a[l].type.valid(e,a[l])||a.splice(l--,1);return new ni(a.length?this.local.concat(a).sort(Mm):this.local,i||this.children)}remove(e){return e.length==0||this==Ws?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let a,l=r[s]+n,c=r[s+1]+n;for(let d=0,f;d<e.length;d++)(f=e[d])&&f.from>l&&f.to<c&&(e[d]=null,(a||(a=[])).push(f));if(!a)continue;r==this.children&&(r=this.children.slice());let u=r[s+2].removeInner(a,l+1);u!=Ws?r[s+2]=u:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,a;s<e.length;s++)if(a=e[s])for(let l=0;l<i.length;l++)i[l].eq(a,n)&&(i==this.local&&(i=this.local.slice()),i.splice(l--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new ni(i,r):Ws}forChild(e,n){if(this==Ws)return this;if(n.isLeaf)return ni.empty;let r,i;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let s=e+1,a=s+n.content.size;for(let l=0;l<this.local.length;l++){let c=this.local[l];if(c.from<a&&c.to>s&&c.type instanceof jh){let u=Math.max(s,c.from)-s,d=Math.min(a,c.to)-s;u<d&&(i||(i=[])).push(c.copy(u,d))}}if(i){let l=new ni(i.sort(Mm),Hx);return r?new Pf([l,r]):l}return r||Ws}eq(e){if(this==e)return!0;if(!(e instanceof ni)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return T9(this.localsInner(e))}localsInner(e){if(this==Ws)return Hx;if(e.inlineContent||!this.local.some(jh.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof jh||n.push(this.local[r]);return n}forEachSet(e){e(this)}}ni.empty=new ni([],[]);ni.removeOverlap=T9;const Ws=ni.empty;class Pf{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,Tm));return Pf.from(r)}forChild(e,n){if(n.isLeaf)return ni.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=Ws&&(s instanceof Pf?r=r.concat(s.members):r.push(s))}return Pf.from(r)}eq(e){if(!(e instanceof Pf)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let a=0;a<s.length;a++)n.push(s[a])}}return n?T9(r?n:n.sort(Mm)):Hx}static from(e){switch(e.length){case 0:return Ws;case 1:return e[0];default:return new Pf(e.every(n=>n instanceof ni)?e:e.reduce((n,r)=>n.concat(r instanceof ni?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;
vendor: 12,214 bytes, line 4986
4986n++)this.members[n].forEachSet(e)}}function KFt(t,e,n,r,i,s,a){let l=t.slice();for(let u=0,d=s;u<n.maps.length;u++){let f=0;n.maps[u].forEach((h,p,m,x)=>{let y=x-m-(p-h);for(let g=0;g<l.length;g+=3){let w=l[g+1];if(w<0||h>w+d-f)continue;let v=l[g]+d-f;p>=v?l[g+1]=h<=v?-2:-1:h>=d&&y&&(l[g]+=y,l[g+1]+=y)}f+=y}),d=n.maps[u].map(d,-1)}let c=!1;for(let u=0;u<l.length;u+=3)if(l[u+1]<0){if(l[u+1]==-2){c=!0,l[u+1]=-1;continue}let d=n.map(t[u]+s),f=d-i;if(f<0||f>=r.content.size){c=!0;continue}let h=n.map(t[u+1]+s,-1),p=h-i,{index:m,offset:x}=r.content.findIndex(f),y=r.maybeChild(m);if(y&&x==f&&x+y.nodeSize==p){let g=l[u+2].mapInner(n,y,d+1,t[u]+s+1,a);g!=Ws?(l[u]=f,l[u+1]=p,l[u+2]=g):(l[u+1]=-2,c=!0)}else c=!0}if(c){let u=YFt(l,t,e,n,i,s,a),d=pA(u,r,0,a);e=d.local;for(let f=0;f<l.length;f+=3)l[f+1]<0&&(l.splice(f,3),f-=3);for(let f=0,h=0;f<d.children.length;f+=3){let p=d.children[f];for(;h<l.length&&l[h]<p;)h+=3;l.splice(h,0,d.children[f],d.children[f+1],d.children[f+2])}}return new ni(e.sort(Mm),l)}function Jbe(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new pa(i.from+e,i.to+e,i.type))}return n}function YFt(t,e,n,r,i,s,a){function l(c,u){for(let d=0;d<c.local.length;d++){let f=c.local[d].map(r,i,u);f?n.push(f):a.onRemove&&a.onRemove(c.local[d].spec)}for(let d=0;d<c.children.length;d+=3)l(c.children[d+2],c.children[d]+u+1)}for(let c=0;c<t.length;c+=3)t[c+1]==-1&&l(t[c+2],e[c]+s+1);return n}function Zbe(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let s=0,a;s<t.length;s++)(a=t[s])&&a.from>n&&a.to<r&&((i||(i=[])).push(a),t[s]=null);return i}function ewe(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function pA(t,e,n,r){let i=[],s=!1;e.forEach((l,c)=>{let u=Zbe(t,l,c+n);if(u){s=!0;let d=pA(u,l,n+c+1,r);d!=Ws&&i.push(c,c+l.nodeSize,d)}});let a=Jbe(s?ewe(t):t,-n).sort(Mm);for(let l=0;l<a.length;l++)a[l].type.valid(e,a[l])||(r.onRemove&&r.onRemove(a[l].spec),a.splice(l--,1));return a.length||i.length?new ni(a,i):Ws}function Mm(t,e){return t.from-e.from||t.to-e.to}function T9(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let s=e[i];if(s.from==r.from){s.to!=r.to&&(e==t&&(e=t.slice()),e[i]=s.copy(s.from,r.to),rte(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,s.from),rte(e,i,r.copy(s.from,r.to)));break}}}return e}function rte(t,e,n){for(;e<t.length&&Mm(n,t[e])>0;)e++;t.splice(e,0,n)}function Y3(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Ws&&e.push(r)}),t.cursorWrapper&&e.push(ni.create(t.state.doc,[t.cursorWrapper.deco])),Pf.from(e)}const XFt={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},QFt=Wa&&Sh<=11;class JFt{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 ZFt{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new JFt,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);Wa&&Sh<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():Ls&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),QFt&&(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,XFt)),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 n=0;n<e.length;n++)this.queue.push(e[n]);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(Yee(this.view)){if(this.suppressingSelectionUpdates)return md(this.view);if(Wa&&Sh<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&mg(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 n=new Set,r;for(let s=e.focusNode;s;s=h0(s))n.add(s);for(let s=e.anchorNode;s;s=h0(s))if(n.has(s)){r=s;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.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 n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Yee(e)&&!this.ignoreSelectionChange(r),s=-1,a=-1,l=!1,c=[];if(e.editable)for(let d=0;d<n.length;d++){let f=this.registerMutation(n[d],c);f&&(s=s<0?f.from:Math.min(f.from,s),a=a<0?f.to:Math.max(f.to,a),f.typeOver&&(l=!0))}if(hl&&c.length){let d=c.filter(f=>f.nodeName=="BR");if(d.length==2){let[f,h]=d;f.parentNode&&f.parentNode.parentNode==h.parentNode?h.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let h of d){let p=h.parentNode;p&&p.nodeName=="LI"&&(!f||nUt(e,f)!=p)&&h.remove()}}}else if((gs||Ls)&&c.some(d=>d.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let d of c)if(d.nodeName=="BR"&&d.parentNode){let f=d.nextSibling;f&&f.nodeType==1&&f.contentEditable=="false"&&d.parentNode.removeChild(d)}}let u=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&fO(r)&&(u=S9(e))&&u.eq(Nn.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,md(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,a),eUt(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,rUt(e,c)),this.handleDOMChange(s,a,l,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||md(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.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 f=e.addedNodes[d];n.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,s=e.nextSibling;if(Wa&&Sh<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:f,nextSibling:h}=e.addedNodes[d];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(s=h)}let a=i&&i.parentNode==e.target?Os(i)+1:0,l=r.localPosFromDOM(e.target,a,-1),c=s&&s.parentNode==e.target?Os(s):e.target.childNodes.length,u=r.localPosFromDOM(e.target,c,1);return{from:l,to:u}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let ite=new WeakMap,ste=!1;function eUt(t){if(!ite.has(t)&&(ite.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=hl,ste)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."),ste=!0}}function ate(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,a=t.domAtPos(t.state.selection.anchor);return mg(a.node,a.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function tUt(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return ate(t,i)}let n;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?ate(t,n):null}function nUt(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function rUt(t,e){var n;let{focusNode:r,focusOffset:i}=t.domSelectionRange();for(let s of e)if(((n=s.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let a=s.nextSibling;for(;a&&a.nodeName!="TD"&&a.nodeName!="TH";)a=a.nextSibling;if(a){let l=a;for(;;){let c=l.firstChild;if(!c||c.nodeType!=1||c.contentEditable=="false"||/^(BR|IMG)$/.test(c.nodeName))break;l=c}l.insertBefore(s,l.firstChild),r==s&&t.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}function iUt(t,e,n){let{node:r,fromOffset:i,toOffset:s,from:a,to:l}=t.docView.parseRange(e,n),c=t.domSelectionRange(),u,d=c.anchorNode;if(d&&t.dom.contains(d.nodeType==1?d:d.parentNode)&&(u=[{node:d,offset:c.anchorOffset}],fO(c)||u.push({node:c.focusNode,offset:c.focusOffset})),gs&&t.input.lastKeyCode===8)for(let y=s;y>i;y--){let g=r.childNodes[y-1],w=g.pmViewDesc;if(g.nodeName=="BR"&&!w){s=y;break}if(!w||w.size)break}let f=t.state.doc,h=t.someProp("domParser")||_h.fromSchema(t.state.schema),p=f.resolve(a),m=null,x=h.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:s,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:sUt,context:p});if(u&&u[0].pos!=null){let y=u[0].pos,g=u[1]&&u[1].pos;g==null&&(g=y),m={anchor:y+a,head:g+a}}return{doc:x,sel:m,from:a,to:l}}function sUt(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Ls&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||Ls&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const aUt=/^(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 oUt(t,e,n,r,i){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let j=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,A=S9(t,j);if(A&&!t.state.selection.eq(A)){if(gs&&ad&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",k=>k(t,Hp(13,"Enter"))))return;let C=t.state.tr.setSelection(A);j=="pointer"?C.setMeta("pointer",!0):j=="key"&&C.scrollIntoView(),s&&C.setMeta("composition",s),t.dis
vendor: 4,888 bytes, line 4986
4986patch(C)}return}let a=t.state.doc.resolve(e),l=a.sharedDepth(n);e=a.before(l+1),n=t.state.doc.resolve(n).after(l+1);let c=t.state.selection,u=iUt(t,e,n),d=t.state.doc,f=d.slice(u.from,u.to),h,p;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(h=t.state.selection.to,p="end"):(h=t.state.selection.from,p="start"),t.input.lastKeyCode=null;let m=uUt(f.content,u.doc.content,u.from,h,p);if(m&&t.input.domChangeCount++,(p0&&t.input.lastIOSEnter>Date.now()-225||ad)&&i.some(j=>j.nodeType==1&&!aUt.test(j.nodeName))&&(!m||m.endA>=m.endB)&&t.someProp("handleKeyDown",j=>j(t,Hp(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!m)if(r&&c instanceof rn&&!c.empty&&c.$head.sameParent(c.$anchor)&&!t.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(u.sel){let j=ote(t,t.state.doc,u.sel);if(j&&!j.eq(t.state.selection)){let A=t.state.tr.setSelection(j);s&&A.setMeta("composition",s),t.dispatch(A)}}return}t.state.selection.from<t.state.selection.to&&m.start==m.endB&&t.state.selection instanceof rn&&(m.start>t.state.selection.from&&m.start<=t.state.selection.from+2&&t.state.selection.from>=u.from?m.start=t.state.selection.from:m.endA<t.state.selection.to&&m.endA>=t.state.selection.to-2&&t.state.selection.to<=u.to&&(m.endB+=t.state.selection.to-m.endA,m.endA=t.state.selection.to)),Wa&&Sh<=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 x=u.doc.resolveNoCache(m.start-u.from),y=u.doc.resolveNoCache(m.endB-u.from),g=d.resolve(m.start),w=x.sameParent(y)&&x.parent.inlineContent&&g.end()>=m.endA;if((p0&&t.input.lastIOSEnter>Date.now()-225&&(!w||i.some(j=>j.nodeName=="DIV"||j.nodeName=="P"))||!w&&x.pos<u.doc.content.size&&(!x.sameParent(y)||!x.parent.inlineContent)&&x.pos<y.pos&&!/\S/.test(u.doc.textBetween(x.pos,y.pos,"","")))&&t.someProp("handleKeyDown",j=>j(t,Hp(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>m.start&&cUt(d,m.start,m.endA,x,y)&&t.someProp("handleKeyDown",j=>j(t,Hp(8,"Backspace")))){ad&&gs&&t.domObserver.suppressSelectionUpdates();return}gs&&m.endB==m.start&&(t.input.lastChromeDelete=Date.now()),ad&&!w&&x.start()!=y.start()&&y.parentOffset==0&&x.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(()=>{t.someProp("handleKeyDown",function(j){return j(t,Hp(13,"Enter"))})},20));let v=m.start,N=m.endA,S=j=>{let A=j||t.state.tr.replace(v,N,u.doc.slice(m.start-u.from,m.endB-u.from));if(u.sel){let C=ote(t,A.doc,u.sel);C&&!(gs&&t.composing&&C.empty&&(m.start!=m.endB||t.input.lastChromeDelete<Date.now()-100)&&(C.head==v||C.head==A.mapping.map(N)-1)||Wa&&C.empty&&C.head==v)&&A.setSelection(C)}return s&&A.setMeta("composition",s),A.scrollIntoView()},_;if(w)if(x.pos==y.pos){Wa&&Sh<=11&&x.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>md(t),20));let j=S(t.state.tr.delete(v,N)),A=d.resolve(m.start).marksAcross(d.resolve(m.endA));A&&j.ensureMarks(A),t.dispatch(j)}else if(m.endA==m.endB&&(_=lUt(x.parent.content.cut(x.parentOffset,y.parentOffset),g.parent.content.cut(g.parentOffset,m.endA-g.start())))){let j=S(t.state.tr);_.type=="add"?j.addMark(v,N,_.mark):j.removeMark(v,N,_.mark),t.dispatch(j)}else if(x.parent.child(x.index()).isText&&x.index()==y.index()-(y.textOffset?0:1)){let j=x.parent.textBetween(x.parentOffset,y.parentOffset),A=()=>S(t.state.tr.insertText(j,v,N));t.someProp("handleTextInput",C=>C(t,v,N,j,A))||t.dispatch(A())}else t.dispatch(S());else t.dispatch(S())}function ote(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:N9(t,e.resolve(n.anchor),e.resolve(n.head))}function lUt(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,s=r,a,l,c;for(let d=0;d<r.length;d++)i=r[d].removeFromSet(i);for(let d=0;d<n.length;d++)s=n[d].removeFromSet(s);if(i.length==1&&s.length==0)l=i[0],a="add",c=d=>d.mark(l.addToSet(d.marks));else if(i.length==0&&s.length==1)l=s[0],a="remove",c=d=>d.mark(l.removeFromSet(d.marks));else return null;let u=[];for(let d=0;d<e.childCount;d++)u.push(c(e.child(d)));if(Ke.from(u).eq(t))return{mark:l,type:a}}function cUt(t,e,n,r,i){if(n-e<=i.pos-r.pos||X3(r,!0,!1)<i.pos)return!1;let s=t.resolve(e);if(!r.parent.isTextblock){let l=s.nodeAfter;return l!=null&&n==e+l.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let a=t.resolve(X3(s,!0,!0));return!a.parent.isTextblock||a.pos>n||X3(a,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(a.parent.content)}function X3(t,e,n){let r=t.depth,i=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let s=t.node(r).maybeChild(t.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function uUt(t,e,n,r,i){let s=t.findDiffStart(e,n);if(s==null)return null;let{a,b:l}=t.findDiffEnd(e,n+t.size,n+e.size);
vendor: 4,529 bytes, line 4986
4986if(i=="end"){let c=Math.max(0,s-Math.min(a,l));r-=a+c-s}if(a<s&&t.size<e.size){let c=r<=s&&r>=a?s-r:0;s-=c,s&&s<e.size&&lte(e.textBetween(s-1,s+1))&&(s+=c?1:-1),l=s+(l-a),a=s}else if(l<s){let c=r<=s&&r>=l?s-r:0;s-=c,s&&s<t.size&&lte(t.textBetween(s-1,s+1))&&(s+=c?1:-1),a=s+(a-l),l=s}return{start:s,endA:a,endB:l}}function lte(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class twe{constructor(e,n){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 CFt,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(hte),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=dte(this),ute(this),this.nodeViews=fte(this),this.docView=Vee(this.state.doc,cte(this),Y3(this),this.dom,this),this.domObserver=new ZFt(this,(r,i,s,a)=>oUt(this,r,i,s,a)),this.domObserver.start(),kFt(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 n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&zF(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(hte),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,s=!1,a=!1;e.storedMarks&&this.composing&&(Kbe(this),a=!0),this.state=e;let l=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let p=fte(this);fUt(p,this.nodeViews)&&(this.nodeViews=p,s=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&zF(this),this.editable=dte(this),ute(this);let c=Y3(this),u=cte(this),d=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",f=s||!this.docView.matchesNode(e.doc,u,c);(f||!e.selection.eq(i.selection))&&(a=!0);let h=d=="preserve"&&a&&this.dom.style.overflowAnchor==null&&z5t(this);if(a){this.domObserver.stop();let p=f&&(Wa||gs)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&dUt(i.selection,e.selection);if(f){let m=gs?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=zFt(this)),(s||!this.docView.update(e.doc,u,c,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=Vee(e.doc,u,c,this.dom,this)),m&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&dFt(this))?md(this,p):(Dbe(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():h&&B5t(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Wt){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Lee(this,n.getBoundingClientRect(),e)}else Lee(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 n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,i=-1;if(this.state.doc.nodeAt(r.from)==r.node)i=r.from;
vendor: 5,576 bytes, line 4986
4986else{let s=r.from+(this.state.doc.content.size-n.doc.content.size);(s>0&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new Xbe(e.slice,e.move,i<0?void 0:Wt.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let a=0;a<this.directPlugins.length;a++){let l=this.directPlugins[a].props[e];if(l!=null&&(i=n?n(l):l))return i}let s=this.state.plugins;if(s)for(let a=0;a<s.length;a++){let l=s[a].props[e];if(l!=null&&(i=n?n(l):l))return i}}hasFocus(){if(Wa){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&&V5t(this.dom),md(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return K5t(this,e)}coordsAtPos(e,n=1){return Ebe(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return Z5t(this,n||this.state,e)}pasteHTML(e,n){return sS(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return sS(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return j9(this,e)}destroy(){this.docView&&(EFt(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Y3(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,M5t())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return TFt(this,e)}domSelectionRange(){let e=this.domSelection();return e?Ls&&this.root.nodeType===11&&D5t(this.dom.ownerDocument)==this.dom&&tUt(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}twe.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function cte(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[pa.node(0,t.state.doc.content.size,e)]}function ute(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:pa.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function dte(t){return!t.someProp("editable",e=>e(t.state)===!1)}function dUt(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function fte(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function fUt(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function hte(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Bh={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:"'"},mA={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},hUt=typeof navigator<"u"&&/Mac/.test(navigator.platform),pUt=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Rs=0;Rs<10;Rs++)Bh[48+Rs]=Bh[96+Rs]=String(Rs);for(var Rs=1;Rs<=24;Rs++)Bh[Rs+111]="F"+Rs;for(var Rs=65;Rs<=90;Rs++)Bh[Rs]=String.fromCharCode(Rs+32),mA[Rs]=String.fromCharCode(Rs);for(var Q3 in Bh)mA.hasOwnProperty(Q3)||(mA[Q3]=Bh[Q3]);function mUt(t){var e=hUt&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||pUt&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?mA:Bh)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const gUt=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),xUt=typeof navigator<"u"&&/Win/.test(navigator.platform);function yUt(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,s,a;for(let l=0;l<e.length-1;l++){let c=e[l];
vendor: 22,359 bytes, lines 4986-4987
4986if(/^(cmd|meta|m)$/i.test(c))a=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))i=!0;else if(/^s(hift)?$/i.test(c))s=!0;else if(/^mod$/i.test(c))gUt?a=!0:i=!0;else throw new Error("Unrecognized modifier name: "+c)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),a&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function vUt(t){let e=Object.create(null);for(let n in t)e[yUt(n)]=t[n];return e}function J3(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function bUt(t){return new si({props:{handleKeyDown:nwe(t)}})}function nwe(t){let e=vUt(t);return function(n,r){let i=mUt(r),s,a=e[J3(i,r)];if(a&&a(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let l=e[J3(i,r,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(xUt&&r.ctrlKey&&r.altKey)&&(s=Bh[r.keyCode])&&s!=i){let l=e[J3(s,r)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}var wUt=Object.defineProperty,M9=(t,e)=>{for(var n in e)wUt(t,n,{get:e[n],enumerable:!0})};function mO(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:i}=n,{storedMarks:s}=n;return{...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 s},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,s=n.storedMarks,n}}}var gO=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:i}=n,s=this.buildProps(i);return Object.fromEntries(Object.entries(t).map(([a,l])=>[a,(...u)=>{const d=l(...u)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:i}=this,{view:s}=r,a=[],l=!!t,c=t||i.tr,u=()=>(!l&&e&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(c),a.every(f=>f===!0)),d={...Object.fromEntries(Object.entries(n).map(([f,h])=>[f,(...m)=>{const x=this.buildProps(c,e),y=h(...m)(x);return a.push(y),d}])),run:u};return d}createCan(t){const{rawCommands:e,state:n}=this,r=!1,i=t||n.tr,s=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(e).map(([l,c])=>[l,(...u)=>c(...u)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:i}=this,{view:s}=r,a={tr:t,editor:r,view:s,state:mO({state:i,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([l,c])=>[l,(...u)=>c(...u)(a)]))}};return a}},rwe={};M9(rwe,{blur:()=>_Ut,clearContent:()=>SUt,clearNodes:()=>NUt,command:()=>jUt,createParagraphNear:()=>CUt,cut:()=>kUt,deleteCurrentNode:()=>EUt,deleteNode:()=>AUt,deleteRange:()=>TUt,deleteSelection:()=>MUt,enter:()=>PUt,exitCode:()=>OUt,extendMarkRange:()=>RUt,first:()=>IUt,focus:()=>LUt,forEach:()=>$Ut,insertContent:()=>FUt,insertContentAt:()=>BUt,joinBackward:()=>WUt,joinDown:()=>HUt,joinForward:()=>GUt,joinItemBackward:()=>qUt,joinItemForward:()=>KUt,joinTextblockBackward:()=>YUt,joinTextblockForward:()=>XUt,joinUp:()=>VUt,keyboardShortcut:()=>JUt,lift:()=>ZUt,liftEmptyBlock:()=>ezt,liftListItem:()=>tzt,newlineInCode:()=>nzt,resetAttributes:()=>rzt,scrollIntoView:()=>izt,selectAll:()=>szt,selectNodeBackward:()=>azt,selectNodeForward:()=>ozt,selectParentNode:()=>lzt,selectTextblockEnd:()=>czt,selectTextblockStart:()=>uzt,setContent:()=>dzt,setMark:()=>Mzt,setMeta:()=>Pzt,setNode:()=>Ozt,setNodeSelection:()=>Rzt,setTextDirection:()=>Izt,setTextSelection:()=>Dzt,sinkListItem:()=>Lzt,splitBlock:()=>$zt,splitListItem:()=>Fzt,toggleList:()=>Uzt,toggleMark:()=>zzt,toggleNode:()=>Bzt,toggleWrap:()=>Vzt,undoInputRule:()=>Hzt,unsetAllMarks:()=>Wzt,unsetMark:()=>Gzt,unsetTextDirection:()=>qzt,updateAttributes:()=>Kzt,wrapIn:()=>Yzt,wrapInList:()=>Xzt});var _Ut=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),SUt=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),NUt=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:s,$to:a})=>{t.doc.nodesBetween(s.pos,a.pos,(l,c)=>{if(l.type.isText)return;const{doc:u,mapping:d}=e,f=u.resolve(d.map(c)),h=u.resolve(d.map(c+l.nodeSize)),p=f.blockRange(h);if(!p)return;const m=Z0(p);if(l.type.isTextblock){const{defaultType:x}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(p.start,x)}(m||m===0)&&e.lift(p,m)})}),!0},jUt=t=>e=>t(e),CUt=()=>({state:t,dispatch:e})=>xbe(t,e),kUt=(t,e)=>({editor:n,tr:r})=>{const{state:i}=n,s=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const a=r.mapping.map(e);return r.insert(a,s.content),r.setSelection(new rn(r.doc.resolve(Math.max(a-1,0)))),!0},EUt=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const l=i.before(s),c=i.after(s);t.delete(l,c).scrollIntoView()}return!0}return!1};function Di(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var AUt=t=>({tr:e,state:n,dispatch:r})=>{const i=Di(t,n.schema),s=e.selection.$anchor;for(let a=s.depth;a>0;a-=1)if(s.node(a).type===i){if(r){const c=s.before(a),u=s.after(a);e.delete(c,u).scrollIntoView()}return!0}return!1},TUt=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},MUt=()=>({state:t,dispatch:e})=>x9(t,e),PUt=()=>({commands:t})=>t.keyboardShortcut("Enter"),OUt=()=>({state:t,dispatch:e})=>g5t(t,e);function P9(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function gA(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:P9(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function iwe(t,e,n={}){return t.find(r=>r.type===e&&gA(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function pte(t,e,n={}){return!!iwe(t,e,n)}function O9(t,e,n){var r;if(!t||!e)return;let i=t.parent.childAfter(t.parentOffset);if((!i.node||!i.node.marks.some(d=>d.type===e))&&(i=t.parent.childBefore(t.parentOffset)),!i.node||!i.node.marks.some(d=>d.type===e)||(n=n||((r=i.node.marks[0])==null?void 0:r.attrs),!iwe([...i.node.marks],e,n)))return;let a=i.index,l=t.start()+i.offset,c=a+1,u=l+i.node.nodeSize;for(;a>0&&pte([...t.parent.child(a-1).marks],e,n);)a-=1,l-=t.parent.child(a).nodeSize;for(;c<t.parent.childCount&&pte([...t.parent.child(c).marks],e,n);)u+=t.parent.child(c).nodeSize,c+=1;return{from:l,to:u}}function Kd(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}var RUt=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const s=Kd(t,r.schema),{doc:a,selection:l}=n,{$from:c,from:u,to:d}=l;if(i){const f=O9(c,s,e);if(f&&f.from<=u&&f.to>=d){const h=rn.create(a,f.from,f.to);n.setSelection(h)}}return!0},IUt=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function swe(t){return t instanceof rn}function lm(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function awe(t,e=null){if(!e)return null;const n=Nn.atStart(t),r=Nn.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,s=r.to;return e==="all"?rn.create(t,lm(0,i,s),lm(t.content.size,i,s)):rn.create(t,lm(e,i,s),lm(e,i,s))}function mte(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function xA(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function DUt(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var LUt=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const a=()=>{(xA()||mte())&&r.dom.focus(),DUt()&&!xA()&&!mte()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};if(r.hasFocus()&&t===null||t===!1)return!0;if(s&&t===null&&!swe(n.state.selection))return a(),!0;const l=awe(i.doc,t)||n.state.selection,c=n.state.selection.eq(l);return s&&(c||i.setSelection(l),c&&i.storedMarks&&i.setStoredMarks(i.storedMarks),a()),!0},$Ut=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),FUt=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),owe=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&owe(r)}return t};function gC(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return owe(n)}function oS(t,e,n){if(t instanceof wh||t instanceof Ke)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,i=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return Ke.fromArray(t.map(l=>e.nodeFromJSON(l)));const a=e.nodeFromJSON(t);return n.errorOnInvalidContent&&a.check(),a}catch(s){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",s),oS("",e,n)}if(i){if(n.errorOnInvalidContent){let a=!1,l="";const c=new H0e({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,l=typeof u=="string"?u:u.outerHTML,null)}]}})});if(n.slice?_h.fromSchema(c).parseSlice(gC(t),n.parseOptions):_h.fromSchema(c).parse(gC(t),n.parseOptions),n.errorOnInvalidContent&&a)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const s=_h.fromSchema(e);return n.slice?s.parseSlice(gC(t),n.parseOptions).content:s.parse(gC(t),n.parseOptions)}return oS("",e,n)}function UUt(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof hs||i instanceof vs))return;const s=t.mapping.maps[r];let a=0;s.forEach((l,c,u,d)=>{a===0&&(a=d)}),t.setSelection(Nn.near(t.doc.resolve(a),n))}var zUt=t=>!("type"in t),BUt=(t,e,n)=>({tr:r,dispatch:i,editor:s})=>{var a;if(i){n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l;const c=y=>{s.emit("contentError",{editor:s,error:y,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},u={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{oS(e,s.schema,{parseOptions:u,errorOnInvalidContent:!0})}catch(y){c(y)}try{l=oS(e,s.schema,{parseOptions:u,errorOnInvalidContent:(a=n.errorOnInvalidContent)!=null?a:s.options.enableContentCheck})}catch(y){return c(y),!1}let{from:d,to:f}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},h=!0,p=!0;if((zUt(l)?l:[l]).forEach(y=>{y.check(),h=h?y.isText&&y.marks.length===0:!1,p=p?y.isBlock:!1}),d===f&&p){const{parent:y}=r.doc.resolve(d);y.isTextblock&&!y.type.spec.code&&!y.childCount&&(d-=1,f+=1)}let x;if(h){if(Array.isArray(e))x=e.map(y=>y.text||"").join("");else if(e instanceof Ke){let y="";e.forEach(g=>{g.text&&(y+=g.text)}),x=y}else typeof e=="object"&&e&&e.text?x=e.text:x=e;r.insertText(x,d,f)}else{x=l;const y=r.doc.resolve(d),g=y.node(),w=y.parentOffset===0,v=g.isText||g.isTextblock,N=g.content.size>0;w&&v&&N&&(d=Math.max(0,d-1)),r.replaceWith(d,f,x)}n.updateSelection&&UUt(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:d,text:x}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:d,text:x})}return!0},VUt=()=>({state:t,dispatch:e})=>h5t(t,e),HUt=()=>({state:t,dispatch:e})=>p5t(t,e),WUt=()=>({state:t,dispatch:e})=>ube(t,e),GUt=()=>({state:t,dispatch:e})=>pbe(t,e),qUt=()=>({state:t,dispatch:e,tr:n})=>{try{const r=cO(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},KUt=()=>({state:t,dispatch:e,tr:n})=>{try{const r=cO(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},YUt=()=>({state:t,dispatch:e})=>d5t(t,e),XUt=()=>({state:t,dispatch:e})=>f5t(t,e);function lwe(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function QUt(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,s,a;for(let l=0;l<e.length-1;l+=1){const c=e[l];if(/^(cmd|meta|m)$/i.test(c))a=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))i=!0;else if(/^s(hift)?$/i.test(c))s=!0;else if(/^mod$/i.test(c))xA()||lwe()?a=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${c}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),a&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}var JUt=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const s=QUt(t).split(/-(?!$)/),a=s.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),l=new KeyboardEvent("keydown",{key:a==="Space"?" ":a,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),c=e.captureTransaction(()=>{n.someProp("handleKeyDown",u=>u(n,l))});return c==null||c.steps.forEach(u=>{const d=u.map(r.mapping);d&&i&&r.maybeStep(d)}),!0};function Vh(t,e,n={}){const{from:r,to:i,empty:s}=t.selection,a=e?Di(e,t.schema):null,l=[];t.doc.nodesBetween(r,i,(f,h)=>{if(f.isText)return;const p=Math.max(r,h),m=Math.min(i,h+f.nodeSize);l.push({node:f,from:p,to:m})});const c=i-r,u=l.filter(f=>a?a.name===f.node.type.name:!0).filter(f=>gA(f.node.attrs,n,{strict:!1}));return s?!!u.length:u.reduce((f,h)=>f+h.to-h.from,0)>=c}var ZUt=(t,e={})=>({state:n,dispatch:r})=>{const i=Di(t,n.schema);return Vh(n,i,e)?m5t(n,r):!1},ezt=()=>({state:t,dispatch:e})=>ybe(t,e),tzt=t=>({state:e,dispatch:n})=>{const r=Di(t,e.schema);return k5t(r)(e,n)},nzt=()=>({state:t,dispatch:e})=>gbe(t,e);function xO(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function gte(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}var rzt=(t,e)=>({tr:n,state:r,dispatch:i})=>{let s=null,a=null;const l=xO(typeof t=="string"?t:t.name,r.schema);if(!l)return!1;l==="node"&&(s=Di(t,r.schema)),l==="mark"&&(a=Kd(t,r.schema));let c=!1;return n.selection.ranges.forEach(u=>{r.doc.nodesBetween(u.$from.pos,u.$to.pos,(d,f)=>{s&&s===d.type&&(c=!0,i&&n.setNodeMarkup(f,void 0,gte(d.attrs,e))),a&&d.marks.length&&d.marks.forEach(h=>{a===h.type&&(c=!0,i&&n.addMark(f,f+d.nodeSize,a.create(gte(h.attrs,e))))})})}),c},izt=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),szt=()=>({tr:t,dispatch:e})=>{if(e){const n=new ko(t.doc);t.setSelection(n)}return!0},azt=()=>({state:t,dispatch:e})=>fbe(t,e),ozt=()=>({state:t,dispatch:e})=>mbe(t,e),lzt=()=>({state:t,dispatch:e})=>v5t(t,e),czt=()=>({state:t,dispatch:e})=>_5t(t,e),uzt=()=>({state:t,dispatch:e})=>w5t(t,e);function BF(t,e,n={},r={}){return oS(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var dzt=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:s,dispatch:a,commands:l})=>{const{doc:c}=s;if(r.preserveWhitespace!=="full"){const u=BF(t,i.schema,r,{errorOnInvalidContent:e??i.options.enableContentCheck});return a&&s.replaceWith(0,c.content.size,u).setMeta("preventUpdate",!n),!0}return a&&s.setMeta("preventUpdate",!n),l.insertContentAt({from:0,to:c.content.size},t,{parseOptions:r,errorOnInvalidContent:e??i.options.enableContentCheck})};function cwe(t,e){const n=Kd(e,t.schema),{from:r,to:i,empty:s}=t.selection,a=[];s?(t.storedMarks&&a.push(...t.storedMarks),a.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,c=>{a.push(...c.marks)});const l=a.find(c=>c.type.name===n.name);return l?{...l.attrs}:{}}function uwe(t,e){const n=new abe(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function fzt(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function hzt(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(i,s)=>{n(i)&&r.push({node:i,pos:s})}),r}function pzt(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function yO(t){return e=>pzt(e.$from,t)}function It(t,e,n){return t.config[e]===void 0&&t.parent?It(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?It(t.parent,e,n):null}):t.config[e]}function R9(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=It(e,"addExtensions",n);return r?[e,...R9(r())]:e}).flat(10)}function I9(t,e){const n=Vg.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}function dwe(t){return typeof t=="function"}function Zn(t,e=void 0,...n){return dwe(t)?e?t.bind(e)(...n):t(...n):t}function mzt(t={}){return Object.keys(t).length===0&&t.constructor===Object}function m0(t){const e=t.filter(i=>i.type==="extension"),n=t.filter(i=>i.type==="node"),r=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function fwe(t){const e=[],{nodeExtensions:n,markExtensions:r}=m0(t),i=[...n,...r],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(a=>{const l={name:a.name,options:a.options,storage:a.storage,extensions:i},c=It(a,"addGlobalAttributes",l);if(!c)return;c().forEach(d=>{d.types.forEach(f=>{Object.entries(d.attributes).forEach(([h,p])=>{e.push({type:f,name:h,attribute:{...s,...p}})})})})}),i.forEach(a=>{const l={name:a.name,options:a.options,storage:a.storage},c=It(a,"addAttributes",l);if(!c)return;const u=c();Object.entries(u).forEach(([d,f])=>{const h={...s,...f};typeof(h==null?void 0:h.default)=="function"&&(h.default=h.default()),h!=null&&h.isRequired&&(h==null?void 0:h.default)===void 0&&delete h.default,e.push({type:a.name,name:d,attribute:h})})}),e}function Li(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}if(i==="class"){const l=s?String(s).split(" "):[],c=r[i]?r[i].split(" "):[],u=l.filter(d=>!c.includes(d));r[i]=[...c,...u].join(" ")}else if(i==="style"){const l=s?s.split(";").map(d=>d.trim()).filter(Boolean):[],c=r[i]?r[i].split(";").map(d=>d.trim()).filter(Boolean):[],u=new Map;c.forEach(d=>{const[f,h]=d.split(":").map(p=>p.trim());u.set(f,h)}),l.forEach(d=>{const[f,h]=d.split(":").map(p=>p.trim());u.set(f,h)}),r[i]=Array.from(u.entries()).map(([d,f])=>`${d}: ${f}`).join("; ")}else r[i]=s}),r},{})}function lS(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>Li(n,r),{})}function gzt(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function xte(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const i=e.reduce((s,a)=>{const l=a.attribute.parseHTML?a.attribute.parseHTML(n):gzt(n.getAttribute(a.name));return l==null?s:{...s,[a.name]:l}},{});return{...r,...i}}}}function yte(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&mzt(n)?!1:n!=null))}function vte(t){var e,n;const r={};return!((e=t==null?void 0:t.attribute)!=null&&e.isRequired)&&"default"in((t==null?void 0:t.attribute)||{})&&(r.default=t.attribute.default),((n=t==null?void 0:t.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function xzt(t,e){var n;const r=fwe(t),{nodeExtensions:i,markExtensions:s}=m0(t),a=(n=i.find(u=>It(u,"topNode")))==null?void 0:n.name,l=Object.fromEntries(i.map(u=>{const d=r.filter(g=>g.type===u.name),f={name:u.name,options:u.options,storage:u.storage,editor:e},h=t.reduce((g,w)=>{const v=It(w,"extendNodeSchema",f);return{...g,...v?v(u):{}}},{}),p=yte({...h,content:Zn(It(u,"content",f)),marks:Zn(It(u,"marks",f)),group:Zn(It(u,"group",f)),inline:Zn(It(u,"inline",f)),atom:Zn(It(u,"atom",f)),selectable:Zn(It(u,"selectable",f)),draggable:Zn(It(u,"draggable",f)),code:Zn(It(u,"code",f)),whitespace:Zn(It(u,"whitespace",f)),linebreakReplacement:Zn(It(u,"linebreakReplacement",f)),defining:Zn(It(u,"defining",f)),isolating:Zn(It(u,"isolating",f)),attrs:Object.fromEntries(d.map(vte))}),m=Zn(It(u,"parseHTML",f));m&&(p.parseDOM=m.map(g=>xte(g,d)));const x=It(u,"renderHTML",f);x&&(p.toDOM=g=>x({node:g,HTMLAttributes:lS(g,d)}));const y=It(u,"renderText",f);return y&&(p.toText=y),[u.name,p]})),c=Object.fromEntries(s.map(u=>{const d=r.filter(y=>y.type===u.name),f={name:u.name,options:u.options,storage:u.storage,editor:e},h=t.reduce((y,g)=>{const w=It(g,"extendMarkSchema",f);return{...y,...w?w(u):{}}},{}),p=yte({...h,inclusive:Zn(It(u,"inclusive",f)),excludes:Zn(It(u,"excludes",f)),group:Zn(It(u,"group",f)),spanning:Zn(It(u,"spanning",f)),code:Zn(It(u,"code",f)),attrs:Object.fromEntries(d.map(vte))}),m=Zn(It(u,"parseHTML",f));m&&(p.parseDOM=m.map(y=>xte(y,d)));const x=It(u,"renderHTML",f);return x&&(p.toDOM=y=>x({mark:y,HTMLAttributes:lS(y,d)})),[u.name,p]}));return new H0e({topNode:a,nodes:l,marks:c})}function yzt(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function yA(t){return t.sort((n,r)=>{const i=It(n,"priority")||100,s=It(r,"priority")||100;return i>s?-1:i<s?1:0})}function hwe(t){const e=yA(R9(t)),n=yzt(e.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function pwe(t,e,n){const{from:r,to:i}=e,{blockSeparator:s=`
4987
4988`,textSerializers:a={}}=n||{};let l="";return t.nodesBetween(r,i,(c,u,d,f)=>{var h;c.isBlock&&u>r&&(l+=s);const p=a==null?void 0:a[c.type.name];if(p)return d&&(l+=p({node:c,pos:u,parent:d,index:f,range:e})),!1;c.isText&&(l+=(h=c==null?void 0:c.text)==null?void 0:h.slice(Math.max(r,u)-u,i-u))}),l}function vzt(t,e){const n={from:0,to:t.content.size};return pwe(t,n,e)}function mwe(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function bzt(t,e){const n=Di(e,t.schema),{from:r,to:i}=t.selection,s=[];t.doc.nodesBetween(r,i,l=>{s.push(l)});const a=s.reverse().find(l=>l.type.name===n.name);return a?{...a.attrs}:{}}function gwe(t,e){const n=xO(typeof e=="string"?e:e.name,t.schema);return n==="node"?bzt(t,e):n==="mark"?cwe(t,e):{}}function wzt(t,e=JSON.stringify){const n={};return t.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function _zt(t){const e=wzt(t);return e.length===1?e:e.filter((n,r)=>!e.filter((s,a)=>a!==r).some(s=>n.oldRange.from>=s.oldRange.from&&n.oldRange.to<=s.oldRange.to&&n.newRange.from>=s.newRange.from&&n.newRange.to<=s.newRange.to))}function xwe(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,s)=>{const a=[];if(i.ranges.length)i.forEach((l,c)=>{a.push({from:l,to:c})});else{const{from:l,to:c}=n[s];if(l===void 0||c===void 0)return;a.push({from:l,to:c})}a.forEach(({from:l,to:c})=>{const u=e.slice(s).map(l,-1),d=e.slice(s).map(c),f=e.invert().map(u,-1),h=e.invert().map(d);r.push({oldRange:{from:f,to:h},newRange:{from:u,to:d}})})}),_zt(r)}function D9(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const s=n.resolve(t),a=O9(s,i.type);a&&r.push({mark:i,...a})}):n.nodesBetween(t,e,(i,s)=>{!i||(i==null?void 0:i.nodeSize)===void 0||r.push(...i.marks.map(a=>({from:s,to:s+i.nodeSize,mark:a})))}),r}var Szt=(t,e,n,r=20)=>{const i=t.doc.resolve(n);let s=r,a=null;for(;s>0&&a===null;){const l=i.node(s);(l==null?void 0:l.type.name)===e?a=l:s-=1}return[a,s]};function xC(t,e){return e.nodes[t]||e.marks[t]||null}function xk(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}var Nzt=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,s,a,l)=>{var c,u;const d=((u=(c=i.type.spec).toText)==null?void 0:u.call(c,{node:i,pos:s,parent:a,index:l}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?d:d.slice(0,Math.max(0,r-s))}),n};function VF(t,e,n={}){const{empty:r,ranges:i}=t.selection,s=e?Kd(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(f=>s?s.name===f.type.name:!0).find(f=>gA(f.attrs,n,{strict:!1}));let a=0;const l=[];if(i.forEach(({$from:f,$to:h})=>{const p=f.pos,m=h.pos;t.doc.nodesBetween(p,m,(x,y)=>{if(!x.isText&&!x.marks.length)return;const g=Math.max(p,y),w=Math.min(m,y+x.nodeSize),v=w-g;a+=v,l.push(...x.marks.map(N=>({mark:N,from:g,to:w})))})}),a===0)return!1;const c=l.filter(f=>s?s.name===f.mark.type.name:!0).filter(f=>gA(f.mark.attrs,n,{strict:!1})).reduce((f,h)=>f+h.to-h.from,0),u=l.filter(f=>s?f.mark.type!==s&&f.mark.type.excludes(s):!0).reduce((f,h)=>f+h.to-h.from,0);return(c>0?c+u:c)>=a}function jzt(t,e,n={}){if(!e)return Vh(t,null,n)||VF(t,null,n);const r=xO(e,t.schema);return r==="node"?Vh(t,e,n):r==="mark"?VF(t,e,n):!1}var Czt=(t,e)=>{const{$from:n,$to:r,$anchor:i}=t.selection;if(e){const s=yO(l=>l.type.name===e)(t.selection);if(!s)return!1;const a=t.doc.resolve(s.pos+1);return i.pos+1===a.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},kzt=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function bte(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function wte(t,e){const{nodeExtensions:n}=m0(e),r=n.find(a=>a.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=Zn(It(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function vO(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;
vendor: 47,287 bytes, lines 4988-5067
4988if(t.isText)return/^\s*$/m.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let i=!0;return t.content.forEach(s=>{i!==!1&&(vO(s,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function ywe(t){return t instanceof Wt}var vwe=class bwe{constructor(e){this.position=e}static fromJSON(e){return new bwe(e.position)}toJSON(){return{position:this.position}}};function Ezt(t,e){const n=e.mapping.mapResult(t.position);return{position:new vwe(n.pos),mapResult:n}}function Azt(t){return new vwe(t)}function Tzt(t,e,n){var r;const{selection:i}=e;let s=null;if(swe(i)&&(s=i.$cursor),s){const l=(r=t.storedMarks)!=null?r:s.marks();return s.parent.type.allowsMarkType(n)&&(!!n.isInSet(l)||!l.some(u=>u.type.excludes(n)))}const{ranges:a}=i;return a.some(({$from:l,$to:c})=>{let u=l.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(l.pos,c.pos,(d,f,h)=>{if(u)return!1;if(d.isInline){const p=!h||h.type.allowsMarkType(n),m=!!n.isInSet(d.marks)||!d.marks.some(x=>x.type.excludes(n));u=p&&m}return!u}),u})}var Mzt=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=n,{empty:a,ranges:l}=s,c=Kd(t,r.schema);if(i)if(a){const u=cwe(r,c);n.addStoredMark(c.create({...u,...e}))}else l.forEach(u=>{const d=u.$from.pos,f=u.$to.pos;r.doc.nodesBetween(d,f,(h,p)=>{const m=Math.max(p,d),x=Math.min(p+h.nodeSize,f);h.marks.find(g=>g.type===c)?h.marks.forEach(g=>{c===g.type&&n.addMark(m,x,c.create({...g.attrs,...e}))}):n.addMark(m,x,c.create(e))})});return Tzt(r,n,c)},Pzt=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),Ozt=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const s=Di(t,n.schema);let a;return n.selection.$anchor.sameParent(n.selection.$head)&&(a=n.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:l})=>Ree(s,{...a,...e})(n)?!0:l.clearNodes()).command(({state:l})=>Ree(s,{...a,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Rzt=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=lm(t,0,r.content.size),s=Wt.create(r,i);e.setSelection(s)}return!0},Izt=(t,e)=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=r;let a,l;return typeof e=="number"?(a=e,l=e):e&&"from"in e&&"to"in e?(a=e.from,l=e.to):(a=s.from,l=s.to),i&&n.doc.nodesBetween(a,l,(c,u)=>{c.isText||n.setNodeMarkup(u,void 0,{...c.attrs,dir:t})}),!0},Dzt=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:s}=typeof t=="number"?{from:t,to:t}:t,a=rn.atStart(r).from,l=rn.atEnd(r).to,c=lm(i,a,l),u=lm(s,a,l),d=rn.create(r,c,u);e.setSelection(d)}return!0},Lzt=t=>({state:e,dispatch:n})=>{const r=Di(t,e.schema);return T5t(r)(e,n)};function _te(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(i=>e==null?void 0:e.includes(i.type.name));t.tr.ensureMarks(r)}}var $zt=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:a}=e,{$from:l,$to:c}=s,u=i.extensionManager.attributes,d=xk(u,l.node().type.name,l.node().attrs);if(s instanceof Wt&&s.node.isBlock)return!l.parentOffset||!pd(a,l.pos)?!1:(r&&(t&&_te(n,i.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const f=c.parentOffset===c.parent.content.size,h=l.depth===0?void 0:fzt(l.node(-1).contentMatchAt(l.indexAfter(-1)));let p=f&&h?[{type:h,attrs:d}]:void 0,m=pd(e.doc,e.mapping.map(l.pos),1,p);if(!p&&!m&&pd(e.doc,e.mapping.map(l.pos),1,h?[{type:h}]:void 0)&&(m=!0,p=h?[{type:h,attrs:d}]:void 0),r){if(m&&(s instanceof rn&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,p),h&&!f&&!l.parentOffset&&l.parent.type!==h)){const x=e.mapping.map(l.before()),y=e.doc.resolve(x);l.node(-1).canReplaceWith(y.index(),y.index()+1,h)&&e.setNodeMarkup(e.mapping.map(l.before()),h)}t&&_te(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return m},Fzt=(t,e={})=>({tr:n,state:r,dispatch:i,editor:s})=>{var a;const l=Di(t,r.schema),{$from:c,$to:u}=r.selection,d=r.selection.node;if(d&&d.isBlock||c.depth<2||!c.sameParent(u))return!1;const f=c.node(-1);if(f.type!==l)return!1;const h=s.extensionManager.attributes;if(c.parent.content.size===0&&c.node(-1).childCount===c.indexAfter(-1)){if(c.depth===2||c.node(-3).type!==l||c.index(-2)!==c.node(-2).childCount-1)return!1;if(i){let g=Ke.empty;const w=c.index(-1)?1:c.index(-2)?2:3;for(let A=c.depth-w;A>=c.depth-3;A-=1)g=Ke.from(c.node(A).copy(g));const v=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,N={...xk(h,c.node().type.name,c.node().attrs),...e},S=((a=l.contentMatch.defaultType)==null?void 0:a.createAndFill(N))||void 0;g=g.append(Ke.from(l.createAndFill(null,S)||void 0));const _=c.before(c.depth-(w-1));n.replace(_,c.after(-v),new ft(g,4-w,0));let j=-1;n.doc.nodesBetween(_,n.doc.content.size,(A,C)=>{if(j>-1)return!1;A.isTextblock&&A.content.size===0&&(j=C+1)}),j>-1&&n.setSelection(rn.near(n.doc.resolve(j))),n.scrollIntoView()}return!0}const p=u.pos===c.end()?f.contentMatchAt(0).defaultType:null,m={...xk(h,f.type.name,f.attrs),...e},x={...xk(h,c.node().type.name,c.node().attrs),...e};n.delete(c.pos,u.pos);const y=p?[{type:l,attrs:m},{type:p,attrs:x}]:[{type:l,attrs:m}];if(!pd(n.doc,c.pos,2))return!1;if(i){const{selection:g,storedMarks:w}=r,{splittableMarks:v}=s.extensionManager,N=w||g.$to.parentOffset&&g.$from.marks();if(n.split(c.pos,2,y).scrollIntoView(),!N||!i)return!0;const S=N.filter(_=>v.includes(_.type.name));n.ensureMarks(S)}return!0},Z3=(t,e)=>{const n=yO(a=>a.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&lp(t.doc,n.pos)&&t.join(n.pos),!0},eD=(t,e)=>{const n=yO(a=>a.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&lp(t.doc,r)&&t.join(r),!0},Uzt=(t,e,n,r={})=>({editor:i,tr:s,state:a,dispatch:l,chain:c,commands:u,can:d})=>{const{extensions:f,splittableMarks:h}=i.extensionManager,p=Di(t,a.schema),m=Di(e,a.schema),{selection:x,storedMarks:y}=a,{$from:g,$to:w}=x,v=g.blockRange(w),N=y||x.$to.parentOffset&&x.$from.marks();if(!v)return!1;const S=yO(_=>wte(_.type.name,f))(x);if(v.depth>=1&&S&&v.depth-S.depth<=1){if(S.node.type===p)return u.liftListItem(m);if(wte(S.node.type.name,f)&&p.validContent(S.node.content)&&l)return c().command(()=>(s.setNodeMarkup(S.pos,p),!0)).command(()=>Z3(s,p)).command(()=>eD(s,p)).run()}return!n||!N||!l?c().command(()=>d().wrapInList(p,r)?!0:u.clearNodes()).wrapInList(p,r).command(()=>Z3(s,p)).command(()=>eD(s,p)).run():c().command(()=>{const _=d().wrapInList(p,r),j=N.filter(A=>h.includes(A.type.name));return s.ensureMarks(j),_?!0:u.clearNodes()}).wrapInList(p,r).command(()=>Z3(s,p)).command(()=>eD(s,p)).run()},zzt=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=n,a=Kd(t,r.schema);return VF(r,a,e)?i.unsetMark(a,{extendEmptyMarkRange:s}):i.setMark(a,e)},Bzt=(t,e,n={})=>({state:r,commands:i})=>{const s=Di(t,r.schema),a=Di(e,r.schema),l=Vh(r,s,n);let c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),l?i.setNode(a,c):i.setNode(s,{...c,...n})},Vzt=(t,e={})=>({state:n,commands:r})=>{const i=Di(t,n.schema);return Vh(n,i,e)?r.lift(i):r.wrapIn(i,e)},Hzt=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let s;if(i.spec.isInputRules&&(s=i.getState(t))){if(e){const a=t.tr,l=s.transform;for(let c=l.steps.length-1;c>=0;c-=1)a.step(l.steps[c].invert(l.docs[c]));if(s.text){const c=a.doc.resolve(s.from).marks();a.replaceWith(s.from,s.to,t.schema.text(s.text,c))}else a.delete(s.from,s.to)}return!0}}return!1},Wzt=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:i}=n;return r||e&&i.forEach(s=>{t.removeMark(s.$from.pos,s.$to.pos)}),!0},Gzt=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:a=!1}=e,{selection:l}=n,c=Kd(t,r.schema),{$from:u,empty:d,ranges:f}=l;if(!i)return!0;if(d&&a){let{from:h,to:p}=l;const m=(s=u.marks().find(y=>y.type===c))==null?void 0:s.attrs,x=O9(u,c,m);x&&(h=x.from,p=x.to),n.removeMark(h,p,c)}else f.forEach(h=>{n.removeMark(h.$from.pos,h.$to.pos,c)});return n.removeStoredMark(c),!0},qzt=t=>({tr:e,state:n,dispatch:r})=>{const{selection:i}=n;let s,a;return typeof t=="number"?(s=t,a=t):t&&"from"in t&&"to"in t?(s=t.from,a=t.to):(s=i.from,a=i.to),r&&e.doc.nodesBetween(s,a,(l,c)=>{if(l.isText)return;const u={...l.attrs};delete u.dir,e.setNodeMarkup(c,void 0,u)}),!0},Kzt=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let s=null,a=null;const l=xO(typeof t=="string"?t:t.name,r.schema);if(!l)return!1;l==="node"&&(s=Di(t,r.schema)),l==="mark"&&(a=Kd(t,r.schema));let c=!1;return n.selection.ranges.forEach(u=>{const d=u.$from.pos,f=u.$to.pos;let h,p,m,x;n.selection.empty?r.doc.nodesBetween(d,f,(y,g)=>{s&&s===y.type&&(c=!0,m=Math.max(g,d),x=Math.min(g+y.nodeSize,f),h=g,p=y)}):r.doc.nodesBetween(d,f,(y,g)=>{g<d&&s&&s===y.type&&(c=!0,m=Math.max(g,d),x=Math.min(g+y.nodeSize,f),h=g,p=y),g>=d&&g<=f&&(s&&s===y.type&&(c=!0,i&&n.setNodeMarkup(g,void 0,{...y.attrs,...e})),a&&y.marks.length&&y.marks.forEach(w=>{if(a===w.type&&(c=!0,i)){const v=Math.max(g,d),N=Math.min(g+y.nodeSize,f);n.addMark(v,N,a.create({...w.attrs,...e}))}}))}),p&&(h!==void 0&&i&&n.setNodeMarkup(h,void 0,{...p.attrs,...e}),a&&p.marks.length&&p.marks.forEach(y=>{a===y.type&&i&&n.addMark(m,x,a.create({...y.attrs,...e}))}))}),c},Yzt=(t,e={})=>({state:n,dispatch:r})=>{const i=Di(t,n.schema);return S5t(i,e)(n,r)},Xzt=(t,e={})=>({state:n,dispatch:r})=>{const i=Di(t,n.schema);return N5t(i,e)(n,r)},Qzt=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},bO=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},Jzt=(t,e)=>{if(P9(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function yC(t){var e;const{editor:n,from:r,to:i,text:s,rules:a,plugin:l}=t,{view:c}=n;if(c.composing)return!1;const u=c.state.doc.resolve(r);if(u.parent.type.spec.code||(e=u.nodeBefore||u.nodeAfter)!=null&&e.marks.find(h=>h.type.spec.code))return!1;let d=!1;const f=Nzt(u)+s;return a.forEach(h=>{if(d)return;const p=Jzt(f,h.find);if(!p)return;const m=c.state.tr,x=mO({state:c.state,transaction:m}),y={from:r-(p[0].length-s.length),to:i},{commands:g,chain:w,can:v}=new gO({editor:n,state:x});h.handler({state:x,range:y,match:p,commands:g,chain:w,can:v})===null||!m.steps.length||(h.undoable&&m.setMeta(l,{transform:m,from:r,to:i,text:s}),c.dispatch(m),d=!0)}),d}function Zzt(t){const{editor:e,rules:n}=t,r=new si({state:{init(){return null},apply(i,s,a){const l=i.getMeta(r);if(l)return l;const c=i.getMeta("applyInputRules");return!!c&&setTimeout(()=>{let{text:d}=c;typeof d=="string"?d=d:d=I9(Ke.from(d),a.schema);const{from:f}=c,h=f+d.length;yC({editor:e,from:f,to:h,text:d,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,a,l){return yC({editor:e,from:s,to:a,text:l,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&yC({editor:e,from:s.pos,to:s.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:a}=i.state.selection;return a?yC({editor:e,from:a.pos,to:a.pos,text:`
4989`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function e6t(t){return Object.prototype.toString.call(t).slice(8,-1)}function vC(t){return e6t(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function wwe(t,e){const n={...t};return vC(t)&&vC(e)&&Object.keys(e).forEach(r=>{vC(e[r])&&vC(t[r])?n[r]=wwe(t[r],e[r]):n[r]=e[r]}),n}var L9=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...Zn(It(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Zn(It(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>wwe(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},Hg=class _we extends L9{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new _we(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const a=i.marks();if(!!!a.find(u=>(u==null?void 0:u.type.name)===n.name))return!1;const c=a.find(u=>(u==null?void 0:u.type.name)===n.name);return c&&r.removeStoredMark(c),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function t6t(t){return typeof t=="number"}var n6t=class{constructor(t){this.find=t.find,this.handler=t.handler}},r6t=(t,e,n)=>{if(P9(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(i=>{const s=[i.text];return s.index=i.index,s.input=t,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function i6t(t){const{editor:e,state:n,from:r,to:i,rule:s,pasteEvent:a,dropEvent:l}=t,{commands:c,chain:u,can:d}=new gO({editor:e,state:n}),f=[];return n.doc.nodesBetween(r,i,(p,m)=>{var x,y,g,w,v;if((y=(x=p.type)==null?void 0:x.spec)!=null&&y.code||!(p.isText||p.isTextblock||p.isInline))return;const N=(v=(w=(g=p.content)==null?void 0:g.size)!=null?w:p.nodeSize)!=null?v:0,S=Math.max(r,m),_=Math.min(i,m+N);if(S>=_)return;const j=p.isText?p.text||"":p.textBetween(S-m,_-m,void 0,"");r6t(j,s.find,a).forEach(C=>{if(C.index===void 0)return;const k=S+C.index+1,M=k+C[0].length,I={from:n.tr.mapping.map(k),to:n.tr.mapping.map(M)},R=s.handler({state:n,range:I,match:C,commands:c,chain:u,can:d,pasteEvent:a,dropEvent:l});f.push(R)})}),f.every(p=>p!==null)}var bC=null,s6t=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function a6t(t){const{editor:e,rules:n}=t;let r=null,i=!1,s=!1,a=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const c=({state:d,from:f,to:h,rule:p,pasteEvt:m})=>{const x=d.tr,y=mO({state:d,transaction:x});if(!(!i6t({editor:e,state:y,from:Math.max(f-1,0),to:h.b-1,rule:p,pasteEvent:m,dropEvent:l})||!x.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return a=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,x}};return n.map(d=>new si({view(f){const h=m=>{var x;r=(x=f.dom.parentElement)!=null&&x.contains(m.target)?f.dom.parentElement:null,r&&(bC=e)},p=()=>{bC&&(bC=null)};return window.addEventListener("dragstart",h),window.addEventListener("dragend",p),{destroy(){window.removeEventListener("dragstart",h),window.removeEventListener("dragend",p)}}},props:{handleDOMEvents:{drop:(f,h)=>{if(s=r===f.dom.parentElement,l=h,!s){const p=bC;p!=null&&p.isEditable&&setTimeout(()=>{const m=p.state.selection;m&&p.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(f,h)=>{var p;const m=(p=h.clipboardData)==null?void 0:p.getData("text/html");return a=h,i=!!(m!=null&&m.includes("data-pm-slice")),!1}}},appendTransaction:(f,h,p)=>{const m=f[0],x=m.getMeta("uiEvent")==="paste"&&!i,y=m.getMeta("uiEvent")==="drop"&&!s,g=m.getMeta("applyPasteRules"),w=!!g;if(!x&&!y&&!w)return;if(w){let{text:S}=g;typeof S=="string"?S=S:S=I9(Ke.from(S),p.schema);const{from:_}=g,j=_+S.length,A=s6t(S);return c({rule:d,state:p,from:_,to:{b:j},pasteEvt:A})}const v=h.doc.content.findDiffStart(p.doc.content),N=h.doc.content.findDiffEnd(p.doc.content);if(!(!t6t(v)||!N||v===N.b))return c({rule:d,state:p,from:v,to:N,pasteEvt:a})}}))}var wO=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=hwe(t),this.schema=xzt(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:xC(e.name,this.schema)},r=It(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return yA([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:xC(r.name,this.schema)},s=[],a=It(r,"addKeyboardShortcuts",i);let l={};if(r.type==="mark"&&It(r,"exitable",i)&&(l.ArrowRight=()=>Hg.handleExit({editor:t,mark:r})),a){const h=Object.fromEntries(Object.entries(a()).map(([p,m])=>[p,()=>m({editor:t})]));l={...l,...h}}const c=bUt(l);s.push(c);const u=It(r,"addInputRules",i);if(bte(r,t.options.enableInputRules)&&u){const h=u();if(h&&h.length){const p=Zzt({editor:t,rules:h}),m=Array.isArray(p)?p:[p];s.push(...m)}}const d=It(r,"addPasteRules",i);if(bte(r,t.options.enablePasteRules)&&d){const h=d();if(h&&h.length){const p=a6t({editor:t,rules:h});s.push(...p)}}const f=It(r,"addProseMirrorPlugins",i);if(f){const h=f();s.push(...h)}return s})}get attributes(){return fwe(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=m0(this.extensions);return Object.fromEntries(e.filter(n=>!!It(n,"addNodeView")).map(n=>{const r=this.attributes.filter(c=>c.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Di(n.name,this.schema)},s=It(n,"addNodeView",i);if(!s)return[];const a=s();if(!a)return[];const l=(c,u,d,f,h)=>{const p=lS(c,r);return a({node:c,view:u,getPos:d,decorations:f,innerDecorations:h,editor:t,extension:n,HTMLAttributes:p})};return[n.name,l]}))}dispatchTransaction(t){const{editor:e}=this;return yA([...this.extensions].reverse()).reduceRight((r,i)=>{const s={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:xC(i.name,this.schema)},a=It(i,"dispatchTransaction",s);return a?l=>{a.call(s,{transaction:l,next:r})}:r},t)}get markViews(){const{editor:t}=this,{markExtensions:e}=m0(this.extensions);return Object.fromEntries(e.filter(n=>!!It(n,"addMarkView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Kd(n.name,this.schema)},s=It(n,"addMarkView",i);if(!s)return[];const a=(l,c,u)=>{const d=lS(l,r);return s()({mark:l,view:c,inline:u,editor:t,extension:n,HTMLAttributes:d,updateAttributes:f=>{b6t(l,t,f)}})};return[n.name,a]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:xC(e.name,this.schema)};e.type==="mark"&&((n=Zn(It(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const i=It(e,"onBeforeCreate",r),s=It(e,"onCreate",r),a=It(e,"onUpdate",r),l=It(e,"onSelectionUpdate",r),c=It(e,"onTransaction",r),u=It(e,"onFocus",r),d=It(e,"onBlur",r),f=It(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),a&&this.editor.on("update",a),l&&this.editor.on("selectionUpdate",l),c&&this.editor.on("transaction",c),u&&this.editor.on("focus",u),d&&this.editor.on("blur",d),f&&this.editor.on("destroy",f)})}};wO.resolve=hwe;wO.sort=yA;wO.flatten=R9;var o6t={};M9(o6t,{ClipboardTextSerializer:()=>Nwe,Commands:()=>jwe,Delete:()=>Cwe,Drop:()=>kwe,Editable:()=>Ewe,FocusEvents:()=>Twe,Keymap:()=>Mwe,Paste:()=>Pwe,Tabindex:()=>Owe,TextDirection:()=>Rwe,focusEventsPluginKey:()=>Awe});var bi=class Swe extends L9{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new Swe(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},Nwe=bi.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new si({key:new ss("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,{ranges:s}=i,a=Math.min(...s.map(d=>d.$from.pos)),l=Math.max(...s.map(d=>d.$to.pos)),c=mwe(n);return pwe(r,{from:a,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:c})}}})]}}),jwe=bi.create({name:"commands",addCommands(){return{...rwe}}}),Cwe=bi.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,i;const s=()=>{var a,l,c,u;if((u=(c=(l=(a=this.editor.options.coreExtensionOptions)==null?void 0:a.delete)==null?void 0:l.filterTransaction)==null?void 0:c.call(l,t))!=null?u:t.getMeta("y-sync$"))return;const d=uwe(t.before,[t,...e]);xwe(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,x)=>{const y=x+m.nodeSize-2,g=p.oldRange.from<=x&&y<=p.oldRange.to;this.editor.emit("delete",{type:"node",node:m,from:x,to:y,newFrom:d.mapping.map(x),newTo:d.mapping.map(y),deletedRange:p.oldRange,newRange:p.newRange,partial:!g,editor:this.editor,transaction:t,combinedTransform:d})})});const h=d.mapping;d.steps.forEach((p,m)=>{var x,y;if(p instanceof ic){const g=h.slice(m).map(p.from,-1),w=h.slice(m).map(p.to),v=h.invert().map(g,-1),N=h.invert().map(w),S=(x=d.doc.nodeAt(g-1))==null?void 0:x.marks.some(j=>j.eq(p.mark)),_=(y=d.doc.nodeAt(w))==null?void 0:y.marks.some(j=>j.eq(p.mark));this.editor.emit("delete",{type:"mark",mark:p.mark,from:p.from,to:p.to,deletedRange:{from:v,to:N},newRange:{from:g,to:w},partial:!!(_||S),editor:this.editor,transaction:t,combinedTransform:d})}})};(i=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||i?setTimeout(s,0):s()}}),kwe=bi.create({name:"drop",addProseMirrorPlugins(){return[new si({key:new ss("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),Ewe=bi.create({name:"editable",addProseMirrorPlugins(){return[new si({key:new ss("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Awe=new ss("focusEvents"),Twe=bi.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new si({key:Awe,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),Mwe=bi.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:a})=>[()=>a.undoInputRule(),()=>a.command(({tr:l})=>{const{selection:c,doc:u}=l,{empty:d,$anchor:f}=c,{pos:h,parent:p}=f,m=f.parent.isTextblock&&h>0?l.doc.resolve(h-1):f,x=m.parent.type.spec.isolating,y=f.pos-f.parentOffset,g=x&&m.parent.childCount===1?y===f.pos:Nn.atStart(u).from===h;return!d||!p.type.isTextblock||p.textContent.length||!g||g&&f.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:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},s={...r,"Ctrl-h":t,"Alt-Backspace":t,"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 xA()||lwe()?s:i},addProseMirrorPlugins(){return[new si({key:new ss("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(x=>x.getMeta("composition")))return;const r=t.some(x=>x.docChanged)&&!e.doc.eq(n.doc),i=t.some(x=>x.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:a,to:l}=e.selection,c=Nn.atStart(e.doc).from,u=Nn.atEnd(e.doc).to;if(s||!(a===c&&l===u)||!vO(n.doc))return;const h=n.tr,p=mO({state:n,transaction:h}),{commands:m}=new gO({editor:this.editor,state:p});if(m.clearNodes(),!!h.steps.length)return h}})]}}),Pwe=bi.create({name:"paste",addProseMirrorPlugins(){return[new si({key:new ss("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),Owe=bi.create({name:"tabindex",addProseMirrorPlugins(){return[new si({key:new ss("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),Rwe=bi.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=m0(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new si({key:new ss("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),l6t=class Wx{constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=i}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 n=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}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,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),n=this.resolvedPos.doc.resolve(e);return new Wx(n,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 Wx(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 Wx(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const i=n.isBlock&&!n.isTextblock,s=n.isAtom&&!n.isText,a=this.pos+r+(s?0:1);if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(a);if(!i&&l.depth<=this.depth)return;const c=new Wx(l,this.editor,i,i?n:null);i&&(c.actualDepth=this.depth+1),e.push(new Wx(l,this.editor,i,i?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){const s=i.node.attrs,a=Object.keys(n);for(let l=0;l<a.length;l+=1){const c=a[l];if(s[c]!==n[c])break}}else r=i;i=i.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(n);return this.children.forEach(a=>{r&&i.length>0||(a.node.type.name===e&&s.every(c=>n[c]===a.node.attrs[c])&&i.push(a),!(r&&i.length>0)&&(i=i.concat(a.querySelectorAll(e,n,r))))}),i}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},c6t=`.ProseMirror {
4990  position: relative;
4991}
4992
4993.ProseMirror {
4994  word-wrap: break-word;
4995  white-space: pre-wrap;
4996  white-space: break-spaces;
4997  -webkit-font-variant-ligatures: none;
4998  font-variant-ligatures: none;
4999  font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
5000}
5001
5002.ProseMirror [contenteditable="false"] {
5003  white-space: normal;
5004}
5005
5006.ProseMirror [contenteditable="false"] [contenteditable="true"] {
5007  white-space: pre-wrap;
5008}
5009
5010.ProseMirror pre {
5011  white-space: pre-wrap;
5012}
5013
5014img.ProseMirror-separator {
5015  display: inline !important;
5016  border: none !important;
5017  margin: 0 !important;
5018  width: 0 !important;
5019  height: 0 !important;
5020}
5021
5022.ProseMirror-gapcursor {
5023  display: none;
5024  pointer-events: none;
5025  position: absolute;
5026  margin: 0;
5027}
5028
5029.ProseMirror-gapcursor:after {
5030  content: "";
5031  display: block;
5032  position: absolute;
5033  top: -2px;
5034  width: 20px;
5035  border-top: 1px solid black;
5036  animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
5037}
5038
5039@keyframes ProseMirror-cursor-blink {
5040  to {
5041    visibility: hidden;
5042  }
5043}
5044
5045.ProseMirror-hideselection *::selection {
5046  background: transparent;
5047}
5048
5049.ProseMirror-hideselection *::-moz-selection {
5050  background: transparent;
5051}
5052
5053.ProseMirror-hideselection * {
5054  caret-color: transparent;
5055}
5056
5057.ProseMirror-focused .ProseMirror-gapcursor {
5058  display: block;
5059}`;function u6t(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(i),i}var d6t=class extends Qzt{constructor(t={}){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,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:Ezt,createMappablePosition:Azt},this.setOptions(t),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:i,moved:s})=>this.options.onDrop(r,i,s)),this.on("paste",({event:r,slice:i})=>this.options.onPaste(r,i)),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=awe(e,this.options.autofocus);this.editorState=gy.create({doc:e,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){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(t),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 t=this.editorView.dom;t!=null&&t.editor&&delete t.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(t){console.warn("Failed to remove CSS element:",t)}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=u6t(c6t,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),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:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,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(t,e){const n=dwe(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(i=>{const s=typeof i=="string"?`${i}$`:i.key;n=n.filter(a=>!a.key.startsWith(s))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e;const r=[...this.options.enableCoreExtensions?[Ewe,Nwe.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),jwe,Twe,Mwe,Owe,kwe,Pwe,Cwe,Rwe.configure({direction:this.options.textDirection})].filter(i=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[i.name]!==!1:!0):[],...this.options.extensions].filter(i=>["extension","node","mark"].includes(i==null?void 0:i.type));this.extensionManager=new wO(r,this)}createCommandManager(){this.commandManager=new gO({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=BF(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(n=>n.name!=="collaboration"),this.createExtensionManager()}}),t=BF(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r;this.editorView=new twe(t,{...e,attributes:{role:"textbox",...e==null?void 0:e.attributes},dispatchTransaction:i,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const s=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(s),this.prependClass(),this.injectCSS();const a=this.view.dom;a.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(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(u=>{var d;return(d=this.capturedTransaction)==null?void 0:d.step(u)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),i=n.includes(t),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!i)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const a=n.findLast(u=>u.getMeta("focus")||u.getMeta("blur")),l=a==null?void 0:a.getMeta("focus"),c=a==null?void 0:a.getMeta("blur");l&&this.emit("focus",{editor:this,event:l.event,transaction:a}),c&&this.emit("blur",{editor:this,event:c.event,transaction:a}),!(t.getMeta("preventUpdate")||!n.some(u=>u.docChanged)||s.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return gwe(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return jzt(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return I9(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
5060
5061`,textSerializers:n={}}=t||{};return vzt(this.state.doc,{blockSeparator:e,textSerializers:{...mwe(this.schema),...n}})}get isEmpty(){return vO(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new l6t(e,this)}get $doc(){return this.$pos(0)}};function g0(t){return new bO({find:t.find,handler:({state:e,range:n,match:r})=>{const i=Zn(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,a=r[r.length-1],l=r[0];if(a){const c=l.search(/\S/),u=n.from+l.indexOf(a),d=u+a.length;if(D9(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(x=>x===t.type&&x!==p.mark.type)).filter(p=>p.to>u).length)return null;d<n.to&&s.delete(d,n.to),u>n.from&&s.delete(n.from+c,u);const h=n.from+c+a.length;s.addMark(n.from+c,h,t.type.create(i||{})),s.removeStoredMark(t.type)}},undoable:t.undoable})}function f6t(t){return new bO({find:t.find,handler:({state:e,range:n,match:r})=>{const i=Zn(t.getAttributes,void 0,r)||{},{tr:s}=e,a=n.from;let l=n.to;const c=t.type.create(i);if(r[1]){const u=r[0].lastIndexOf(r[1]);let d=a+u;d>l?d=l:l=d+r[1].length;const f=r[0][r[0].length-1];s.insertText(f,a+r[0].length-1),s.replaceWith(d,l,c)}else if(r[0]){const u=t.type.isInline?a:a-1;s.insert(u,t.type.create(i)).delete(s.mapping.map(a),s.mapping.map(l))}s.scrollIntoView()},undoable:t.undoable})}function HF(t){return new bO({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),s=Zn(t.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,s)},undoable:t.undoable})}function x0(t){return new bO({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const s=Zn(t.getAttributes,void 0,r)||{},a=e.tr.delete(n.from,n.to),c=a.doc.resolve(n.from).blockRange(),u=c&&m9(c,t.type,s);if(!u)return null;if(a.wrap(c,u),t.keepMarks&&t.editor){const{selection:f,storedMarks:h}=e,{splittableMarks:p}=t.editor.extensionManager,m=h||f.$to.parentOffset&&f.$from.marks();if(m){const x=m.filter(y=>p.includes(y.type.name));a.ensureMarks(x)}}if(t.keepAttributes){const f=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(f,s).run()}const d=a.doc.resolve(n.from-1).nodeBefore;d&&d.type===t.type&&lp(a.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,d))&&a.join(n.from-1)},undoable:t.undoable})}function h6t(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof Wt){const s=r.index();return r.parent.canReplaceWith(s,s+1,e)}let i=r.depth;for(;i>=0;){const s=r.index(i);if(r.node(i).contentMatchAt(s).matchType(e))return!0;i-=1}return!1}var p6t={};M9(p6t,{createAtomBlockMarkdownSpec:()=>m6t,createBlockMarkdownSpec:()=>g6t,createInlineMarkdownSpec:()=>v6t,parseAttributes:()=>$9,parseIndentedBlocks:()=>WF,renderNestedMarkdownContent:()=>U9,serializeAttributes:()=>F9});function $9(t){if(!(t!=null&&t.trim()))return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,u=>(n.push(u),`__QUOTED_${n.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(i){const u=i.map(d=>d.trim().slice(1));e.class=u.join(" ")}const s=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);s&&(e.id=s[1]);const a=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(a)).forEach(([,u,d])=>{var f;const h=parseInt(((f=d.match(/__QUOTED_(\d+)__/))==null?void 0:f[1])||"0",10),p=n[h];p&&(e[u]=p.slice(1,-1))});const c=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 c&&c.split(/\s+/).filter(Boolean).forEach(d=>{d.match(/^[a-zA-Z][\w-]*$/)&&(e[d]=!0)}),e}function F9(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?e.push(n):r!==!1&&r!=null&&e.push(`${n}="${String(r)}"`))}),e.join(" ")}function m6t(t){const{nodeName:e,name:n,parseAttributes:r=$9,serializeAttributes:i=F9,defaultAttributes:s={},requiredAttributes:a=[],allowedAttributes:l}=t,c=n||e,u=d=>{if(!l)return d;const f={};return l.forEach(h=>{h in d&&(f[h]=d[h])}),f};return{parseMarkdown:(d,f)=>{const h={...s,...d.attributes};return f.createNode(e,h,[])},markdownTokenizer:{name:e,level:"block",start(d){var f;const h=new RegExp(`^:::${c}(?:\\s|$)`,"m"),p=(f=d.match(h))==null?void 0:f.index;return p!==void 0?p:-1},tokenize(d,f,h){const p=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),m=d.match(p);if(!m)return;const x=m[1]||"",y=r(x);if(!a.find(w=>!(w in y)))return{type:e,raw:m[0],attributes:y}}},renderMarkdown:d=>{const f=u(d.attrs||{}),h=i(f),p=h?` {${h}}`:"";return`:::${c}${p} :::`}}}function g6t(t){const{nodeName:e,name:n,getContent:r,parseAttributes:i=$9,serializeAttributes:s=F9,defaultAttributes:a={},content:l="block",allowedAttributes:c}=t,u=n||e,d=f=>{if(!c)return f;const h={};return c.forEach(p=>{p in f&&(h[p]=f[p])}),h};return{parseMarkdown:(f,h)=>{let p;if(r){const x=r(f);p=typeof x=="string"?[{type:"text",text:x}]:x}else l==="block"?p=h.parseChildren(f.tokens||[]):p=h.parseInline(f.tokens||[]);const m={...a,...f.attributes};return h.createNode(e,m,p)},markdownTokenizer:{name:e,level:"block",start(f){var h;const p=new RegExp(`^:::${u}`,"m"),m=(h=f.match(p))==null?void 0:h.index;return m!==void 0?m:-1},tokenize(f,h,p){var m;const x=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),y=f.match(x);if(!y)return;const[g,w=""]=y,v=i(w);let N=1;const S=g.length;let _="";const j=/^:::([\w-]*)(\s.*)?/gm,A=f.slice(S);for(j.lastIndex=0;;){const C=j.exec(A);if(C===null)break;const k=C.index,M=C[1];if(!((m=C[2])!=null&&m.endsWith(":::"))){if(M)N+=1;else if(N-=1,N===0){const I=A.slice(0,k);_=I.trim();const R=f.slice(0,S+k+C[0].length);let E=[];if(_)if(l==="block")for(E=p.blockTokens(I),E.forEach(P=>{P.text&&(!P.tokens||P.tokens.length===0)&&(P.tokens=p.inlineTokens(P.text))});E.length>0;){const P=E[E.length-1];if(P.type==="paragraph"&&(!P.text||P.text.trim()===""))E.pop();else break}else E=p.inlineTokens(_);return{type:e,raw:R,attributes:v,content:_,tokens:E}}}}}},renderMarkdown:(f,h)=>{const p=d(f.attrs||{}),m=s(p),x=m?` {${m}}`:"",y=h.renderChildren(f.content||[],`
5062
5063`);return`:::${u}${x}
5064
5065${y}
5066
5067:::`}}}function x6t(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,i,s,a]=r;e[i]=s||a,r=n.exec(t)}return e}function y6t(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function v6t(t){const{nodeName:e,name:n,getContent:r,parseAttributes:i=x6t,serializeAttributes:s=y6t,defaultAttributes:a={},selfClosing:l=!1,allowedAttributes:c}=t,u=n||e,d=h=>{if(!c)return h;const p={};return c.forEach(m=>{const x=typeof m=="string"?m:m.name,y=typeof m=="string"?void 0:m.skipIfDefault;if(x in h){const g=h[x];if(y!==void 0&&g===y)return;p[x]=g}}),p},f=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(h,p)=>{const m={...a,...h.attributes};if(l)return p.createNode(e,m);const x=r?r(h):h.content||"";return x?p.createNode(e,m,[p.createTextNode(x)]):p.createNode(e,m,[])},markdownTokenizer:{name:e,level:"inline",start(h){const p=l?new RegExp(`\\[${f}\\s*[^\\]]*\\]`):new RegExp(`\\[${f}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${f}\\]`),m=h.match(p),x=m==null?void 0:m.index;return x!==void 0?x:-1},tokenize(h,p,m){const x=l?new RegExp(`^\\[${f}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${f}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${f}\\]`),y=h.match(x);if(!y)return;let g="",w="";if(l){const[,N]=y;w=N}else{const[,N,S]=y;w=N,g=S||""}const v=i(w.trim());return{type:e,raw:y[0],content:g.trim(),attributes:v}}},renderMarkdown:h=>{let p="";r?p=r(h):h.content&&h.content.length>0&&(p=h.content.filter(g=>g.type==="text").map(g=>g.text).join(""));const m=d(h.attrs||{}),x=s(m),y=x?` ${x}`:"";return l?`[${u}${y}]`:`[${u}${y}]${p}[/${u}]`}}
5067}function WF(t,e,n){var r,i,s,a;const l=t.split(`
5068`),c=[];let u="",d=0;const f=e.baseIndentSize||2;for(;d<l.length;){const h=l[d],p=h.match(e.itemPattern);if(!p){if(c.length>0)break;if(h.trim()===""){d+=1,u=`${u}${h}
5069`;continue}else return}const m=e.extractItemData(p),{indentLevel:x,mainContent:y}=m;u=`${u}${h}
5070`;const g=[y];for(d+=1;d<l.length;){const S=l[d];if(S.trim()===""){const j=l.slice(d+1).findIndex(k=>k.trim()!=="");if(j===-1)break;if((((i=(r=l[d+1+j].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:i.length)||0)>x){g.push(S),u=`${u}${S}
5071`,d+=1;continue}else break}if((((a=(s=S.match(/^(\s*)/))==null?void 0:s[1])==null?void 0:a.length)||0)>x)g.push(S),u=`${u}${S}
5072`,d+=1;else break}let w;const v=g.slice(1);if(v.length>0){const S=v.map(_=>_.slice(x+f)).join(`
5073`);S.trim()&&(e.customNestedParser?w=e.customNestedParser(S):w=n.blockTokens(S))}const N=e.createToken(m,w);c.push(N)}if(c.length!==0)return{items:c,raw:u}}function U9(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const i=typeof n=="function"?n(r):n,[s,...a]=t.content,l=e.renderChildren([s]),c=[`${i}${l}`];return a&&a.length>0&&a.forEach(u=>{const d=e.renderChildren([u]);if(d){const f=d.split(`
5074`).map(h=>h?e.indent(h):"").join(`
5075`);c.push(f)}}),c.join(`
5076`)}function b6t(t,e,n={}){const{state:r}=e,{doc:i,tr:s}=r,a=t;i.descendants((l,c)=>{const u=s.mapping.map(c),d=s.mapping.map(c)+l.nodeSize;let f=null;if(l.marks.forEach(p=>{if(p!==a)return!1;f=p}),!f)return;let h=!1;if(Object.keys(n).forEach(p=>{n[p]!==f.attrs[p]&&(h=!0)}),h){const p=t.type.create({...t.attrs,...n});s.removeMark(u,d,t.type),s.addMark(u,d,p)}}),s.docChanged&&e.view.dispatch(s)}var Fo=class Iwe extends L9{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new Iwe(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function xg(t){return new n6t({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const s=Zn(t.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:a}=e,l=r[r.length-1],c=r[0];let u=n.to;if(l){const d=c.search(/\S/),f=n.from+c.indexOf(l),h=f+l.length;if(D9(n.from,n.to,e.doc).filter(m=>m.mark.type.excluded.find(y=>y===t.type&&y!==m.mark.type)).filter(m=>m.to>f).length)return null;h<n.to&&a.delete(h,n.to),f>n.from&&a.delete(n.from+d,f),u=n.from+d+l.length,a.addMark(n.from+d,u,t.type.create(s||{})),a.removeStoredMark(t.type)}}})}var w6t=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},_6t=({contentComponent:t})=>{const e=hT.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return o.jsx(o.Fragment,{children:Object.values(e)})};function S6t(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:JU.createPortal(r.reactElement,r.element,n)},t.forEach(i=>i())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(i=>i())}}}var N6t=class extends te.Component{constructor(t){var e;super(t),this.editorContentRef=te.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=t.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&((t=e.view.dom)!=null&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=S6t(),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 t;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(!((t=e.view.dom)!=null&&t.parentNode))return;const n=document.createElement("div");n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return o.jsxs(o.Fragment,{children:[o.jsx("div",{ref:w6t(e,this.editorContentRef),...n}),(t==null?void 0:t.contentComponent)&&o.jsx(_6t,{contentComponent:t.contentComponent})]})}},j6t=b.forwardRef((t,e)=>{const n=te.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return te.createElement(N6t,{key:n,innerRef:e,...t})}),Dwe=te.memo(j6t),C6t=typeof window<"u"?b.useLayoutEffect:b.useEffect,k6t=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0}
5076,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(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",e),()=>{n.off("transaction",e)}}}};function E6t(t){var e;const[n]=b.useState(()=>new k6t(t.editor)),r=Die.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:rfe);return C6t(()=>n.watch(t.editor),[t.editor,n]),b.useDebugValue(r),r}var A6t=!1,GF=typeof window>"u",T6t=GF||!!(typeof window<"u"&&window.next),M6t=class Lwe{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(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?GF||T6t?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var i,s;return(s=(i=this.options.current).onBeforeCreate)==null?void 0:s.call(i,...r)},onBlur:(...r)=>{var i,s;return(s=(i=this.options.current).onBlur)==null?void 0:s.call(i,...r)},onCreate:(...r)=>{var i,s;return(s=(i=this.options.current).onCreate)==null?void 0:s.call(i,...r)},onDestroy:(...r)=>{var i,s;return(s=(i=this.options.current).onDestroy)==null?void 0:s.call(i,...r)},onFocus:(...r)=>{var i,s;return(s=(i=this.options.current).onFocus)==null?void 0:s.call(i,...r)},onSelectionUpdate:(...r)=>{var i,s;return(s=(i=this.options.current).onSelectionUpdate)==null?void 0:s.call(i,...r)},onTransaction:(...r)=>{var i,s;return(s=(i=this.options.current).onTransaction)==null?void 0:s.call(i,...r)},onUpdate:(...r)=>{var i,s;return(s=(i=this.options.current).onUpdate)==null?void 0:s.call(i,...r)},onContentError:(...r)=>{var i,s;return(s=(i=this.options.current).onContentError)==null?void 0:s.call(i,...r)},onDrop:(...r)=>{var i,s;return(s=(i=this.options.current).onDrop)==null?void 0:s.call(i,...r)},onPaste:(...r)=>{var i,s;return(s=(i=this.options.current).onPaste)==null?void 0:s.call(i,...r)},onDelete:(...r)=>{var i,s;return(s=(i=this.options.current).onDelete)==null?void 0:s.call(i,...r)}};return new d6t(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((i,s)=>{var a;return i===((a=n.extensions)==null?void 0:a[s])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?Lwe.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}
5076):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,i)=>r===e[i]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function $we(t={},e=[]){const n=b.useRef(t);n.current=t;const[r]=b.useState(()=>new M6t(n)),i=hT.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return b.useDebugValue(i),b.useEffect(r.onRender(e)),E6t({editor:i,selector:({transactionNumber:s})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&s===0?0:s+1}),i}var P6t=b.createContext({editor:null});P6t.Consumer;var O6t=b.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),R6t=()=>b.useContext(O6t);te.forwardRef((t,e)=>{const{onDragStart:n}=R6t(),r=t.as||"div";return o.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});te.createContext({markViewContentRef:()=>{}});var vA=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]},I6t=/^\s*>\s$/,D6t=Fo.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return vA("blockquote",{...Li(this.options.HTMLAttributes,t),children:vA("slot",{})})},parseMarkdown:(t,e)=>e.createNode("blockquote",void 0,e.parseChildren(t.tokens||[])),renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach(i=>{const l=e.renderChildren([i]).split(`
5077`).map(c=>c.trim()===""?n:`${n} ${c}`);r.push(l.join(`
5078`))}),r.join(`
5079${n}
5080`)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[x0({find:I6t,type:this.type})]}}),L6t=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,$6t=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,F6t=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,U6t=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,z6t=Hg.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return vA("strong",{...Li(this.options.HTMLAttributes,t),children:vA("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[g0({find:L6t,type:this.type}),g0({find:F6t,type:this.type})]},addPasteRules(){return[xg({find:$6t,type:this.type}),xg({find:U6t,type:this.type})]}}),B6t=/(^|[^`])`([^`]+)`(?!`)$/,V6t=/(^|[^`])`([^`]+)`(?!`)/g,H6t=Hg.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Li(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>
vendor: 7,314 bytes, lines 5080-5101
5080e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[g0({find:B6t,type:this.type})]},addPasteRules(){return[xg({find:V6t,type:this.type})]}}),tD=4,W6t=/^```([a-z]+)?[\s\n]$/,G6t=/^~~~([a-z]+)?[\s\n]$/,q6t=Fo.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:tD,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;if(!n)return null;const s=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(a=>a.startsWith(n)).map(a=>a.replace(n,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",Li(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n;return((n=t.raw)==null?void 0:n.startsWith("```"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="";const i=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${i}`,e.renderChildren(t.content),"```"].join(`
5081`):r=`\`\`\`${i}
5082
5083\`\`\``,r},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:tD,{state:r}=t,{selection:i}=r,{$from:s,empty:a}=i;if(s.parent.type!==this.type)return!1;const l=" ".repeat(n);return a?t.commands.insertContent(l):t.commands.command(({tr:c})=>{const{from:u,to:d}=i,p=r.doc.textBetween(u,d,`
5084`,`
5085`).split(`
5086`).map(m=>l+m).join(`
5087`);return c.replaceWith(u,d,r.schema.text(p)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:tD,{state:r}=t,{selection:i}=r,{$from:s,empty:a}=i;return s.parent.type!==this.type?!1:a?t.commands.command(({tr:l})=>{var c;const{pos:u}=s,d=s.start(),f=s.end(),p=r.doc.textBetween(d,f,`
5088`,`
5089`).split(`
5090`);let m=0,x=0;const y=u-d;for(let _=0;_<p.length;_+=1){if(x+p[_].length>=y){m=_;break}x+=p[_].length+1}const w=((c=p[m].match(/^ */))==null?void 0:c[0])||"",v=Math.min(w.length,n);if(v===0)return!0;let N=d;for(let _=0;_<m;_+=1)N+=p[_].length+1;return l.delete(N,N+v),u-N<=v&&l.setSelection(rn.create(l.doc,N)),!0}):t.commands.command(({tr:l})=>{const{from:c,to:u}=i,h=r.doc.textBetween(c,u,`
5091`,`
5092`).split(`
5093`).map(p=>{var m;const x=((m=p.match(/^ */))==null?void 0:m[0])||"",y=Math.min(x.length,n);return p.slice(y)}).join(`
5094`);return l.replaceWith(c,u,r.schema.text(h)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,a=r.parent.textContent.endsWith(`
5095
5096`);return!s||!a?!1:t.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:i,empty:s}=n;if(!s||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const l=i.after();return l===void 0?!1:r.nodeAt(l)?t.commands.command(({tr:u})=>(u.setSelection(Nn.near(r.resolve(l))),!0)):t.commands.exitCode()}}},addInputRules(){return[HF({find:W6t,type:this.type,getAttributes:t=>({language:t[1]})}),HF({find:G6t,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new si({key:new ss("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,s=i==null?void 0:i.mode;if(!n||!s)return!1;const{tr:a,schema:l}=t.state,c=l.text(n.replace(/\r\n?/g,`
5097`));return a.replaceSelectionWith(this.type.create({language:s},c)),a.selection.$from.parent.type!==this.type&&a.setSelection(rn.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.setMeta("paste",!0),t.dispatch(a),!0}}})]}}),K6t=Fo.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
5098
5099`):""}),Y6t=Fo.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",Li(this.options.HTMLAttributes,t)]},renderText(){return`
5100`},renderMarkdown:()=>`  
5101`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:i,storedMarks:s}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:a}=this.options,{splittableMarks:l}=r.extensionManager,c=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:u,dispatch:d})=>{if(d&&c&&a){const f=c.filter(h=>l.includes(h.type.name));u.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),X6t=Fo.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(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,Li(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,i="#".repeat(r);return t.content?`${i} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>HF({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}}
5101)\\s$`),type:this.type,getAttributes:{level:t}}))}}),Q6t=Fo.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Li(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!h6t(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,i=t();return ywe(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:s,tr:a,dispatch:l})=>{if(l){const{$to:c}=a.selection,u=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?a.setSelection(rn.create(a.doc,c.pos+1)):c.nodeAfter.isBlock?a.setSelection(Wt.create(a.doc,c.pos)):a.setSelection(rn.create(a.doc,c.pos));else{const d=s.schema.nodes[this.options.nextNodeType]||c.parent.type.contentMatch.defaultType,f=d==null?void 0:d.create();f&&(a.insert(u,f),a.setSelection(rn.create(a.doc,u+1)))}a.scrollIntoView()}return!0}).run()}}},addInputRules(){return[f6t({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.t
vendor: 4,463 bytes, line 5101
5101ype})]}}),J6t=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Z6t=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,eBt=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,tBt=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,nBt=Hg.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",Li(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[g0({find:J6t,type:this.type}),g0({find:eBt,type:this.type})]},addPasteRules(){return[xg({find:Z6t,type:this.type}),xg({find:tBt,type:this.type})]}});const rBt="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2
5101ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",iBt="ελ1υ2бг1ел3дети4ею2католик6ом3мÐ
5101ºÐ´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",qF="numeric",KF="ascii",YF="alpha",u1="asciinumeric",Cw="alphanumeric",XF="domain",Fwe="emoji",sBt="scheme",aBt="slashscheme",nD="whitespace";function oBt(t,e){return t in e||(e[t]=[]),e[t]}function cm(t,e,n){e[qF]&&(e[u1]=!0,e[Cw]=!0),e[KF]&&(e[u1]=!0,e[YF]=!0),e[u1]&&(e[Cw]=!0),e[YF]&&(e[Cw]=!0),e[Cw]&&(e[XF]=!0),e[Fwe]&&(e[XF]=!0);for(const r in e){const i=oBt(r,n);i.indexOf(t)<0&&i.push(t)}}function lBt(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function $a(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}$a.groups={};$a.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const i=e.jr[r][0],s=e.jr[r][1];if(s&&i.test(t))return s}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let i=0;i<t.length;i++)this.tt(t[i],e,n,r)},tr(t,e,n,r){r=r||$a.groups;let i;return e&&e.j?i=e:(i=new $a(e),n&&r&&cm(e,n,r)),this.jr.push([t,i]),i},ts(t,e,n,r){let i=this;const s=t.length;if(!s)return i;for(let a=0;a<s-1;a++)i=i.tt(t[a]);return i.tt(t[s-1],e,n,r)},tt(t,e,n,r){r=r||$a.groups;const i=this;if(e&&e.j)return i.j[t]=e,e;const s=e;let a,l=i.go(t);if(l?(a=new $a,Object.assign(a.j,l.j),a.jr.push.apply(a.jr,l.jr),a.jd=l.jd,a.t=l.t):a=new $a,s){if(r)if(a.t&&typeof a.t=="string"){const c=Object.assign(lBt(a.t,r),n);cm(s,c,r)}else n&&cm(s,n,r);a.t=s}return i.j[t]=a,a}};const vn=(t,e,n,r,i)=>t.ta(e,n,r,i),ai=(t,e,n,r,i)=>t.tr(e,n,r,i),Ste=(t,e,n,r,i)=>t.ts(e,n,r,i),Xe=(t,e,n,r,i)=>t.tt(e,n,r,i),$u="WORD",QF="UWORD",Uwe="ASCIINUMERICAL",zwe="ALPHANUMERICAL",cS="LOCALHOST",JF="TLD",ZF="UTLD",yk="SCHEME",Gx="SLASH_SCHEME",z9="NUM",eU="WS",B9="NL",d1="OPENBRACE",f1="CLOSEBRACE",bA="OPENBRACKET",wA="CLOSEBRACKET",_A="OPENPAREN",SA="CLOSEPAREN",NA="OPENANGLEBRACKET",jA="CLOSEANGLEBRACKET",CA="FULLWIDTHLEFTPAREN",kA="FULLWIDTHRIGHTPAREN",EA="LEFTCORNERBRACKET",AA="RIGHTCORNERBRACKET",TA="LEFTWHITECORNERBRACKET",MA="RIGHTWHITECORNERBRACKET",PA="FULLWIDTHLESSTHAN",OA="FULLWIDTHGREATERTHAN",RA="AMPERSAND",IA="APOSTROPHE",DA="ASTERISK",Sf="AT",LA="BACKSLASH",$A="BACKTICK",FA="CARET",Of="COLON",V9="COMMA",UA="DOLLAR",Ec="DOT",zA="EQUALS",H9="EXCLAMATION",Go="HYPHEN",h1="PERCENT",BA="PIPE",VA="PLUS",HA="POUND",p1="QUERY",W9="QUOTE",Bwe="FULLWIDTHMIDDLEDOT",G9="SEMI",Ac="SLASH",m1="TILDE",WA="UNDERSCORE",Vwe="EMOJI",GA="SYM";var Hwe=Object.freeze({__proto__:null,ALPHANUMERICAL:zwe,AMPERSAND:RA,APOSTROPHE:IA,ASCIINUMERICAL:Uwe,ASTERISK:DA,AT:Sf,BACKSLASH:LA,BACKTICK:$A,CARET:FA,CLOSEANGLEBRACKET:jA,CLOSEBRACE:f1,CLOSEBRACKET:wA,CLOSEPAREN:SA,COLON:Of,COMMA:V9,DOLLAR:UA,DOT:Ec,EMOJI:Vwe,EQUALS:zA,EXCLAMATION:H9,FULLWIDTHGREATERTHAN:OA,FULLWIDTHLEFTPAREN:CA,FULLWIDTHLESSTHAN:PA,FULLWIDTHMIDDLEDOT:Bwe,FULLWIDTHRIGHTPAREN:kA,HYPHEN:Go,LEFTCORNERBRACKET:EA,LEFTWHITECORNERBRACKET:TA,LOCALHOST:cS,NL:B9,NUM:z9,OPENANGLEBRACKET:NA,OPENBRACE:d1,OPENBRACKET:bA,OPENPAREN:_A,PERCENT:h1,PIPE:BA,PLUS:VA,POUND:HA,QUERY:p1,QUOTE:W9,RIGHTCORNERBRACKET:AA,RIGHTWHITECORNERBRACKET:MA,SCHEME:yk,SEMI:G9,SLASH:Ac,SLASH_SCHEME:Gx,SYM:GA,TILDE:m1,TLD:JF,UNDERSCORE:WA,UTLD:ZF,UWORD:QF,WORD:$u,WS:eU});const Ru=/[a-z]/,rw=new RegExp("\\p{L}","u"),rD=new RegExp("\\p{Emoji}
5101","u"),Iu=/\d/,iD=/\s/,Nte="\r",sD=`
5102`,cBt="️",uBt="‍",aD="";let wC=null,_C=null;function dBt(t=[]){const e={};$a.groups=e;const n=new $a;wC==null&&(wC=jte(rBt)),_C==null&&(_C=jte(iBt)),Xe(n,"'",IA),Xe(n,"{",d1),Xe(n,"}",f1),Xe(n,"[",bA),Xe(n,"]",wA),Xe(n,"(",_A),Xe(n,")",SA),Xe(n,"<",NA),Xe(n,">",jA),Xe(n,"(",CA),Xe(n,")",kA),Xe(n,"「",EA),Xe(n,"」",AA),Xe(n,"『",TA),Xe(n,"』",MA),Xe(n,"<",PA),Xe(n,">",OA),Xe(n,"&",RA),Xe(n,"*",DA),Xe(n,"@",Sf),Xe(n,"`",$A),Xe(n,"^",FA),Xe(n,":",Of),Xe(n,",",V9),Xe(n,"$",UA),Xe(n,".",Ec),Xe(n,"=",zA),Xe(n,"!",H9),Xe(n,"-",Go),Xe(n,"%",h1),Xe(n,"|",BA),Xe(n,"+",VA),Xe(n,"#",HA),Xe(n,"?",p1),Xe(n,'"',W9),Xe(n,"/",Ac),Xe(n,";",G9),Xe(n,"~",m1),Xe(n,"_",WA),Xe(n,"\\",LA),Xe(n,"・",Bwe);const r=ai(n,Iu,z9,{[qF]:!0});ai(r,Iu,r);const i=ai(r,Ru,Uwe,{[u1]:!0}),s=ai(r,rw,zwe,{[Cw]:!0}),a=ai(n,Ru,$u,{[KF]:!0});ai(a,Iu,i),ai(a,Ru,a),ai(i,Iu,i),ai(i,Ru,i);const l=ai(n,rw,QF,{[YF]:!0});ai(l,Ru),ai(l,Iu,s),ai(l,rw,l),ai(s,Iu,s),ai(s,Ru),ai(s,rw,s);const c=Xe(n,sD,B9,{[nD]:!0}),u=Xe(n,Nte,eU,{[nD]:!0}),d=ai(n,iD,eU,{[nD]:!0});Xe(n,aD,d),Xe(u,sD,c),Xe(u,aD,d),ai(u,iD,d),Xe(d,Nte),Xe(d,sD),ai(d,iD,d),Xe(d,aD,d);const f=ai(n,rD,Vwe,{[Fwe]:!0});Xe(f,"#"),ai(f,rD,f),Xe(f,cBt,f);const h=Xe(f,uBt);Xe(h,"#"),ai(h,rD,f);const p=[[Ru,a],[Iu,i]],m=[[Ru,null],[rw,l],[Iu,s]];for(let x=0;x<wC.length;x++)df(n,wC[x],JF,$u,p);for(let x=0;x<_C.length;x++)df(n,_C[x],ZF,QF,m);cm(JF,{tld:!0,ascii:!0},e),cm(ZF,{utld:!0,alpha:!0},e),df(n,"file",yk,$u,p),df(n,"mailto",yk,$u,p),df(n,"http",Gx,$u,p),df(n,"https",Gx,$u,p),df(n,"ftp",Gx,$u,p),df(n,"ftps",Gx,$u,p),cm(yk,{scheme:!0,ascii:!0},e),cm(Gx,{slashscheme:!0,ascii:!0},e),t=t.sort((x,y)=>x[0]>y[0]?1:-1);for(let x=0;x<t.length;x++){const y=t[x][0],w=t[x][1]?{[sBt]:!0}:{[aBt]:!0};y.indexOf("-")>=0?w[XF]=!0:Ru.test(y)?Iu.test(y)?w[u1]=!0:w[KF]=!0:w[qF]=!0,Ste(n,y,y,w)}return Ste(n,"localhost",cS,{ascii:!0}),n.jd=new $a(GA),{start:n,tokens:Object.assign({groups:e},Hwe)}}function Wwe(t,e){const n=fBt(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=n.length,i=[];let s=0,a=0;for(;a<r;){let l=t,c=null,u=0,d=null,f=-1,h=-1;for(;a<r&&(c=l.go(n[a]));)l=c,l.accepts()?(f=0,h=0,d=l):f>=0&&(f+=n[a].length,h++),u+=n[a].length,s+=n[a].length,a++;s-=f,a-=h,u-=f,i.push({t:d.t,v:e.slice(s-u,s),s:s-u,e:s})}return i}function fBt(t){const e=[],n=t.length;let r=0;for(;r<n;){let i=t.charCodeAt(r),s,a=i<55296||i>56319||r+1===n||(s=t.charCodeAt(r+1))<56320||s>57343?t[r]:t.slice(r,r+2);e.push(a),r+=a.length}return e}function df(t,e,n,r,i){let s;const a=e.length;for(let l=0;l<a-1;l++){const c=e[l];t.j[c]?s=t.j[c]:(s=new $a(r),s.jr=i.slice(),t.j[c]=s),t=s}return s=new $a(n),s.jr=i.slice(),t.j[e[a-1]]=s,s}function jte(t){const e=[],n=[];let r=0,i="0123456789";for(;r<t.length;){let s=0;for(;i.indexOf(t[r+s])>=0;)s++;if(s>0){e.push(n.join(""));for(let a=parseInt(t.substring(r,r+s),10);a>0;a--)n.pop();r+=s}else n.push(t[r]),r++}return e}const uS={defaultProtocol:"http",events:null,format:Cte,formatHref:Cte,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function q9(t,e=null){let n=Object.assign({},uS);t&&(n=Object.assign(n,t instanceof q9?t.o:t));const r=n.ignoreTags,i=[];for(let s=0;s<r.length;s++)i.push(r[s].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=i}q9.prototype={o:uS,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let i=this.o[t];return i&&(typeof i=="object"?(i=n.t in i?i[n.t]:uS[t],typeof i=="function"&&r&&(i=i(e,n))):typeof i=="function"&&r&&(i=i(e,n.t,n)),i)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function Cte(t){return t}function Gwe(t,e){this.t="token",this.v=t,this.tk=e}Gwe.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=uS.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),i=t.get("tagName",n,e),s=this.toFormattedString(t),a={},l=t.get("className",n,e),c=t.get("target",n,e),u=t.get("rel",n,e),d=t.getObj("attributes",n,e),f=t.getObj("events",n,e);return a.href=r,l&&(a.class=l),c&&(a.target=c),u&&(a.rel=u),d&&Object.assign(a,d),{tagName:i,attributes:a,content:s,eventListeners:f}}};
vendor: 46,728 bytes, lines 5102-5116
5102function _O(t,e){class n extends Gwe{constructor(i,s){super(i,s),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const kte=_O("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Ete=_O("text"),hBt=_O("nl"),SC=_O("url",{isLink:!0,toHref(t=uS.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==cS&&t[1].t===Of}}),Wo=t=>new $a(t);function pBt({groups:t}){const e=t.domain.concat([RA,DA,Sf,LA,$A,FA,UA,zA,Go,z9,h1,BA,VA,HA,Ac,GA,m1,WA]),n=[IA,Of,V9,Ec,H9,h1,p1,W9,G9,NA,jA,d1,f1,wA,bA,_A,SA,CA,kA,EA,AA,TA,MA,PA,OA],r=[RA,IA,DA,LA,$A,FA,UA,zA,Go,d1,f1,h1,BA,VA,HA,p1,Ac,GA,m1,WA],i=Wo(),s=Xe(i,m1);vn(s,r,s),vn(s,t.domain,s);const a=Wo(),l=Wo(),c=Wo();vn(i,t.domain,a),vn(i,t.scheme,l),vn(i,t.slashscheme,c),vn(a,r,s),vn(a,t.domain,a);const u=Xe(a,Sf);Xe(s,Sf,u),Xe(l,Sf,u),Xe(c,Sf,u);const d=Xe(s,Ec);vn(d,r,s),vn(d,t.domain,s);const f=Wo();vn(u,t.domain,f),vn(f,t.domain,f);const h=Xe(f,Ec);vn(h,t.domain,f);const p=Wo(kte);vn(h,t.tld,p),vn(h,t.utld,p),Xe(u,cS,p);const m=Xe(f,Go);Xe(m,Go,m),vn(m,t.domain,f),vn(p,t.domain,f),Xe(p,Ec,h),Xe(p,Go,m);const x=Xe(p,Of);vn(x,t.numeric,kte);const y=Xe(a,Go),g=Xe(a,Ec);Xe(y,Go,y),vn(y,t.domain,a),vn(g,r,s),vn(g,t.domain,a);const w=Wo(SC);vn(g,t.tld,w),vn(g,t.utld,w),vn(w,t.domain,a),vn(w,r,s),Xe(w,Ec,g),Xe(w,Go,y),Xe(w,Sf,u);const v=Xe(w,Of),N=Wo(SC);vn(v,t.numeric,N);const S=Wo(SC),_=Wo();vn(S,e,S),vn(S,n,_),vn(_,e,S),vn(_,n,_),Xe(w,Ac,S),Xe(N,Ac,S);const j=Xe(l,Of),A=Xe(c,Of),C=Xe(A,Ac),k=Xe(C,Ac);vn(l,t.domain,a),Xe(l,Ec,g),Xe(l,Go,y),vn(c,t.domain,a),Xe(c,Ec,g),Xe(c,Go,y),vn(j,t.domain,S),Xe(j,Ac,S),Xe(j,p1,S),vn(k,t.domain,S),vn(k,e,S),Xe(k,Ac,S);const M=[[d1,f1],[bA,wA],[_A,SA],[NA,jA],[CA,kA],[EA,AA],[TA,MA],[PA,OA]];for(let I=0;I<M.length;I++){const[R,E]=M[I],P=Xe(S,R);Xe(_,R,P),Xe(P,E,S);const O=Wo(SC);vn(P,e,O);const L=Wo();vn(P,n),vn(O,e,O),vn(O,n,L),vn(L,e,O),vn(L,n,L),Xe(O,E,S),Xe(L,E,S)}return Xe(i,cS,w),Xe(i,B9,hBt),{start:i,tokens:Hwe}}function mBt(t,e,n){let r=n.length,i=0,s=[],a=[];for(;i<r;){let l=t,c=null,u=null,d=0,f=null,h=-1;for(;i<r&&!(c=l.go(n[i].t));)a.push(n[i++]);for(;i<r&&(u=c||l.go(n[i].t));)c=null,l=u,l.accepts()?(h=0,f=l):h>=0&&h++,i++,d++;if(h<0)i-=d,i<r&&(a.push(n[i]),i++);else{a.length>0&&(s.push(oD(Ete,e,a)),a=[]),i-=h,d-=h;const p=f.t,m=n.slice(i-d,i);s.push(oD(p,e,m))}}return a.length>0&&s.push(oD(Ete,e,a)),s}function oD(t,e,n){const r=n[0].s,i=n[n.length-1].e,s=e.slice(r,i);return new t(s,n)}const gBt=typeof console<"u"&&console&&console.warn||(()=>{}),xBt="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",zr={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function yBt(){return $a.groups={},zr.scanner=null,zr.parser=null,zr.tokenQueue=[],zr.pluginQueue=[],zr.customSchemes=[],zr.initialized=!1,zr}function Ate(t,e=!1){if(zr.initialized&&gBt(`linkifyjs: already initialized - will not register custom scheme "${t}" ${xBt}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
51031. Must only contain digits, lowercase ASCII letters or "-"
51042. Cannot start or end with "-"
51053. "-" cannot repeat`);zr.customSchemes.push([t,e])}function vBt(){zr.scanner=dBt(zr.customSchemes);for(let t=0;t<zr.tokenQueue.length;t++)zr.tokenQueue[t][1]({scanner:zr.scanner});zr.parser=pBt(zr.scanner.tokens);for(let t=0;t<zr.pluginQueue.length;t++)zr.pluginQueue[t][1]({scanner:zr.scanner,parser:zr.parser});return zr.initialized=!0,zr}function K9(t){return zr.initialized||vBt(),mBt(zr.parser.start,t,Wwe(zr.scanner.start,t))}K9.scan=Wwe;function qwe(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new q9(n),i=K9(t),s=[];for(let a=0;a<i.length;a++){const l=i[a];l.isLink&&(!e||l.t===e)&&r.check(l)&&s.push(l.toFormattedObject(r))}return s}var Y9="[\0-   ᠎ -\u2029  ]",bBt=new RegExp(Y9),wBt=new RegExp(`${Y9}$`),_Bt=new RegExp(Y9,"g");function SBt(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function NBt(t){return new si({key:new ss("autolink"),appendTransaction:(e,n,r)=>{const i=e.some(u=>u.docChanged)&&!n.doc.eq(r.doc),s=e.some(u=>u.getMeta("preventAutolink"));if(!i||s)return;const{tr:a}=r,l=uwe(n.doc,[...e]);if(xwe(l).forEach(({newRange:u})=>{const d=hzt(r.doc,u,p=>p.isTextblock);let f,h;if(d.length>1)f=d[0],h=r.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ");else if(d.length){const p=r.doc.textBetween(u.from,u.to," "," ");if(!wBt.test(p))return;f=d[0],h=r.doc.textBetween(f.pos,u.to,void 0," ")}if(f&&h){const p=h.split(bBt).filter(Boolean);if(p.length<=0)return!1;const m=p[p.length-1],x=f.pos+h.lastIndexOf(m);if(!m)return!1;const y=K9(m).map(g=>g.toObject(t.defaultProtocol));if(!SBt(y))return!1;y.filter(g=>g.isLink).map(g=>({...g,from:x+g.start+1,to:x+g.end+1})).filter(g=>r.schema.marks.code?!r.doc.rangeHasMark(g.from,g.to,r.schema.marks.code):!0).filter(g=>t.validate(g.value)).filter(g=>t.shouldAutoLink(g.value)).forEach(g=>{D9(g.from,g.to,r.doc).some(w=>w.mark.type===t.type)||a.addMark(g.from,g.to,t.type.create({href:g.href}))})}}),!!a.steps.length)return a}})}function jBt(t){return new si({key:new ss("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,s;if(r.button!==0||!e.editable)return!1;let a=!1;if(t.enableClickSelection&&(a=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){let l=null;if(r.target instanceof HTMLAnchorElement)l=r.target;else{let f=r.target;const h=[];for(;f.nodeName!=="DIV";)h.push(f),f=f.parentNode;l=h.find(p=>p.nodeName==="A")}if(!l)return a;const c=gwe(e.state,t.type.name),u=(i=l==null?void 0:l.href)!=null?i:c.href,d=(s=l==null?void 0:l.target)!=null?s:c.target;l&&u&&(window.open(u,d),a=!0)}return a}}})}function CBt(t){return new si({key:new ss("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:i}=t,{state:s}=e,{selection:a}=s,{empty:l}=a;if(l)return!1;let c="";r.content.forEach(d=>{c+=d.textContent});const u=qwe(c,{defaultProtocol:t.defaultProtocol}).find(d=>d.isLink&&d.value===c);return!c||!u||i!==void 0&&!i(u.value)?!1:t.editor.commands.setMark(t.type,{href:u.href})}}})}function Cp(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&n.push(i)}),!t||t.replace(_Bt,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Kwe=Hg.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 `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){Ate(t);return}Ate(t.scheme,t.optionalSlashes)})},onDestroy(){yBt()},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:(t,e)=>!!Cp(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const i=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(i)||!/\./.test(i))}}},addAttributes(){return{href:{default:null,parseHTML(t){return t.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:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!Cp(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!Cp(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Li(this.options.HTMLAttributes,t),0]:["a",Li(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n;const r=((n=t.attrs)==null?void 0:n.href)||"";return`[${e.renderChildren(t)}](${r})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Cp(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!Cp(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[xg({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,i=qwe(t).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:a=>!!Cp(a,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(s=>{this.options.shouldAutoLink(s.value)&&e.push({text:s.value,data:{href:s.href},index:s.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(NBt({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!Cp(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(jBt({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(CBt({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),Ywe=Kwe,kBt=Object.defineProperty,EBt=(t,e)=>{for(var n in e)kBt(t,n,{get:e[n],enumerable:!0})},ABt="listItem",Tte="textStyle",Mte=/^\s*([-+*])\s$/,Xwe=Fo.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:t}){return["ul",Li(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
5106`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(ABt,this.editor.getAttributes(Tte)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=x0({find:Mte,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=x0({find:Mte,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Tte),editor:this.editor})),[t]}}),Qwe=Fo.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Li(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{if(t.type!=="list_item")return[];let n=[];if(t.tokens&&t.tokens.length>0)if(t.tokens.some(i=>i.type==="paragraph"))n=e.parseChildren(t.tokens);else{const i=t.tokens[0];if(i&&i.type==="text"&&i.tokens&&i.tokens.length>0){if(n=[{type:"paragraph",content:e.parseInline(i.tokens)}],t.tokens.length>1){const a=t.tokens.slice(1),l=e.parseChildren(a);n.push(...l)}}else n=e.parseChildren(t.tokens)}return n.length===0&&(n=[{type:"paragraph",content:[]}]),{type:"listItem",content:n}},renderMarkdown:(t,e,n)=>U9(t,e,r=>r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${r.index+1}. `:"- ",n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),TBt={};EBt(TBt,{findListItemPos:()=>_N,getNextListDepth:()=>X9,handleBackspace:()=>tU,handleDelete:()=>nU,hasListBefore:()=>Jwe,hasListItemAfter:()=>MBt,hasListItemBefore:()=>Zwe,listItemHasSubList:()=>e1e,nextListIsDeeper:()=>t1e,nextListIsHigher:()=>n1e});var _N=(t,e)=>{const{$from:n}=e.selection,r=Di(t,e.schema);let i=null,s=n.depth,a=n.pos,l=null;for(;s>0&&l===null;)i=n.node(s),i.type===r?l=s:(s-=1,a-=1);return l===null?null:{$pos:e.doc.resolve(a),depth:l}},X9=(t,e)=>{const n=_N(t,e);if(!n)return!1;const[,r]=Szt(e,t,n.$pos.pos+4);return r},Jwe=(t,e,n)=>{const{$anchor:r}=t.selection,i=Math.max(0,r.pos-2),s=t.doc.resolve(i).node();return!(!s||!n.includes(s.type.name))},Zwe=(t,e)=>{var n;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-2);return!(i.index()===0||((n=i.nodeBefore)==null?void 0:n.type.name)!==t)},e1e=(t,e,n)=>{if(!n)return!1;const r=Di(t,e.schema);let i=!1;return n.descendants(s=>{s.type===r&&(i=!0)}),i},tU=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!Vh(t.state,e)&&Jwe(t.state,e,n)){const{$anchor:l}=t.state.selection,c=t.state.doc.resolve(l.before()-1),u=[];c.node().descendants((h,p)=>{h.type.name===e&&u.push({node:h,pos:p})});const d=u.at(-1);if(!d)return!1;const f=t.state.doc.resolve(c.start()+d.pos+1);return t.chain().cut({from:l.start()-1,to:l.end()+1},f.end()).joinForward().run()}if(!Vh(t.state,e)||!kzt(t.state))return!1;const r=_N(e,t.state);if(!r)return!1;const s=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),a=e1e(e,t.state,s);return Zwe(e,t.state)&&!a?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},t1e=(t,e)=>{const n=X9(t,e),r=_N(t,e);return!r||!n?!1:n>r.depth},n1e=(t,e)=>{const n=X9(t,e),r=_N(t,e);return!r||!n?!1:n<r.depth},nU=(t,e)=>{if(!Vh(t.state,e)||!Czt(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:t1e(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():n1e(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},MBt=(t,e)=>{var n;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-r.parentOffset-2);return!(i.index()===i.parent.childCount-1||((n=i.nodeAfter)==null?void 0:n.type.name)!==t)},r1e=bi.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&nU(t,n)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&nU(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&tU(t,n,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&tU(t,n,r)&&(e=!0)}),e}}}}),Pte=/^(\s*)(\d+)\.\s+(.*)$/,PBt=/^\s/;function OBt(t){const e=[];let n=0,r=0;for(;n<t.length;){const i=t[n],s=i.match(Pte);if(!s)break;const[,a,l,c]=s,u=a.length;let d=c,f=n+1;const h=[i];for(;f<t.length;){const p=t[f];if(p.match(Pte))break;if(p.trim()==="")h.push(p),d+=`
5107`,f+=1;else if(p.match(PBt))h.push(p),d+=`
5108${p.slice(u+2)}`,f+=1;else break}e.push({indent:u,number:parseInt(l,10),content:d.trim(),raw:h.join(`
5109`)}),r=f,n=f}return[e,r]}function i1e(t,e,n){var r;const i=[];let s=0;for(;s<t.length;){const a=t[s];if(a.indent===e){const l=a.content.split(`
5110`),c=((r=l[0])==null?void 0:r.trim())||"",u=[];c&&u.push({type:"paragraph",raw:c,tokens:n.inlineTokens(c)});const d=l.slice(1).join(`
5111`).trim();if(d){const p=n.blockTokens(d);u.push(...p)}let f=s+1;const h=[];for(;f<t.length&&t[f].indent>e;)h.push(t[f]),f+=1;if(h.length>0){const p=Math.min(...h.map(x=>x.indent)),m=i1e(h,p,n);u.push({type:"list",ordered:!0,start:h[0].number,items:m,raw:h.map(x=>x.raw).join(`
5112`)})}i.push({type:"list_item",raw:a.raw,tokens:u}),s=f}else s+=1}return i}function RBt(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(i=>{if(i.type==="paragraph"||i.type==="list"||i.type==="blockquote"||i.type==="code")r.push(...e.parseChildren([i]));else if(i.type==="text"&&i.tokens){const s=e.parseChildren([i]);r.push({type:"paragraph",content:s})}else{const s=e.parseChildren([i]);s.length>0&&r.push(...s)}}),{type:"listItem",content:r}})}var IBt="listItem",Ote="textStyle",Rte=/^(\d+)\.\s$/,s1e=Fo.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:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",Li(this.options.HTMLAttributes,n),0]:["ol",Li(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,r=t.items?RBt(t.items,e):[];return n!==1?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
5113`):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),n=e==null?void 0:e.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var r;const i=t.split(`
5114`),[s,a]=OBt(i);if(s.length===0)return;const l=i1e(s,0,n);return l.length===0?void 0:{type:"list",ordered:!0,start:((r=s[0])==null?void 0:r.number)||1,items:l,raw:i.slice(0,a).join(`
5115`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(IBt,this.editor.getAttributes(Ote)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=x0({find:Rte,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=x0({find:Rte,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Ote)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),DBt=/^\s*(\[([( |x])?\])\s$/,LBt=Fo.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:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",Li(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const i=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return U9(t,e,i)},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const i=document.createElement("li"),s=document.createElement("label"),a=document.createElement("span"),l=document.createElement("input"),c=document.createElement("div"),u=f=>{var h,p;l.ariaLabel=((p=(h=this.options.a11y)==null?void 0:h.checkboxLabel)==null?void 0:p.call(h,f,l.checked))||`Task item checkbox for ${f.textContent||"empty task item"}`};u(t),s.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",f=>f.preventDefault()),l.addEventListener("change",f=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:h}=f.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:p})=>{const m=n();if(typeof m!="number")return!1;const x=p.doc.nodeAt(m);return p.setNodeMarkup(m,void 0,{...x==null?void 0:x.attrs,checked:h}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,h)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([f,h])=>{i.setAttribute(f,h)}),i.dataset.checked=t.attrs.checked,l.checked=t.attrs.checked,s.append(l,a),i.append(s,c),Object.entries(e).forEach(([f,h])=>{i.setAttribute(f,h)});let d=new Set(Object.keys(e));return{dom:i,contentDOM:c,update:f=>{if(f.type!==this.type)return!1;i.dataset.checked=f.attrs.checked,l.checked=f.attrs.checked,u(f);const h=r.extensionManager.attributes,p=lS(f,h),m=new Set(Object.keys(p)),x=this.options.HTMLAttributes;return d.forEach(y=>{m.has(y)||(y in x?i.setAttribute(y,x[y]):i.removeAttribute(y))}),Object.entries(p).forEach(([y,g])=>{g==null?y in x?i.setAttribute(y,x[y]):i.removeAttribute(y):i.setAttribute(y,g)}),d=m,!0}}}},addInputRules(){return[x0({find:DBt,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),$Bt=Fo.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:t}){return["ul",Li(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
5116`):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=s=>{const a=WF(s,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,c)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:n.inlineTokens(l.mainContent),nestedTokens:c}),customNestedParser:r},n);return a?[{type:"taskList",raw:a.raw,items:a.items}]:n.blockTokens(s)},i=WF(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:s=>({indentLevel:s[1].length,mainContent:s[4],checked:s[3].toLowerCase()==="x"}),createToken:(s,a)=>({type:"taskItem",raw:"",mainContent:s.mainContent,indentLevel:s.indentLevel,checked:s.checked,text:s.mainContent,tokens:n.inlineTokens(s.mainContent),nestedTokens:a}),customNestedParser:r},n);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});bi.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(Xwe.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(Qwe.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(r1e.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(s1e.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(LBt.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push($Bt.configure(this.options.taskList)),t}});var FBt=Fo.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Li(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];return n.length===1&&n[0].type==="image"?e.parseChildren([n[0]]):e.createNode("paragraph",void 0,e.parseInline(n))},renderMarkdown:(t,e)=>!t||!Array.isArray(t.content)?"":e.renderChildren(t.content),addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),UBt=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,zBt=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,BBt=Hg.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",Li(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[g0({find:UBt,type:this.type})]},addPasteRules(){return[xg({find:zBt,type:this.type})]}}),VBt=Fo.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),a1e=Hg.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",Li(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const i=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!i)return;const s=i[2].trim();return{type:"underline",raw:i[0],text:s,tokens:n.inlineTokens(s)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),o1e=a1e;function HBt(t={}){return new si({view(e){return new WBt(e,t)}})}class WBt{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=a=>{this[i](a)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.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),n=!e.parent.inlineContent,r,i=this.editorView.dom,s=i.getBoundingClientRect(),a=s.width/i.offsetWidth,l=s.height/i.offsetHeight;if(n){let f=e.nodeBefore,h=e.nodeAfter;if(f||h){let p=this.editorView.nodeDOM(this.cursorPos-(f?f.nodeSize:0));if(p){let m=p.getBoundingClientRect(),x=f?m.bottom:m.top;f&&h&&(x=(x+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*l;r={left:m.left,right:m.right,top:x-y,bottom:x+y}}}}if(!r){let f=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*a;r={left:f.left-h,right:f.left+h,top:f.top,bottom:f.bottom}}let c=this.editorView.dom.offsetParent;this.element||(this.element=c.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",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let u,d;if(!c||c==document.body&&getComputedStyle(c).position=="static")u=-pageXOffset,d=-pageYOffset;else{let f=c.getBoundingClientRect(),h=f.width/c.offsetWidth,p=f.height/c.offsetHeight;u=f.left-c.scrollLeft*h,d=f.top-c.scrollTop*p}this.element.style.left=(r.left-u)/a+"px",this.element.style.top=(r.top-d)/l+"px",this.element.style.width=(r.right-r.left)/a+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,n,e):i;if(n&&!s){let a=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=tbe(this.editorView.state.doc,a,this.editorView.dragging.slice);l!=null&&(a=l)}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 hi extends Nn{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return hi.valid(r)?new hi(r):Nn.near(r)}content(){return ft.empty}eq(e){return e instanceof hi&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new hi(e.resolve(n.pos))}getBookmark(){return new Q9(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!GBt(e)||!qBt(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let i=n.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&hi.valid(e))return e;let i=e.pos,s=null;for(let a=e.depth;;a--){let l=e.node(a);if(n>0?e.indexAfter(a)<l.childCount:e.index(a)>0){s=l.child(n>0?e.indexAfter(a):e.index(a)-1);break}else if(a==0)return null;i+=n;let c=e.doc.resolve(i);if(hi.valid(c))return c}for(;;){let a=n>0?s.firstChild:s.lastChild;if(!a){if(s.isAtom&&!s.isText&&!Wt.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*n),r=!1;continue e}break}s=a,i+=n;let l=e.doc.resolve(i);if(hi.valid(l))return l}return null}}}hi.prototype.visible=!1;hi.findFrom=hi.findGapCursorFrom;Nn.jsonID("gapcursor",hi);class Q9{constructor(e){this.pos=e}map(e){return new Q9(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return hi.valid(n)?new hi(n):Nn.near(n)}}function l1e(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function GBt(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||l1e(i.type))return!0;if(i.inlineContent)return!1}}return!0}function qBt(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||l1e(i.type))return!0;if(i.inlineContent)return!1}}return!0}function KBt(){return new si({props:{decorations:JBt,createSelectionBetween(t,e,n){return e.pos==n.pos&&hi.valid(n)?new hi(n):null},handleClick:XBt,handleKeyDown:YBt,handleDOMEvents:{beforeinput:QBt}}})}const YBt=nwe({ArrowLeft:NC("horiz",-1),ArrowRight:NC("horiz",1),ArrowUp:NC("vert",-1),ArrowDown:NC("vert",1)});function NC(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let a=r.selection,l=e>0?a.$to:a.$from,c=a.empty;if(a instanceof rn){if(!s.endOfTextblock(n)||l.depth==0)return!1;c=!1,l=r.doc.resolve(e>0?l.after():l.before())}let u=hi.findGapCursorFrom(l,e,c);return u?(i&&i(r.tr.setSelection(new hi(u))),!0):!1}}function XBt(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!hi.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&Wt.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new hi(r))),!0)}function QBt(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof hi))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let i=Ke.empty;for(let a=r.length-1;a>=0;a--)i=Ke.from(r[a].createAndFill(null,i));let s=t.state.tr.replace(n.pos,n.pos,new ft(i,0,0));return s.setSelection(rn.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function JBt(t){if(!(t.selection instanceof hi))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ni.create(t.doc,[pa.widget(t.selection.head,e,{key:"gapcursor"})])}var qA=200,bs=function(){};bs.prototype.append=function(e){return e.length?(e=bs.from(e),!this.length&&e||e.length<qA&&this.leafAppend(e)||this.length<qA&&e.leafPrepend(this)||this.appendInner(e)):this};bs.prototype.prepend=function(e){return e.length?bs.from(e).append(this):this};bs.prototype.appendInner=function(e){return new ZBt(this,e)};bs.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?bs.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};bs.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};bs.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};bs.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,a){return i.push(e(s,a))},n,r),i};bs.from=function(e){return e instanceof bs?e:e&&e.length?new c1e(e):bs.empty};var c1e=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,a,l){for(var c=s;c<a;c++)if(i(this.values[c],l+c)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,a,l){for(var c=s-1;c>=a;c--)if(i(this.values[c],l+c)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=qA)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=qA)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(bs);bs.empty=new c1e([]);var ZBt=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.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,i,s,a){var l=this.left.length;if(i<l&&this.left.forEachInner(r,i,Math.min(s,l),a)===!1||s>l&&this.right.forEachInner(r,Math.max(i-l,0),Math.min(this.length,s)-l,a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,a){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(r,i-l,Math.max(s,l)-l,a+l)===!1||s<l&&this.left.forEachInvertedInner(r,Math.min(i,l),s,a)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,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}(bs);const e8t=500;class Zl{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,s;n&&(i=this.remapping(r,this.items.length),s=i.maps.length);let a=e.tr,l,c,u=[],d=[];return this.items.forEach((f,h)=>{if(!f.step){i||(i=this.remapping(r,h+1),s=i.maps.length),s--,d.push(f);return}if(i){d.push(new Tc(f.map));let p=f.step.map(i.slice(s)),m;p&&a.maybeStep(p).doc&&(m=a.mapping.maps[a.mapping.maps.length-1],u.push(new Tc(m,void 0,void 0,u.length+d.length))),s--,m&&i.appendMap(m,s)}else a.maybeStep(f.step);if(f.selection)return l=i?f.selection.map(i.slice(s)):f.selection,c=new Zl(this.items.slice(0,r).append(d.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:a,selection:l}}addTransform(e,n,r,i){let s=[],a=this.eventCount,l=this.items,c=!i&&l.length?l.get(l.length-1):null;for(let d=0;d<e.steps.length;d++){let f=e.steps[d].invert(e.docs[d]),h=new Tc(e.mapping.maps[d],f,n),p;(p=c&&c.merge(h))&&(h=p,d?s.pop():l=l.slice(0,l.length-1)),s.push(h),n&&(a++,n=void 0),i||(c=h)}let u=a-r.depth;return u>n8t&&(l=t8t(l,u),a-=u),new Zl(l.append(s),a)}remapping(e,n){let r=new nS;return this.items.forEach((i,s)=>{let a=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,a)},e,n),r}addMaps(e){return this.eventCount==0?this:new Zl(this.items.append(e.map(n=>new Tc(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),s=e.mapping,a=e.steps.length,l=this.eventCount;this.items.forEach(h=>{h.selection&&l--},i);let c=n;this.items.forEach(h=>{let p=s.getMirror(--c);if(p==null)return;a=Math.min(a,p);let m=s.maps[p];if(h.step){let x=e.steps[p].invert(e.docs[p]),y=h.selection&&h.selection.map(s.slice(c+1,p));y&&l++,r.push(new Tc(m,x,y))}else r.push(new Tc(m))},i);let u=[];for(let h=n;h<a;h++)u.push(new Tc(s.maps[h]));let d=this.items.slice(0,i).append(u).append(r),f=new Zl(d,l);return f.emptyItemCount()>e8t&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],s=0;return this.items.forEach((a,l)=>{if(l>=e)i.push(a),a.selection&&s++;else if(a.step){let c=a.step.map(n.slice(r)),u=c&&c.getMap();if(r--,u&&n.appendMap(u,r),c){let d=a.selection&&a.selection.map(n.slice(r));d&&s++;let f=new Tc(u.invert(),c,d),h,p=i.length-1;(h=i.length&&i[p].merge(f))?i[p]=h:i.push(f)}}else a.map&&r--},this.items.length,0),new Zl(bs.from(i.reverse()),s)}}Zl.empty=new Zl(bs.empty,0);function t8t(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class Tc{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new Tc(n.getMap().invert(),n,this.selection)}}}class Nf{constructor(e,n,r,i,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const n8t=20;function r8t(t,e,n,r){let i=n.getMeta(Pm),s;if(i)return i.historyState;n.getMeta(a8t)&&(t=new Nf(t.done,t.undone,null,0,-1));let a=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(a&&a.getMeta(Pm))return a.getMeta(Pm).redo?new Nf(t.done.addTransform(n,void 0,r,vk(e)),t.undone,Ite(n.mapping.maps),t.prevTime,t.prevComposition):new Nf(t.done,t.undone.addTransform(n,void 0,r,vk(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(a&&a.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),c=t.prevTime==0||!a&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-r.newGroupDelay||!i8t(n,t.prevRanges)),u=a?lD(t.prevRanges,n.mapping):Ite(n.mapping.maps);return new Nf(t.done.addTransform(n,c?e.selection.getBookmark():void 0,r,vk(e)),Zl.empty,u,n.time,l??t.prevComposition)}else return(s=n.getMeta("rebased"))?new Nf(t.done.rebased(n,s),t.undone.rebased(n,s),lD(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Nf(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),lD(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function i8t(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&i>=e[s]&&(n=!0)}),n}function Ite(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,s,a)=>e.push(s,a));return e}function lD(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),s=e.map(t[r+1],-1);i<=s&&n.push(i,s)}return n}function s8t(t,e,n){let r=vk(e),i=Pm.get(e).spec.config,s=(n?t.undone:t.done).popEvent(e,r);if(!s)return null;let a=s.selection.resolve(s.transform.doc),l=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),c=new Nf(n?l:s.remaining,n?s.remaining:l,null,0,-1);return s.transform.setSelection(a).setMeta(Pm,{redo:n,historyState:c})}let cD=!1,Dte=null;function vk(t){let e=t.plugins;if(Dte!=e){cD=!1,Dte=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){cD=!0;break}}return cD}const Pm=new ss("history"),a8t=new ss("closeHistory");function o8t(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new si({key:Pm,state:{init(){return new Nf(Zl.empty,Zl.empty,null,0,-1)},apply(e,n,r){return r8t(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?d1e:r=="historyRedo"?f1e:null;return!i||!e.editable?!1:(n.preventDefault(),i(e.state,e.dispatch))}}}})}function u1e(t,e){return(n,r)=>{let i=Pm.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let s=s8t(i,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const d1e=u1e(!1,!0),f1e=u1e(!0,!0);bi.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc;if(((t==null?void 0:t.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=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new si({key:new ss("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const i=this.options.limit;if(i==null||i===0){t=!0;return}const s=this.storage.characters({node:r.doc});if(s>i){const a=s-i,l=0,c=a;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const u=r.tr.deleteRange(l,c);return t=!0,u}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const i=this.storage.characters({node:n.doc}),s=this.storage.characters({node:e.doc});if(s<=r||i>r&&s>r&&s<=i)return!0;if(i>r&&s>r&&s>i||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,c=s-r,u=l-c,d=l;return e.deleteRange(u,d),!(this.storage.characters({node:e.doc})>r)}})]}});var l8t=bi.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[HBt(this.options)]}});bi.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new si({key:new ss("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:i}=e,s=[];if(!n||!r)return ni.create(t,[]);let a=0;this.options.mode==="deepest"&&t.descendants((c,u)=>{if(c.isText)return;if(!(i>=u&&i<=u+c.nodeSize-1))return!1;a+=1});let l=0;return t.descendants((c,u)=>{if(c.isText||!(i>=u&&i<=u+c.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&a-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";s.push(pa.node(u,u+c.nodeSize,{class:this.options.className}))}),ni.create(t,s)}}})]}});var c8t=bi.create({name:"gapCursor",addProseMirrorPlugins(){return[KBt()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=Zn(It(t,"allowGapCursor",n)))!=null?e:null}}}),u8t=bi.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new si({key:new ss("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,i=[];if(!n)return null;const s=this.editor.isEmpty;
5116return t.descendants((a,l)=>{const c=r>=l&&r<=l+a.nodeSize,u=!a.isLeaf&&vO(a);if((c||!this.options.showOnlyCurrent)&&u){const d=[this.options.emptyNodeClass];s&&d.push(this.options.emptyEditorClass);const f=pa.node(l,l+a.nodeSize,{class:d.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:a,pos:l,hasAnchor:c}):this.options.placeholder});i.push(f)}return this.options.includeChildren}),ni.create(t,i)}}})]}});bi.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new si({key:new ss("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||ywe(n.selection)||t.view.dragging?null:ni.create(n.doc,[pa.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function Lte({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||(e==null?void 0:e.type)===t}var d8t=bi.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new ss(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(n).includes(i.name));return[new si({key:e,appendTransaction:(i,s,a)=>{const{doc:l,tr:c,schema:u}=a,d=e.getState(a),f=l.content.size,h=u.nodes[n];if(d)return c.insert(f,h.create())},state:{init:(i,s)=>{const a=s.tr.doc.lastChild;return!Lte({node:a,types:r})},apply:(i,s)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return s;const a=i.doc.lastChild;return!Lte({node:a,types:r})}}})]}}),f8t=bi.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>d1e(t,e),redo:()=>({state:t,dispatch:e})=>f1e(t,e)}},addProseMirrorPlugins(){return[o8t(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()}}}),h8t=bi.create({name:"starterKit",addExtensions(){var t,e,n,r;const i=[];return this.options.bold!==!1&&i.push(z6t.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(D6t.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(Xwe.configure(this.options.bulletList)),this.options.code!==!1&&i.push(H6t.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(q6t.configure(this.options.codeBlock)),this.options.document!==!1&&i.push(K6t.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(l8t.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(c8t.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(Y6t.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(X6t.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(f8t.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(Q6t.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push(nBt.configure(this.options.italic)),this.options.listItem!==!1&&i.push(Qwe.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(r1e.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&i.push(Kwe.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&i.push(s1e.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(FBt.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(BBt.configure(this.options.strike)),this.options.text!==!1&&i.push(VBt.configure(this.options.text)),this.options.underline!==!1&&i.push(a1e.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&i.push(d8t.configure((r=this.options)==null?void 0:r.trailingNode)),i}}),h1e=h8t,p1e=u8t;const $te={research:"Researching topic",writing:"Writing content",summary:"Generating meta description",internalLinks:"Finding internal links",schema:"Generating SEO schema"};function p8t(t){if(!t)return"";if(t.includes("<h2>")||t.includes("<p>"))return t;let e=t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/^### (.+)$/gm,"<h3>$1</h3>").replace(/^## (.+)$/gm,"<h2>$1</h2>").replace(/^# (.+)$/gm,"<h1>$1</h1>").replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/^- (.+)$/gm,"<li>$1</li>").replace(/^(\d+)\. (.+)$/gm,"<li>$2</li>").replace(/\n\n/g,"</p><p>").replace(/\n/g,"<br/>");return e.startsWith("<")||(e="<p>"+e+"</p>"),e=e.replace(/(<li>.*?<\/li>)+/gs,"<ul>$&</ul>"),e=e.replace(/<p><p>/g,"<p>").replace(/<\/p><\/p>/g,"</p>"),e}function m8t(t){if(!t)return[];const e=[],n=new Set,r=/<a[^>]*href=["']([^"']+)["'][^>]*>([^<]*)<\/a>/gi;let i;for(;(i=r.exec(t))!==null;){const s=i[1],a=i[2].trim();if(n.has(s)||s.startsWith("#"))continue;n.add(s);let l=a;if(!l)try{const c=new URL(s);l=c.hostname+c.pathname}catch{l=s}e.push({url:s,title:l})}return e}function g8t(){var fe,ce,ve,X;const{companyId:t,articleId:e}=Gr(),n=Nr(),[r,i]=N0(),s=Sa(),a=b.useRef(null),l=b.useRef(null),[c,u]=b.useState(""),[d,f]=b.useState(""),[h,p]=b.useState(""),[m,x]=b.useState(!1),[y,g]=b.useState(null),[w,v]=b.useState(!1),[N,S]=b.useState("saved"),_=b.useRef(null),[j,A]=b.useState(!1),[C,k]=b.useState({research:"pending",writing:"pending",summary:"pe
5116nding",internalLinks:"pending",schema:"pending"}),M=b.useRef(!1),I=b.useRef(!1),R=$we({extensions:[h1e.configure({heading:{levels:[1,2,3]}}),o1e,Ywe.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline"}}),p1e.configure({placeholder:j?"Generating content...":"Start writing your article..."})],content:"",editable:!j,onUpdate:()=>{if(I.current){I.current=!1;return}j||z()},editorProps:{attributes:{class:ne("tiptap ProseMirror focus:outline-none min-h-[500px]",j&&"opacity-50")}}}),{data:E,isLoading:P}=En({queryKey:["article",t,e],queryFn:async()=>await Ce.get(`/companies/${t}/articles/${e}`),enabled:!!t&&!!e,refetchInterval:de=>{var Te;return((Te=de.state.data)==null?void 0:Te.generationStatus)==="generating"?3e3:!1}});b.useEffect(()=>{if(E){const de=E.generationStatus==="generating";if(de&&!j){A(!0);const Te=E.generationCurrentStep;if(Te){const Pe={research:"pending",writing:"pending",summary:"pending",internalLinks:"pending",schema:"pending"},se=["research","writing","summary","internalLinks","schema"],U=se.indexOf(Te);se.forEach((Q,oe)=>{oe<U?Pe[Q]="completed":oe===U&&(Pe[Q]="running")}),k(Pe)}}!de&&j&&E.generationStatus!=="idle"&&(A(!1),E.generationStatus==="completed"?k({research:"completed",writing:"completed",summary:"completed",internalLinks:"completed",schema:"completed"}):E.generationStatus==="failed"&&ge.error(E.generationError||"Article generation failed"))}},[E==null?void 0:E.generationStatus,E==null?void 0:E.generationCurrentStep]);const O=b.useRef(!1),L=b.useRef(null),T=b.useRef(null);b.useEffect(()=>{R&&R.setEditable(!j)},[R,j]);const D=b.useRef(null);b.useEffect(()=>{if(E&&R){const de=L.current!==E.id,Te=E.content||"",Pe=!T.current||T.current==="<p></p>"||T.current.trim()==="",se=Te&&Te!=="<p></p>"&&Te.trim()!=="",U=Pe&&se,Q=!D.current,oe=!!E.metaDescription,_e=Q&&oe;if(de||!O.current||U){L.current=E.id,O.current=!0,T.current=Te,D.current=E.metaDescription||null,u(E.title),f(E.metaTitle||E.title),p(E.metaDescription||""),x(E.isFeatured||!1),g(E.socialImageUrl||null);const ye=p8t(Te);ye&&R.commands.setContent(ye)}else _e&&(D.current=E.metaDescription||null,p(E.metaDescription||""))}},[E,R]);const F=un({mutationFn:async()=>await Ce.post(`/companies/${t}/articles/${e}/generate-simple`),onSuccess:()=>{A(!0),k({research:"pending",writing:"pending",summary:"pending",internalLinks:"pending",schema:"pending"})},onError:()=>{ge.error("Failed to start article generation")}});b.useEffect(()=>{const de=Um();if(!de||!e)return;const Te=U=>{if(U.articleId!==e)return;const Q=U.step;["research","writing","summary","internalLinks","schema"].includes(Q)&&k(oe=>({...oe,[Q]:U.status}))},Pe=U=>{if(U.articleId!==e)return;const Q=U.step;["research","writing","summary","internalLinks","schema"].includes(Q)&&k(oe=>({...oe,[Q]:"completed"})),["writing","summary","internalLinks","schema"].includes(Q)&&s.invalidateQueries({queryKey:["article",t,e]})},se=U=>{U.articleId===e&&(A(!1),k({research:"completed",writing:"completed",summary:"completed",internalLinks:"completed",schema:"completed"}),T.current=null,D.current=null,O.current=!1,I.current=!0,s.invalidateQueries({queryKey:["article",t,e]}),ge.success("Article generated successfully!"),r.delete("generate"),i(r,{replace:!0}))};return de.on("article:generation_progress",Te),de.on("article:step_completed",Pe),de.on("article:generation_completed",se),()=>{de.off("article:generation_progress",Te),de.off("article:step_completed",Pe),de.off("article:generation_completed",se)}},[e,t,s,r,i]),b.useEffect(()=>{r.get("generate")==="true"&&E&&!M.current&&!E.content&&(M.current=!0,F.mutate())},[r,E,F]),b.useEffect(()=>{const de=()=>{const Te=l.current;Te&&(Te.style.height="auto",Te.style.height=Te.scrollHeight+"px")};return de(),window.addEventListener("resize",de),()=>window.removeEventListener("resize",de)},[c]);const q=un({mutationFn:async de=>await Ce.put(`/companies/${t}/articles/${e}`,de),onSuccess:de=>{S("saved"),s.setQueryData(["article",t,e],Te=>Te?{...Te,...de}:de)},onError:()=>{S("unsaved"),ge.error("Failed to save changes")}}),B=un({mutationFn:async de=>await Ce.put(`/companies/${t}/articles/${e}/share`,{isPublic:de}),onSuccess:()=>{s.invalidateQueries({queryKey:["article",t,e]}),ge.success("Sharing settings updated")},onError:()=>{ge.error("Failed to update sharing settings")}}),z=b.useCallback(()=>{S("unsaved"),_.current&&clearTimeout(_.current),_.current=setTimeout(()=>{if(!(c!=null&&c.trim())){S("unsaved");return}const de=(R==null?void 0:R.getHTML())||"",Te=(R==null?void 0:R.getText().split(/\s+/).filter(
5116Boolean).length)||0,Pe={title:c.trim(),content:de,actualWordCount:Te,isFeatured:m};d!=null&&d.trim()&&(Pe.metaTitle=d.trim()),h!=null&&h.trim()&&(Pe.metaDescription=h.trim()),y&&(Pe.socialImageUrl=y),S("saving"),q.mutate(Pe)},1500)},[R,c,d,h,m,y,q]),H=de=>{u(de),(!d||d===c)&&f(de),z()},W=de=>{f(de),z()},G=de=>{p(de),z()},K=de=>{x(de),z()},ee=()=>{if(E!=null&&E.publicToken){const de=`${window.location.origin}/shared/article/${E.publicToken}`;navigator.clipboard.writeText(de),ge.success("Share link copied to clipboard")}},V=async de=>{var Pe;const Te=(Pe=de.target.files)==null?void 0:Pe[0];if(Te){if(!Te.type.startsWith("image/")){ge.error("Please select an image file");return}if(Te.size>5*1024*1024){ge.error("Image must be less than 5MB");return}v(!0);try{const se=Te.name.split(".").pop(),U=`${e}-social.${se}`,Q=`articles/${t}/${U}`,{error:oe}=await co.storage.from("article-images").upload(Q,Te,{upsert:!0});if(oe)throw oe;const{data:{publicUrl:_e}}=co.storage.from("article-images").getPublicUrl(Q);g(_e),z(),ge.success("Image uploaded")}catch(se){console.error("Upload error:",se),ge.error("Failed to upload image")}finally{v(!1)}}},J=()=>{g(null),z()},Y=(R==null?void 0:R.getText().split(/\s+/).filter(Boolean).length)||0,$=b.useMemo(()=>{const de=(R==null?void 0:R.getHTML())||(E==null?void 0:E.content)||"";return m8t(de)},[R==null?void 0:R.getHTML(),E==null?void 0:E.content]);return P?o.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-4rem)]",children:o.jsx(Me,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):E?o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:E.title,noIndex:!0}),o.jsxs("div",{className:"flex flex-col h-[calc(100vh-64px)]",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4 py-3 border-b bg-background px-6 sticky top-0 z-20",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(le,{variant:"outline",size:"sm",asChild:!0,children:o.jsxs(Mt,{to:`/company/${t}/content`,children:[o.jsx(Ii,{className:"h-4 w-4 mr-1"}),"Articles"]})}),o.jsx("span",{className:"text-muted-foreground",children:"/"}),o.jsx("span",{className:"text-sm font-medium truncate max-w-[300px]",children:c||"Untitled"})]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs("div",{className:"flex items-center gap-1.5 text-sm text-muted-foreground",children:[N==="saving"&&o.jsxs(o.Fragment,{children:[o.jsx(Me,{className:"h-3.5 w-3.5 animate-spin"}),o.jsx("span",{children:"Saving..."})]}),N==="saved"&&o.jsxs(o.Fragment,{children:[o.jsx(Sn,{className:"h-3.5 w-3.5 text-green-500"}),o.jsx("span",{children:"Saved"})]}),N==="unsaved"&&o.jsx("span",{className:"text-amber-500",children:"Unsaved changes"})]}),o.jsxs(Ge,{variant:"secondary",className:"font-normal",children:[Y.toLocaleString()," words"]}),o.jsx(Ge,{variant:E.status==="published"?"default":"outline",className:ne(E.status==="published"&&"bg-green-500/10 text-green-600 border-green-200"),children:E.status==="published"?"Published":"Draft"}),E.isPublic&&E.publicToken&&o.jsx(le,{variant:"outline",size:"sm",asChild:!0,children:o.jsxs("a",{href:`/shared/article/${E.publicToken}`,target:"_blank",rel:"noopener noreferrer",children:[o.jsx(Eh,{className:"h-4 w-4 mr-1"}),"Preview"]})})]})]}),o.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[o.jsx("div",{className:"flex-1 overflow-y-auto relative",children:j?o.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[o.jsx(Me,{className:"h-6 w-6 animate-spin text-foreground-muted mb-3"}),o.jsx("p",{className:"font-medium text-foreground",children:(()=>{const de=["research","writing","summary","internalLinks","schema"].find(Te=>C[Te]==="running");return de?$te[de]:"Preparing..."})()}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"This may take a few minutes"})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-center justify-between py-2 px-6 bg-background border-b text-sm",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(RS,{className:"h-5 w-5",children:[o.jsx(IS,{src:((fe=E.author)==null?void 0:fe.avatarUrl)||void 0}),o.jsx(DS,{className:"text-[9px]",children:((ve=(ce=E.author)==null?void 0:ce.fullName)==null?void 0:ve.charAt(0))||"U"})]}),o.jsx("span",{className:"text-muted-foreground",children:((X=E.author)==null?void 0:X.fullName)||"Unknown"})]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs(Tr,{value:E.isPublic?"public":"private",onValueChange:de=>B.mutate(de==="public"),children:[o.jsxs(yr,{className:"w-auto h-6 border-0 px-1.5 text-sm gap-1 focus:ring-0 hover:bg-muted/50 rounded",children:[E.isPublic?o.jsx(To,{className:"h-3.5 w-3.5 text-muted-foreground"}):o.jsx(Zk,{className:"h-3.5 w-3.5 text-muted-foreground"}),o.jsx("span",{className:"text-muted-foreground",children:E.isPublic?"Public":"Private"})]}),o.jsxs(vr,{children:[o.jsx(Ht,{value:"private",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Zk,{className:"h-4 w-4"}),"Private"]})}),o.jsx(Ht,{value:"public",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(To,{className:"h-4 w-4"}),"Public"]})})]})]}),E.isPublic&&E.publicToken&&o.jsxs(le,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs gap-1 text-muted-foreground hover:text-foreground",onClick:ee,children:[o.jsx(Nz,{className:"h-3 w-3"}),"Copy link"]})]})]}),o.jsx("div",{className:"pb-24 pt-8 px-4",children:o.jsxs("div",{className:"max-w-[800px] mx-auto px-12 py-14 border bg-background shadow-xl",children:[o.jsx("div",{className:"mb-8",children:o.jsx("textarea",{ref:l,value:c,onChange:de=>H(de.target.value),className:"w-full text-3xl md:text-4xl font-bold border-none p-0 resize-none overflow-hidden focu
5116s:outline-none focus:ring-0 bg-transparent placeholder:text-muted-foreground/50",placeholder:"Article title...",rows:1,style:{minHeight:"48px"}})}),o.jsx(Dwe,{editor:R}),(E==null?void 0:E.faqs)&&E.faqs.length>0&&o.jsxs("div",{className:"mt-12 pt-8 border-t",children:[o.jsx("h2",{className:"text-2xl font-bold mb-6",children:"Frequently Asked Questions"}),o.jsx("div",{className:"space-y-6",children:E.faqs.map(de=>o.jsxs("div",{className:"space-y-2",children:[o.jsx("h3",{className:"text-lg font-semibold",children:de.question}),o.jsx("p",{className:"text-muted-foreground leading-relaxed",children:de.answer})]},de.id))})]}),(E==null?void 0:E.citations)&&E.citations.length>0&&o.jsxs("div",{className:"mt-12 pt-8 border-t",children:[o.jsx("h2",{className:"text-2xl font-bold mb-6",children:"Sources"}),o.jsx("div",{className:"space-y-3",children:E.citations.map((de,Te)=>o.jsxs("div",{className:"flex items-start gap-3 text-sm",children:[o.jsxs("span",{className:"text-muted-foreground font-mono",children:["[",Te+1,"]"]}),o.jsxs("div",{children:[o.jsx("a",{href:de.url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline font-medium",children:de.title}),o.jsxs("span",{className:"text-muted-foreground ml-2",children:["— ",de.source]})]})]},de.id))})]})]})}),o.jsx("div",{className:"sticky bottom-6 z-30 justify-center w-full",children:o.jsx("div",{className:"bg-card border rounded-xl shadow-lg px-4 py-2 w-fit mx-auto",children:o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsxs("div",{className:"flex items-center gap-0.5",children:[o.jsx(le,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>R==null?void 0:R.chain().focus().undo().run(),disabled:!(R!=null&&R.can().undo()),children:o.jsx(FTe,{className:"h-4 w-4"})}),o.jsx(le,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>R==null?void 0:R.chain().focus().redo().run(),disabled:!(R!=null&&R.can().redo()),children:o.jsx(TTe,{className:"h-4 w-4"})}),o.jsx("div",{className:"w-px h-4 bg-border mx-1"})]}),o.jsxs("div",{className:"flex items-center gap-0.5",children:[o.jsx(le,{variant:"ghost",size:"icon",className:ne("h-7 w-7",(R==null?void 0:R.isActive("bold"))&&"bg-muted"),onClick:()=>R==null?void 0:R.chain().focus().toggleBold().run(),children:o.jsx(Pse,{className:"h-4 w-4"})}),o.jsx(le,{variant:"ghost",size:"icon",className:ne("h-7 w-7",(R==null?void 0:R.isActive("italic"))&&"bg-muted"),onClick:()=>R==null?void 0:R.chain().focus().toggleItalic().run(),children:o.jsx(zse,{className:"h-4 w-4"})}),o.jsx(le,{variant:"ghost",size:"icon",className:ne("h-7 w-7",(R==null?void 0:R.isActive("strike"))&&"bg-muted"),onClick:()=>R==null?void 0:R.chain().focus().toggleStrike().run(),children:o.jsx(Yse,{className:"h-4 w-4"})}),o.jsx("div",{className:"w-px h-4 bg-border mx-1"})]}),o.jsxs("div",{className:"flex items-center gap-0.5",children:[o.jsx(le,{variant:"ghost",size:"icon",className:ne("h-7 w-7",(R==null?void 0:R.isActive("heading",{level:1}))&&"bg-muted"),onClick:()=>R==null?void 0:R.chain().focus().toggleHeading({level:1}).run(),children:o.jsx($se,{className:"h-4 w-4"})}),o.jsx(le,{variant:"ghost",size:"icon",className:ne("h-7 w-7",(R==null?void 0:R.isActive("heading",{level:2}))&&"bg-muted"),onClick:()=>R==null?void 0:R.chain().focus().toggleHeading({level:2}).run(),children:o.jsx(Fse,{className:"h-4 w-4"})}),o.jsx(le,{variant:"ghost",size:"icon",className:ne("h-7 w-7",(R==null?void 0:R.isActive("heading",{level:3}))&&"bg-muted"),onClick:()=>R==null?void 0:R.chain().focus().toggleHeading({level:3}).run(),children:o.jsx(Use,{className:"h-4 w-4"})}),o.jsx("div",{className:"w-px h-4 bg-border mx-1"})]}),o.jsxs("div",{className:"flex items-center gap-0.5",children:[o.jsx(le,{variant:"ghost",size:"icon",className:ne("h-7 w-7",(R==null?void 0:R.isActive("bulletList"))&&"bg-muted"),onClick:()=>R==null?void 0:R.chain().focus().toggleBulletList().run(),children:o.jsx(Wse,{className:"h-4 w-4"})}),o.jsx(le,{variant:"ghost",size:"icon",className:ne("h-7 w-7",(R==null?void 0:R.isActive("orderedList"))&&"bg-muted"),onClick:()=>R==null?void 0:R.chain().focus().toggleOrderedList().run(),children:o.jsx(Hse,{className:"h-4 w-4"})}),o.jsx("div",{className:"w-px h-4 bg-border mx-1"})]}),o.jsx(le,{variant:"ghost",size:"icon",className:ne("h-7 w-7",(R==null?void 0:R.isActive("blockquote"))&&"bg-muted"),onClick:()=>R==null?void 0:R.chain().focus().toggleBlockquote().run(),children:o.jsx(ATe,{className:"h-4 w-4"})})]})})})]})}),o.jsx("div",{className:"hidden lg:flex w-[360px] flex-shrink-0 border-l bg-card flex-col overflow-y-auto",children:o.jsxs("div",{className:"p-6 space-y-6",children:[j&&o.jsxs("div",{className:"space-y-4 p-4 -m-6 mb-4 bg-primary/5 border-b",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Me,{className:"h-4 w-4 animate-spin text-primary"}),o.jsx("span",{className:"text-sm font-semibold",children:"Generating Article"})]}),o.jsx("div",{className:"space-y-3",children:["research","writing","summary","internalLinks","schema"].map(de=>{const Te=C[de],Pe=Te==="running",se=Te==="completed",U=Te==="failed";return o.jsxs("div",{className:"flex items-center gap-3",children:[se?o.jsx(Sn,{className:"h-4 w-4 text-green-500"}):Pe?o.jsx(Me,{className:"h-4 w-4 animate-spin text-primary"}):U?o.jsx(mr,{className:"h-4 w-4 text-destructive"}
5116):o.jsx("div",{className:"h-4 w-4 rounded-full border-2 border-muted-foreground/30"}),o.jsx("span",{className:ne("text-sm",se&&"text-green-600",Pe&&"text-primary font-medium",U&&"text-destructive",!se&&!Pe&&!U&&"text-muted-foreground"),children:$te[de]})]},de)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"This may take a few minutes"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Xa,{className:"h-4 w-4 text-muted-foreground"}),o.jsx("span",{className:"text-sm font-medium",children:"Search Preview"})]}),o.jsxs("div",{className:"bg-muted/30 rounded-lg border p-3 space-y-1.5",children:[o.jsx("div",{className:"text-blue-600 text-sm hover:underline cursor-pointer truncate",children:d||c||"Article Title"}),o.jsxs("div",{className:"text-green-700 text-xs truncate",children:[o.jsx("span",{className:"text-muted-foreground",children:"example.com/blog/"}),o.jsx("span",{children:E.slug})]}),o.jsx("div",{className:"text-muted-foreground text-xs line-clamp-2",children:h||"Add a meta description for search results..."})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(wm,{className:"h-4 w-4 text-muted-foreground"}),o.jsx("span",{className:"text-sm font-medium",children:"Featured Content"})]}),o.jsx(Zi,{checked:m,onCheckedChange:K})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Featured articles are prioritized in internal link suggestions."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(NS,{className:"h-4 w-4 text-muted-foreground"}),o.jsx("span",{className:"text-sm font-medium",children:"Social Image"})]}),y?o.jsxs("div",{className:"relative rounded-lg overflow-hidden border",children:[o.jsx("img",{src:y,alt:"Social preview",className:"w-full h-32 object-cover"}),o.jsx(le,{variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:J,children:o.jsx(mr,{className:"h-3 w-3"})})]}):o.jsx("div",{className:"border-2 border-dashed rounded-lg p-4 text-center cursor-pointer hover:border-muted-foreground/50 transition-colors",onClick:()=>{var de;return(de=a.current)==null?void 0:de.click()},children:w?o.jsx(Me,{className:"h-5 w-5 mx-auto animate-spin text-muted-foreground"}):o.jsxs(o.Fragment,{children:[o.jsx(G1,{className:"h-5 w-5 mx-auto mb-2 text-muted-foreground"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Upload image"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"1200x630px recommended"})]})}),o.jsx("input",{ref:a,type:"file",accept:"image/*",className:"hidden",onChange:V})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(lH,{className:"h-4 w-4 text-muted-foreground"}),o.jsx("span",{className:"text-sm font-medium",children:"Meta Title"})]}),o.jsx(gt,{value:d,onChange:de=>W(de.target.value),placeholder:"SEO title...",className:"text-sm"}),o.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[o.jsx("span",{children:"Shown in search results"}),o.jsxs("span",{className:ne(d.length>60&&"text-amber-600"),children:[d.length,"/60"]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(lH,{className:"h-4 w-4 text-muted-foreground"}),o.jsx("span",{className:"text-sm font-medium",children:"Meta Description"})]}),o.jsx(dl,{value:h,onChange:de=>G(de.target.value),placeholder:"SEO description...",className:"text-sm resize-none",rows:3}),o.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[o.jsx("span",{children:"Shown in search results"}),o.jsxs("span",{className:ne(h.length>160&&"text-amber-600"),children:[h.length,"/160"]})]})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Wr,{className:"h-4 w-4 text-muted-foreground"}),o.jsx("span",{className:"text-sm font-medium",children:"Source Overview"}),$.length>0&&o.jsx(Ge,{variant:"secondary",className:"text-xs",children:$.length})]}),o.jsx("div",{className:"max-h-48 overflow-y-auto space-y-2",children:$.length>0?$.map((de,Te)=>o.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg border text-sm hover:bg-muted/50 transition-colors group",children:[o.jsxs("button",{type:"button",className:"flex-1 min-w-0 text-left",onClick:()=>{const Pe=document.querySelector(".tiptap.ProseMirror");
5116if(Pe){const se=Pe.querySelector(`a[href="${de.url}"]`);se&&(se.scrollIntoView({behavior:"smooth",block:"center"}),se.classList.add("ring-2","ring-primary","ring-offset-2"),setTimeout(()=>{se.classList.remove("ring-2","ring-primary","ring-offset-2")},2e3))}},children:[o.jsx("div",{className:"font-medium text-foreground truncate",children:de.title}),o.jsx("div",{className:"text-xs text-muted-foreground truncate",children:de.url})]}),o.jsx("a",{href:de.url,target:"_blank",rel:"noopener noreferrer",className:"shrink-0 p-1.5 rounded hover:bg-muted transition-colors opacity-50 group-hover:opacity-100",onClick:Pe=>Pe.stopPropagation(),children:o.jsx(Wr,{className:"h-3.5 w-3.5"})})]},Te)):o.jsx("p",{className:"text-sm text-muted-foreground py-2",children:"No links found in the article content."})})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(iu,{className:"h-4 w-4 text-muted-foreground"}),o.jsx("span",{className:"text-sm font-medium",children:"Suggested Internal Links"}),(E==null?void 0:E.internalLinks)&&E.internalLinks.length>0&&o.jsx(Ge,{variant:"secondary",className:"text-xs",children:E.internalLinks.length})]}),o.jsx("div",{className:"max-h-48 overflow-y-auto space-y-2",children:E!=null&&E.internalLinks&&E.internalLinks.length>0?E.internalLinks.map((de,Te)=>o.jsxs("a",{href:de.url,target:"_blank",rel:"noopener noreferrer",className:"block px-3 py-2 rounded-lg border text-sm hover:bg-muted/50 transition-colors",children:[o.jsx("div",{className:"font-medium text-foreground truncate",children:de.title}),o.jsx("div",{className:"text-xs text-muted-foreground truncate",children:de.url})]},Te)):o.jsx("p",{className:"text-sm text-muted-foreground py-2",children:E!=null&&E.content?"No direct links suggested based on discovered pages.":"Links will be suggested after article generation."})})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(pTe,{className:"h-4 w-4 text-muted-foreground"}),o.jsx("span",{className:"text-sm font-medium",children:"Schema Markup"})]}),o.jsx(le,{variant:"ghost",size:"sm",className:"text-xs h-6",onClick:()=>{E.schemaJson&&(navigator.clipboard.writeText(JSON.stringify(E.schemaJson,null,2)),ge.success("Schema copied"))},children:"Copy"})]}),o.jsx("div",{className:"bg-muted/30 rounded-lg border p-3 overflow-hidden",children:o.jsx("pre",{className:"text-xs font-mono overflow-x-auto max-h-[150px] overflow-y-auto select-all text-muted-foreground",children:E.schemaJson?JSON.stringify(E.schemaJson,null,2).substring(0,400)+"...":E.content?"Schema failed to generate.":"Schema not generated yet."})})]})]})})]})]})]}):o.jsxs("div",{className:"flex flex-col items-center justify-center h-[calc(100vh-4rem)]",children:[o.jsx("h2",{className:"text-xl font-semibold",children:"Article not found"}),o.jsxs(le,{variant:"ghost",className:"mt-4",onClick:()=>n(`/company/${t}/content`),children:[o.jsx(Ii,{className:"h-4 w-4 mr-2"}),"Back to articles"]})]})}const x8t={draft:"bg-amber-500/20 border-amber-500",published:"bg-green-500/20 border-green-500",archived:"bg-gray-500/20 border-gray-500"},y8t={research:"Researching",writing:"Writing",summary:"Summarizing",internalLinks:"Linking",schema:"Schema"};function v8t(){const{companyId:t}=Gr(),e=Nr(),n=Sa(),[r,i]=b.useState(""),[s,a]=b.useState("all"),[l,c]=b.useState(new Set),[u,d]=b.useState(!1),[f,h]=b.useState(!1),{data:p,isLoading:m}=En({queryKey:["articles",t,r,s],queryFn:async()=>{const j=new URLSearchParams;return r&&j.append("search",r),s!=="all"&&j.append("status",s),await Ce.get(`/companies/${t}/articles?${j.toString()}`)},enabled:!!t,refetchInterval:j=>{var A;return(A=j.state.data)!=null&&A.some(C=>C.generationStatus==="generating")?3e3:!1}}),x=un({mutationFn:async j=>{await Ce.post(`/companies/${t}/articles/bulk-delete`,{articleIds:j})},onSuccess:()=>{n.invalidateQueries({queryKey:["articles",t]}),c(new Set),d(!1)}}),y=j=>{c(j&&p?new Set(p.map(A=>A.id)):new Set)},g=(j,A)=>{const C=new Set(l);A?C.add(j):C.delete(j),c(C)},w=async()=>
5116{if(l.size!==0){h(!0);try{await x.mutateAsync(Array.from(l))}finally{h(!1)}}},v=p&&p.length>0&&l.size===p.length,N=l.size>0&&p&&l.size<p.length,S=()=>{e(`/company/${t}/content/create`)},_=j=>{e(`/company/${t}/content/${j}`)};return o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Content",noIndex:!0}),o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4 py-3 border-b bg-background px-6 sticky top-0 z-10",children:[o.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[o.jsxs("div",{className:"relative flex-1 max-w-md",children:[o.jsx(Xa,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),o.jsx(gt,{placeholder:"Search articles...",value:r,onChange:j=>i(j.target.value),className:"pl-9 h-9"})]}),o.jsxs(Tr,{value:s,onValueChange:a,children:[o.jsx(yr,{className:"w-[130px] h-9",children:o.jsx(Vr,{placeholder:"Status"})}),o.jsxs(vr,{children:[o.jsx(Ht,{value:"all",children:"All Status"}),o.jsx(Ht,{value:"draft",children:"Draft"}),o.jsx(Ht,{value:"published",children:"Published"}),o.jsx(Ht,{value:"archived",children:"Archived"})]})]})]}),o.jsxs(le,{size:"sm",onClick:S,children:[o.jsx(yi,{className:"h-3.5 w-3.5"}),"Create Article"]})]}),o.jsxs("div",{className:"flex flex-col flex-1 w-full",children:[l.size>0&&o.jsxs("div",{className:"flex items-center gap-3 px-6 py-3 border-b sticky top-0 bg-background z-10",children:[o.jsxs("span",{className:"text-sm font-medium",children:[l.size," ",l.size===1?"article":"articles"," selected"]}),o.jsxs("div",{className:"flex flex-1 items-center justify-end gap-2",children:[o.jsxs(le,{variant:"destructive",size:"sm",onClick:()=>d(!0),children:[o.jsx(Yi,{className:"h-4 w-4"}),"Delete"]}),o.jsx(le,{variant:"outline",size:"sm",onClick:()=>c(new Set),children:"Clear selection"})]})]}),o.jsx("div",{className:"flex flex-1",children:m?o.jsx("div",{className:"flex flex-1 items-center justify-center",children:o.jsx(Me,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):!p||p.length===0?o.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center py-12 text-center",children:[o.jsx(Ao,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),o.jsx("h3",{className:"text-lg font-medium",children:"No articles yet"}),o.jsx("p",{className:"text-sm text-muted-foreground mt-1 mb-4",children:"Create your first article to get started with content generation."}),o.jsxs(le,{onClick:S,className:"gap-1.5",children:[o.jsx(yi,{className:"h-4 w-4"}),"Create Article"]})]}):o.jsxs(u$t,{className:"card-table",children:[o.jsx(d$t,{children:o.jsxs(pee,{children:[o.jsx(Np,{className:"w-10 max-w-10 h-12 text-right",children:o.jsx(Yr,{checked:v,indeterminate:N,onChange:j=>y(j.target.checked)})}),o.jsx(Np,{children:"Title"}),o.jsx(Np,{className:"w-[120px]",children:"Status"}),o.jsx(Np,{className:"w-[50px] text-center hidden sm:table-cell",children:o.jsx(To,{className:"h-4 w-4 mx-auto text-muted-foreground"})}),o.jsx(Np,{className:"hidden sm:table-cell w-[80px]",children:"Words"}),o.jsx(Np,{className:"hidden lg:table-cell",children:"Updated"}),o.jsx(Np,{className:"w-10"})]})}),o.jsx(f$t,{children:p.map(j=>{var A;return o.jsxs(pee,{className:`cursor-pointer hover:bg-muted/50 ${j.generationStatus==="generating"?"bg-blue-500/5":j.generationStatus==="failed"?"bg-rose-500/5":l.has(j.id)?"!bg-primary/5":""}`,onClick:()=>_(j.id),children:[o.jsx(jp,{className:"text-right",onClick:C=>C.stopPropagation(),children:o.jsx(Yr,{checked:l.has(j.id),onChange:C=>g(j.id,C.target.checked)})}),o.jsx(jp,{children:o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[j.generationStatus==="generating"?o.jsx(Me,{className:"h-4 w-4 text-primary flex-shrink-0 animate-spin"}):o.jsx(Ao,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),o.jsx("span",{className:"font-medium truncate",children:j.title})]})}),o.jsx(jp,{children:j.generationStatus==="generating"?o.jsx(Ge,{variant:"outline",className:"text-xs bg-blue-500/20 border-blue-500",children:y8t[j.generationCurrentStep||""]||"Generating"}):j.generationStatus==="failed"?o.jsx(Ge,{variant:"outline",className:"text-xs bg-rose-500/20 border-rose-500",children:"Failed"}):o.jsx(Ge,{variant:"outline",className:`text-xs ${x8t[j.status]}`,children:j.status.charAt(0).toUpperCase()+j.status.slice(1)})}),o.jsx(jp,{className:"text-center hidden sm:table-cell",children:j.isPublic?o.jsx(To,{className:"h-4 w-4 mx-auto text-primary"}):o.jsx(Zk,{className:"h-4 w-4 mx-auto text-muted-foreground"})}),o.jsx(jp,{className:"hidden sm:table-cell text-muted-foreground",children:((A=j.actualWordCount)==null?void 0:A.toLocaleStr
5116ing())||0}),o.jsx(jp,{className:"hidden lg:table-cell text-muted-foreground text-sm",children:d9(new Date(j.updatedAt),{addSuffix:!0})}),o.jsx(jp,{children:o.jsxs(gc,{children:[o.jsx(xc,{asChild:!0,onClick:C=>C.stopPropagation(),children:o.jsx(le,{variant:"outline",size:"icon",className:"h-8 w-8",children:o.jsx(ru,{className:"h-4 w-4"})})}),o.jsxs(vl,{align:"end",children:[o.jsxs(lr,{onClick:C=>{C.stopPropagation(),_(j.id)},children:[o.jsx(Eh,{className:"h-4 w-4 mr-2"}),"View"]}),o.jsxs(lr,{className:"text-destructive",onClick:C=>{C.stopPropagation(),c(new Set([j.id])),d(!0)},children:[o.jsx(Yi,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})})]},j.id)})})]})}),p&&p.length>0&&o.jsxs("div",{className:"text-sm text-muted-foreground px-6 py-3 border-t",children:["Showing ",p.length," articles"]})]})]}),o.jsx(ur,{open:u,onOpenChange:d,children:o.jsxs(tr,{children:[o.jsxs(dr,{children:[o.jsxs(fr,{className:"flex items-center gap-2",children:[o.jsx(Yi,{className:"h-5 w-5 text-destructive"}),"Delete ",l.size," ",l.size===1?"Article":"Articles"]}),o.jsxs(hr,{children:["This action cannot be undone. This will permanently delete the selected ",l.size===1?"article":"articles","."]})]}),p&&l.size>0&&o.jsx("div",{className:"py-4",children:o.jsxs("div",{className:"rounded-lg border bg-muted/50 p-4 max-h-32 overflow-y-auto",children:[o.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Selected articles:"}),o.jsxs("ul",{className:"text-sm space-y-1",children:[Array.from(l).slice(0,5).map(j=>{const A=p.find(C=>C.id===j);return o.jsxs("li",{className:"truncate",children:["• ",A==null?void 0:A.title]},j)}),l.size>5&&o.jsxs("li",{className:"text-muted-foreground",children:["...and ",l.size-5," more"]})]})]})}),o.jsxs(Pr,{children:[o.jsx(le,{variant:"outline",onClick:()=>d(!1),children:"Cancel"}),o.jsx(le,{variant:"destructive",onClick:w,disabled:f,children:f?o.jsxs(o.Fragment,{children:[o.jsx(Me,{className:"h-4 w-4 animate-spin mr-2"}),"Deleting..."]}):o.jsxs(o.Fragment,{children:[o.jsx(Yi,{className:"h-4 w-4 mr-2"}),"Delete ",l.size," ",l.size===1?"Article":"Articles"]})})]})]})})]})}function b8t(){const{setOpen:t}=ca();return b.useEffect(()=>{t(!1)},[t]),o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"AI Agent"}),o.jsxs("div",{className:"flex h-full overflow-hidden",children:[o.jsx("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:o.jsx(xhe,{})}),o.jsx("div",{className:"w-[280px] flex-shrink-0 overflow-hidden border-l border-border/50 bg-card/30",children:o.jsx(yhe,{})})]})]})}function w8t(){const[t,e]=b.useState("7d"),{data:n,isLoading:r}=En({queryKey:["admin-stats",t],queryFn:()=>Ce.get(`/admin/stats?period=${t}`)}),{data:i}=En({queryKey:["admin-openrouter-balance"],queryFn:()=>Ce.get("/admin/openrouter-balance"),refetchInterval:6e4}),{data:s}=En({queryKey:["admin-package-estimates"],queryFn:()=>Ce.get("/admin/package-cost-estimates")}),a=c=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:4}).format(c),l=c=>new Intl.NumberFormat("en-US").format(c);return r?o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Admin Dashboard",noIndex:!0}),o.jsx("div",{className:"flex h-64 items-center justify-center",children:o.jsx(Me,{className:"h-8 w-8 animate-spin text-primary"})})]}):o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Admin Dashboard",noIndex:!0}),o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-3xl font-bold",children:"Admin Dashboard"}),o.jsx("p",{className:"mt-1 text-muted-foreground",children:"Platform overview and AI usage statistics"})]}),o.jsx(J0,{value:t,onValueChange:e,children:o.jsxs(Bg,{children:[o.jsx(pi,{value:"today",children:"Today"}),o.jsx(pi,{value:"7d",children:"7 Days"}),o.jsx(pi,{value:"30d",children:"30 Days"})]})})]}),o.jsxs("div",{className:"grid gap-4 md:grid-cols-4",children:[o.jsxs(Dt,{children:[o.jsxs(Zt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(tn,{className:"text-sm font-medium",children:"Total Users"}),o.jsx(uc,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Vt,{children:[o.jsx("div",{className:"text-2xl font-bold",children:l((n==null?void 0:n.users.totalUsers)??0)}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:[(n==null?void 0:n.users.paidUsers)??0," paid, ",(n==null?void 0:n.users.freeUsers)??0," free"]})]})]}),o.jsxs(Dt,{children:[o.jsxs(Zt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(tn,{className:"text-sm font-medium",children:"Companies"}),o.jsx(lv,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Vt,{children:[o.jsx("div",{className:"text-2xl font-bold",children:l((n==null?void 0:n.companies.totalCompanies)??0)}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Registered companies"})]})]}),o.jsxs(Dt,{children:[o.jsxs(Zt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(tn,{className:"text-sm font-medium",children:"Queries"}),o.jsx(Mo,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Vt,{children:[o.jsx("div",{className:"text-2xl font-bold",children:l((n==null?void 0:n.queries.totalQuer
5116ies)??0)}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:[(n==null?void 0:n.queries.activeQueries)??0," active"]})]})]}),o.jsxs(Dt,{children:[o.jsxs(Zt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(tn,{className:"text-sm font-medium",children:"Active Users"}),o.jsx(Zu,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Vt,{children:[o.jsx("div",{className:"text-2xl font-bold",children:l((n==null?void 0:n.usage.uniqueUsers)??0)}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"In selected period"})]})]})]}),o.jsxs("div",{className:"grid gap-4 md:grid-cols-5",children:[o.jsxs(Dt,{className:"border-primary/50",children:[o.jsxs(Zt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(tn,{className:"text-sm font-medium",children:"Platform Estimate"}),o.jsx(gTe,{className:"h-4 w-4 text-primary"})]}),o.jsxs(Vt,{children:[o.jsx("div",{className:"text-2xl font-bold text-primary",children:a((n==null?void 0:n.usage.totalCost)??0)}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:[a((n==null?void 0:n.usage.avgCostPerRequest)??0)," per request"]})]})]}),o.jsxs(Dt,{children:[o.jsxs(Zt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(tn,{className:"text-sm font-medium",children:"OpenRouter Usage"}),o.jsx(bo,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsx(Vt,{children:i&&i.usage!==null?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"text-2xl font-bold",children:a(i.usage)}),i.limit&&o.jsxs("p",{className:"text-xs text-muted-foreground",children:[a(i.remaining??0)," remaining"]})]}):o.jsx("div",{className:"text-sm text-muted-foreground",children:(i==null?void 0:i.error)||"Loading..."})})]}),o.jsxs(Dt,{children:[o.jsxs(Zt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(tn,{className:"text-sm font-medium",children:"AI Requests"}),o.jsx(jz,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Vt,{children:[o.jsx("div",{className:"text-2xl font-bold",children:l((n==null?void 0:n.usage.totalRequests)??0)}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:[a((n==null?void 0:n.usage.avgCostPerUser)??0)," avg/user"]})]})]}),o.jsxs(Dt,{children:[o.jsxs(Zt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(tn,{className:"text-sm font-medium",children:"Input Tokens"}),o.jsx(SS,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Vt,{children:[o.jsx("div",{className:"text-2xl font-bold",children:l((n==null?void 0:n.usage.totalInputTokens)??0)}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Tokens sent to LLMs"})]})]}),o.jsxs(Dt,{children:[o.jsxs(Zt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(tn,{className:"text-sm font-medium",children:"Output Tokens"}),o.jsx(Ud,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Vt,{children:[o.jsx("div",{className:"text-2xl font-bold",children:l((n==null?void 0:n.usage.totalOutputTokens)??0)}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Tokens received from LLMs"})]})]})]}),s&&o.jsxs(Dt,{children:[o.jsx(Zt,{children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsxs(tn,{className:"flex items-center gap-2",children:[o.jsx(qse,{className:"h-5 w-5"}),"Package Operating Costs"]}),o.jsxs(Kn,{children:["Based on ",s.dataSpan.days," days of data (",l(s.metrics.queryExecutions)," query runs, ~",s.metrics.dailyQueryExecutions,"/day) • ",a(s.metrics.actualDailyCostUsd),"/day actual • ",a(s.metrics.costPerFullRunUsd)," per LLM run"]})]}),o.jsx(Ge,{variant:s.source==="openrouter"?"default":"secondary",children:s.source==="openrouter"?"OpenRouter Actual":"Platform Estimate"})]})}),o.jsx(Vt,{children:o.jsx("div",{className:"space-y-4",children:s.packages.map(c=>o.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border",children:[o.jsx("div",{className:"flex items-center gap-4",children:o.jsxs("div",{children:[o.jsx("p",{className:"font-medium",children:c.packageName}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:[c.promptsPerMonth," prompts × ",c.llmsIncluded," LLMs = ",c.dailyRuns,"/day (",l(c.monthlyRuns),"/month)"]})]})}),o.jsxs("div",{className:"flex items-center gap-6 text-sm",children:[o.jsxs("div",{className:"text-right",children:[o.jsx("p",{className:"text-muted-foreground",children:"Daily (USD)"}),o.jsx("p",{className:"font-medium",children:a(c.estimatedDailyCostUsd)})]}),o.jsxs("div",{className:"text-right",children:[o.jsx("p",{className:"text-muted-foreground",children:"Monthly (USD)"}),o.jsx("p",{className:"font-medium",children:a(c.estimatedMonthlyCostUsd)})]}),o.jsxs("div",{className:"text-right",children:[o.jsxs("p",{className:"text-muted-foreground",children:["Cost (",c.priceCurrency,")"]}),o.jsxs("p",{className:"font-medium",children:[c.estimatedMonthlyCostLocal.toLocaleStr
5116ing()," ",c.priceCurrency]})]}),o.jsxs("div",{className:"text-right",children:[o.jsxs("p",{className:"text-muted-foreground",children:["Price (",c.priceCurrency,")"]}),o.jsx("p",{className:"font-medium",children:c.priceAmount>0?`${c.priceAmount.toLocaleString()} ${c.priceCurrency}`:"Free"})]}),o.jsx("div",{className:"w-30 text-center",children:c.profitMargin!==null?o.jsxs(Ge,{variant:c.profitMargin>50?"default":c.profitMargin>0?"secondary":"destructive",children:[c.profitMargin,"% margin"]}):o.jsx(Ge,{variant:"outline",children:"N/A"})})]})]},c.packageId))})})]}),o.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[o.jsxs(Dt,{children:[o.jsxs(Zt,{children:[o.jsx(tn,{children:"Usage by Operation"}),o.jsx(Kn,{children:"AI requests by operation type"})]}),o.jsx(Vt,{children:n!=null&&n.byOperation&&n.byOperation.length>0?o.jsx("div",{className:"space-y-3",children:n.byOperation.map(c=>o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("div",{className:"flex items-center gap-3",children:o.jsx("div",{className:"font-medium capitalize",children:c.operationType.replace(/_/g," ")})}),o.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[o.jsxs("span",{className:"text-muted-foreground",children:[l(c.count)," requests"]}),o.jsx("span",{className:"font-medium",children:a(c.totalCost)})]})]},c.operationType))}):o.jsx("p",{className:"text-muted-foreground text-sm",children:"No data for this period"})})]}),o.jsxs(Dt,{children:[o.jsxs(Zt,{children:[o.jsx(tn,{children:"Usage by Model"}),o.jsx(Kn,{children:"Top 10 models by usage"})]}),o.jsx(Vt,{children:n!=null&&n.byModel&&n.byModel.length>0?o.jsx("div",{className:"space-y-3",children:n.byModel.map(c=>o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("div",{className:"flex items-center gap-3",children:o.jsx("div",{className:"font-medium text-sm truncate max-w-[200px]",children:c.modelId})}),o.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[o.jsx("span",{className:"text-muted-foreground",children:l(c.count)}),o.jsx("span",{className:"font-medium",children:a(c.totalCost)})]})]},c.modelId))}):o.jsx("p",{className:"text-muted-foreground text-sm",children:"No data for this period"})})]})]})]})]})}function _8t(){const t=Sa(),[e,n]=b.useState(!1),[r,i]=b.useState(null),[s,a]=b.useState(new Set),[l,c]=b.useState({name:"",description:"",priceAmount:0,priceCurrency:"dkk",billingInterval:"month",promptsPerMonth:3,llmsIncluded:2,tokensPerMonth:0,isActive:!0,isFeatured:!1,displayOrder:0}),u=Ig(),{data:d=[],isLoading:f}=En({queryKey:["admin-packages"],queryFn:()=>Ce.get("/admin/packages")}),{data:h=[]}=En({queryKey:["admin-features"],queryFn:()=>Ce.get("/admin/features")}),{data:p}=En({queryKey:["admin-package",r==null?void 0:r.id],queryFn:()=>Ce.get(`/admin/packages/${r.id}`),enabled:!!(r!=null&&r.id)}),m=un({mutationFn:()=>Ce.post("/admin/packages/sync-stripe"),onSuccess:T=>{t.invalidateQueries({queryKey:["admin-packages"]}),ge.success(`Synced ${T.synced} packages, created ${T.created} new`)},onError:T=>{ge.error(T.message||"Failed to sync with Stripe")}}),x=un({mutationFn:T=>r?Ce.patch(`/admin/packages/${r.id}`,T):Ce.post("/admin/packages",T),onSuccess:T=>{t.invalidateQueries({queryKey:["admin-packages"]});const D=[];r?(D.push("Package updated"),T.usersSynced&&T.usersUpdated>0&&D.push(`${T.usersUpdated} user(s) updated`),T.stripeSynced&&D.push("Stripe price updated")):D.push("Package created"),ge.success(D.join(" • ")),M()},onError:T=>{ge.error(T.message||"Failed to save package")}}),y=un({mutationFn:T=>Ce.delete(`/admin/packages/${T}`),onSuccess:()=>{t.invalidateQueries({queryKey:["admin-packages"]}),ge.success("Package deleted")},onError:T=>{ge.error(T.message||"Failed to delete package")}}),g=un({mutationFn:T=>Ce.post(`/admin/packages/${T}/push-to-stripe`),onSuccess:()=>{t.invalidateQueries({queryKey:["admin-packages"]}),ge.success("Package pushed to Stripe")},onError:T=>{ge.error(T.message||"Failed to push to Stripe")}}),w=un({mutationFn:async({ids:T,isActive:D})=>{await Promise.all(T.map(F=>Ce.patch(`/admin/packages/${F}`,{isActive:D})))},onSuccess:(T,{ids:D,isActive:F})=>{t.invalidateQueries({queryKey:["admin-packages"]}),ge.success(`${D.length} package(s) ${F?"activated":"deactivated"}`),a(new Set)},onError:T=>{ge.error(T.message||"Failed to update packages")}}),v=un({mutationFn:({packageId:T,featureId:D,valueBoolean:F,valueNumber:q,valueText:B})=>Ce.post(`/admin/packages/${T}/features`,{featureId:D,valueBoolean:F,valueNumber:q,valueText:B}),onSuccess:()=>{t.invalidateQueries({queryKey:["admin-package",r==null?void 0:r.id]})},onError:T=>{ge.error(T.message||"Failed to update feature")}}),N=un({mutationFn:({packageId:T,featureId:D})=>Ce.delete(`/admin/packages/${T}/features/${D}`),onSuccess:()=>{t.invalidateQueries({queryKey:["admin-package",r==null?void 0:r.id]})},onError:T=>{ge.error(T.message||"Failed to remove feature")}}),S=d.filter(T=>T.isActive),_=d.filter(T=>!T.isActive),j=[...s].filter(T=>S.some(D=>D.id===T)),A=[...s].filter(T=>_.some(D=>D.id===T)),C=T=>{a(D=>{const F=new Set(D);return F.has(T)?F.delete(T):F.add(T),F})},k=T=>{const D=T.every(F=>s.has(F.id));a(F=>{const q=new Set(F);return D?T.forEach(B=>q.delete(B.id)):T.forEach(B=>q.add(B.id)),q})},M=()=>{n(!1),i(null),c({name:"",description:"",priceAmount:0,priceCurrency:"dkk",billingInterval:"month",promptsPerMonth:3,llmsIncluded:2,tokensPerMonth:0,isActive:!0,isFeatured:!1,displayOrder:0})},I=T=>{i(T),c({name:T.name,description:T.description||"",priceAmount:T.priceAmount,priceCurrency:T.priceCurrency,billingInterval:T.billingInterval,promptsPerMonth:T.promptsPerMonth,llmsIncluded:T.llmsIncluded,tokensPerMonth:T.tokensPerMonth,isActive:T.isActive,isFeatured:T.isFeatured,displayOrder:T.displayOrder}),n(!0)},R=(p==null?void 0:p.packageFeatures)||[],E=new Map(R.map(T=>[T.featureId,T])),P=(T,D)=>{r&&(D?v.mutate({packageId:r.id,featureId:T.id,valueBoolean:T.valueType==="boolean"?!0:void 0,valueNumber:T.valueType==="number"?0:void 0,valueText:T.valueType==="text"?"":void 0}):N.mutate({packageId:r.id,featureId:T.id}))},O=(T,D)=>{r&&v.mutate({packageId:r.id,featureId:T.id,valueBoolean:T.valueType==="boolean"?D:void 0,valueNumber:T.valueType==="number"?D:void 0,valueText:T.valueType==="text"?D:void 0})},L=(T,D,F)=>`${new Intl.NumberFormat("da-DK",{style:"currency",currency:D.toUpperCase(),minimumFractionDigits:0}).format(T/100)}/${F}`;return f?o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Packages",noIndex:!0}),o.jsx("div",{className:"flex h-64 items-center justify-center",children:o.jsx(Me,{className:"h-8 w-8 animate-spin text-primary"})})]}):o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Packages",noIndex:!0}),o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-3xl font-bold",children:"Packages"}),o.jsx("p",{className:"mt-1 text-muted-foreground",children:"Manage subscription packages and their limits"})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs(le,{variant:"outline",onClick:()=>m.mutate(),disabled:m.isPending,children:[m.isPending?o.jsx(Me,{className:"mr-2 h-4 w-4 animate-spin"}):o.jsx(ws,{className:"h-4 w-4"}),"Sync from Stripe"]}),o.jsxs(le,{onClick:()=>n(!0),children:[o.jsx(yi,{className:"h-4 w-4"}),"Add Package"]})]})]}),o.jsxs(Dt,{children:[o.jsxs(Zt,{className:"flex flex-row items-center justify-between",children:[o.jsxs("div",{children:[o.jsx(tn,{children:"Active Packages"}),o.jsx(Kn,{children:"These packages are visible to users and available for subscription"})]}),j.length>0&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("span",{className:"text-sm text-muted-foreground",children:[j.length," selected"]}),o.jsxs(le,{variant:"outline",size:"sm",onClick:()=>w.mutate({ids:j,isActive:!1}),disabled:w.isPending,children:[w.isPending?o.jsx(Me,{className:"mr-2 h-4 w-4 animate-spin"}):o.jsx(Dse,{className:"h-4 w-4"}),"Deactivate"]}),o.jsx(le,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>a(new Set),children:o.jsx(mr,{className:"h-4 w-4"})})]})]}),o.jsx(Vt,{children:S.length===0?o.jsx("p",{className:"text-muted-foreground text-sm text-center py-8",children:"No active packages"}):o.jsx("div",{className:"rounded-lg border overflow-hidden",children:o.jsxs("table",{className:"w-full",children:[o.jsx("thead",{className:"bg-muted/50",children:o.jsxs("tr",{children:[o.jsx("th",{className:"px-4 py-3 w-10",children:o.jsx(Yr,{checked:S.length>0&&S.every(T=>s.has(T.id)),onChange:()=>k(S)})}),o.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground",children:"Package"}),o.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground",children:"Price"}),o.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-muted-foreground",children:"Prompts/mo"}),o.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-muted-foreground",children:"LLMs"}),o.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-muted-foreground",children:"Tokens/mo"}),o.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground",children:"Added"}),o.jsx("th",{className:"px-4 py-3 w-10"})]})}),o.jsx("tbody",{className:"divide-y divide-border",children:S.map(T=>o.jsxs("tr",{className:"hover:bg-accent/50",children:[o.jsx("td",{className:"px-4 py-3",children:o.jsx(Yr,{checked:s.has(T.id),onChange:()=>C(T.id)})}),o.jsxs("td",{className:"px-4 py-3",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"font-medium",children:T.name}),T.isFeatured&&o.jsxs(Ge,{variant:"secondary",className:"gap-1",children:[o.jsx(wm,{className:"h-3 w-3"})," Featured"]})]}),T.stripeProductId&&o.jsx("p",{className:"text-xs text-muted-foreground mt-1 truncate max-w-[200px]",children:T.stripeProductId})]}),o.jsx("td",{className:"px-4 py-3 font-medium",children:T.priceAmount===0?"Free":L(T.priceAmount,T.priceCurrency,T.billingInterval)}),o.jsx("td",{className:"px-4 py-3 text-center",children:T.promptsPerMonth}),o.jsx("td",{className:"px-4 py-3 text-center",children:T.llmsIncluded}),o.jsx("td",{className:"px-4 py-3 text-center",children:T.tokensPerMonth}),o.jsx("td",{className:"px-4 py-3 text-sm text-muted-foreground whitespace-nowrap",children:bl(T.createdAt,u)}),o.jsx("td",{className:"px-4 py-3",children:o.jsxs(gc,{children:[o.jsx(xc,{asChild:!0,children:o.jsx(le,{variant:"ghost",size:"icon",className:"h-8 w-8",children:o.jsx(ru,{className:"h-4 w-4"})})}
5116),o.jsxs(vl,{align:"end",children:[o.jsxs(lr,{onClick:()=>I(T),children:[o.jsx(cv,{className:"h-4 w-4"})," Edit"]}),!T.stripeProductId&&T.priceAmount>0&&o.jsxs(lr,{onClick:()=>g.mutate(T.id),disabled:g.isPending,children:[o.jsx(G1,{className:"h-4 w-4"})," Push to Stripe"]}),o.jsx(Ad,{}),o.jsxs(lr,{onClick:()=>{confirm("Delete this package?")&&y.mutate(T.id)},className:"text-destructive focus:text-destructive",children:[o.jsx(Yi,{className:"mr-2 h-4 w-4"})," Delete"]})]})]})})]},T.id))})]})})})]}),_.length>0&&o.jsxs(Dt,{children:[o.jsxs(Zt,{className:"flex flex-row items-center justify-between",children:[o.jsxs("div",{children:[o.jsx(tn,{className:"text-muted-foreground",children:"Inactive Packages"}),o.jsx(Kn,{children:"These packages are hidden from users. Configure limits and activate when ready."})]}),A.length>0&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("span",{className:"text-sm text-muted-foreground",children:[A.length," selected"]}),o.jsxs(le,{variant:"outline",size:"sm",onClick:()=>w.mutate({ids:A,isActive:!0}),disabled:w.isPending,children:[w.isPending?o.jsx(Me,{className:"mr-2 h-4 w-4 animate-spin"}):o.jsx(Eh,{className:"h-4 w-4"}),"Activate"]}),o.jsx(le,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>a(new Set),children:o.jsx(mr,{className:"h-4 w-4"})})]})]}),o.jsx(Vt,{children:o.jsx("div",{className:"rounded-lg border overflow-hidden",children:o.jsxs("table",{className:"w-full",children:[o.jsx("thead",{className:"bg-muted/50",children:o.jsxs("tr",{children:[o.jsx("th",{className:"px-4 py-3 w-10",children:o.jsx(Yr,{checked:_.length>0&&_.every(T=>s.has(T.id)),onChange:()=>k(_)})}),o.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground",children:"Package"}),o.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground",children:"Price"}),o.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-muted-foreground",children:"Prompts/mo"}),o.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-muted-foreground",children:"LLMs"}),o.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-muted-foreground",children:"Tokens/mo"}),o.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground",children:"Added"}),o.jsx("th",{className:"px-4 py-3 w-10"})]})}),o.jsx("tbody",{className:"divide-y divide-border",children:_.map(T=>o.jsxs("tr",{className:"hover:bg-accent/50 opacity-60",children:[o.jsx("td",{className:"px-4 py-3",children:o.jsx(Yr,{checked:s.has(T.id),onChange:()=>C(T.id)})}),o.jsxs("td",{className:"px-4 py-3",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"font-medium",children:T.name}),T.isFeatured&&o.jsxs(Ge,{variant:"secondary",className:"gap-1",children:[o.jsx(wm,{className:"h-3 w-3"})," Featured"]})]}),T.stripeProductId&&o.jsx("p",{className:"text-xs text-muted-foreground mt-1 truncate max-w-[200px]",children:T.stripeProductId})]}),o.jsx("td",{className:"px-4 py-3 font-medium",children:T.priceAmount===0?"Free":L(T.priceAmount,T.priceCurrency,T.billingInterval)}),o.jsx("td",{className:"px-4 py-3 text-center",children:T.promptsPerMonth}),o.jsx("td",{className:"px-4 py-3 text-center",children:T.llmsIncluded}),o.jsx("td",{className:"px-4 py-3 text-center",children:T.tokensPerMonth}),o.jsx("td",{className:"px-4 py-3 text-sm text-muted-foreground whitespace-nowrap",children:bl(T.createdAt,u)}),o.jsx("td",{className:"px-4 py-3",children:o.jsxs(gc,{children:[o.jsx(xc,{asChild:!0,children:o.jsx(le,{variant:"ghost",size:"icon",className:"h-8 w-8",children:o.jsx(ru,{className:"h-4 w-4"})})}),o.jsxs(vl,{align:"end",children:[o.jsxs(lr,{onClick:()=>I(T),children:[o.jsx(cv,{className:"h-4 w-4"})," Edit"]}),!T.stripeProductId&&T.priceAmount>0&&o.jsxs(lr,{onClick:()=>g.mutate(T.id),disabled:g.isPending,children:[o.jsx(G1,{className:"h-4 w-4"})," Push to Stripe"]}),o.jsx(Ad,{}),o.jsxs(lr,{onClick:()=>{confirm("Delete this package?")&&y.mutate(T.id)},className:"text-destructive focus:text-destructive",children:[o.jsx(Yi,{className:"mr-2 h-4 w-4"})," Delete"]})]})]})})]},T.id))})]})})})]}),o.jsx(ur,{open:e,onOpenChange:T=>!T&&M(),children:o.jsxs(tr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[o.jsxs(dr,{children:[o.jsx(fr,{children:r?"Edit Package":"Add Package"}),o.jsx(hr,{children:"Configure the package details, limits, and features"})]}),o.jsxs("div",{className:"space-y-6 py-4",children:[o.jsxs("div",{className:"space-y-4",children:[o.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Basic Information"}),o.jsxs("div",{className:"grid gap-4 grid-cols-2",children:[o.jsxs("div",{className:"space-y-2 col-span-2",children:[o.jsx(et,{children:"Package Name"}),o.jsx(gt,{value:l.name,onChange:T=>c({...l,name:T.target.value}),placeholder:"e.g., Pro"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{children:"Price (in smallest unit)"}),o.jsx(gt,{type:"number",value:l.priceAmount,onChange:T=>c({...l,priceAmount:parseInt(T.target.value)||0}),placeholder:"9900 = 99.00"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{children:"Currency"}),o.jsxs(Tr,{value:l.priceCurrency,onValueChange:T=>c({...l,priceCurrency:T}),children:[o.jsx(yr,{children:o.jsx(Vr,{})}),o.jsxs(vr,{children:[o.jsx(Ht,{value:"dkk",children:"DKK"}),o.jsx(Ht,{value:"usd",children:"USD"}),o.jsx(Ht,{value:"eur",children:"EUR"})]})]})]})]})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Limits"}),o.jsxs("div",{className:"grid gap-4 grid-cols-3",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{children:"Prompts per Month"}),o.jsx(gt,{type:"number",value:l.promptsPerMonth,onChange:T=>c({...l,promptsPerMonth:parseInt(T.target.value)||0})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{children:"LLMs Included"}),o.jsx(gt,{type:"number",value:l.llmsIncluded,onChange:T=>c({...l,llmsIncluded:parseInt(T.target.value)||1})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{children:"Tokens per Month"}),o.jsx(gt,{type:"number",value:l.tokensPerMonth,onChange:T=>c({...l,tokensPerMonth:parseInt(T.target.value)||0})})]})]})]}),r&&h.length>0&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Features"}),o.jsx("div",{className:"space-y-3",children:h.filter(T=>T.isActive).map(T=>{const D=E.get(T.id),F=!!D;return o.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-muted/30",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(Yr,{checked:F,onChange:()=>P(T,!F)}),o.jsxs("div",{children:[o.jsx("p",{className:"font-medium text-sm",children:T.name}),T.description&&o.jsx("p",{className:"text-xs text-muted-foreground",children:T.description})]})]}),F&&o.jsxs("div",{className:"w-32",children:[T.valueType==="boolean"&&o.jsx(Zi,{checked:(D==null?void 0:D.valueBoolean)??!1,onCheckedChange:q=>O(T,q)}),T.valueType==="number"&&o.jsx(gt,{type:"number",className:"h-8",value:(D==null?void 0:D.valueNumber)??0,onChange:q=>O(T,parseInt(q.target.value)||0)}),T.valueType==="text"&&o.jsx(gt,{className:"h-8",value:(D==null?void 0:D.valueText)??"",onChange:q=>O(T,q.target.value)})]})]},T.id)})}),h.filter(T=>T.isActive).length===0&&o.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No active features defined. 
5116Create features first."})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Display Options"}),o.jsx("div",{className:"grid gap-4 grid-cols-2",children:o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{children:"Display Order"}),o.jsx(gt,{type:"number",value:l.displayOrder,onChange:T=>c({...l,displayOrder:parseInt(T.target.value)||0})})]})}),o.jsxs("div",{className:"flex items-center gap-6",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Zi,{checked:l.isActive,onCheckedChange:T=>c({...l,isActive:T})}),o.jsx(et,{children:"Active"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Zi,{checked:l.isFeatured,onCheckedChange:T=>c({...l,isFeatured:T})}),o.jsx(et,{children:"Featured"})]})]})]})]}),o.jsxs(Pr,{children:[o.jsx(le,{variant:"outline",onClick:M,children:"Cancel"}),o.jsxs(le,{onClick:()=>x.mutate(l),disabled:x.isPending||!l.name,children:[x.isPending&&o.jsx(Me,{className:"mr-2 h-4 w-4 animate-spin"}),r?"Save Changes":"Create Package"]})]})]})})]})]})}function S8t({value:t,onChange:e,bucket:n,folder:r="",accept:i="image/*",maxSizeMB:s=5,className:a}){const[l,c]=b.useState(!1),[u,d]=b.useState(!1),f=b.useCallback(async g=>{if(g.size>s*1024*1024){ge.error(`File size must be less than ${s}MB`);return}if(!g.type.startsWith("image/")){ge.error("Only image files are allowed");return}c(!0);try{const w=g.name.split(".").pop()||"png",v=`${Date.now()}-${Math.random().toString(36).substring(7)}.${w}`,N=r?`${r}/${v}`:v,{error:S}=await co.storage.from(n).upload(N,g,{cacheControl:"3600",upsert:!1});if(S)throw S;const{data:{publicUrl:_}}=co.storage.from(n).getPublicUrl(N);e(_),ge.success("Image uploaded successfully")}catch(w){console.error("Upload error:",w),ge.error(w.message||"Failed to upload image")}finally{c(!1)}},[n,r,s,e]),h=b.useCallback(g=>{g.preventDefault(),d(!1);const w=g.dataTransfer.files[0];w&&f(w)},[f]),p=b.useCallback(g=>{g.preventDefault(),d(!0)},[]),m=b.useCallback(g=>{g.preventDefault(),d(!1)},[]),x=b.useCallback(g=>{var v;const w=(v=g.target.files)==null?void 0:v[0];w&&f(w),g.target.value=""},[f]),y=b.useCallback(()=>{e(null)},[e]);return o.jsx("div",{className:ne("space-y-2",a),children:t?o.jsxs("div",{className:"relative rounded-lg border overflow-hidden group",children:[o.jsx("img",{src:t,alt:"Uploaded image",className:"w-full h-40 object-cover"}),o.jsx("button",{type:"button",onClick:y,className:"absolute top-2 right-2 p-1.5 rounded-full bg-destructive text-destructive-foreground opacity-0 group-hover:opacity-100 transition-opacity",children:o.jsx(mr,{className:"h-4 w-4"})})]}):o.jsxs("div",{onDrop:h,onDragOver:p,onDragLeave:m,className:ne("relative border-2 border-dashed rounded-lg p-6 transition-colors cursor-pointer",u?"border-primary bg-primary/5":"border-muted-foreground/25 hover:border-muted-foreground/50",l&&"pointer-events-none opacity-50"),children:[o.jsx("input",{type:"file",accept:i,onChange:x,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:l}),o.jsx("div",{className:"flex flex-col items-center justify-center gap-2 text-center",children:l?o.jsxs(o.Fragment,{children:[o.jsx(Me,{className:"h-8 w-8 animate-spin text-muted-foreground"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Uploading..."})]}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"p-3 rounded-full bg-muted",children:u?o.jsx(NS,{className:"h-6 w-6 text-primary"}):o.jsx(G1,{className:"h-6 w-6 text-muted-foreground"})}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:u?"Drop image here":"Drop image or click to upload"}),o.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["PNG, JPG, GIF up to ",s,"MB"]})]})]})})]})})}function Pl({onClick:t,isActive:e=!1,children:n,title:r}){return o.jsx("button",{type:"button",onClick:t,title:r,className:ne("p-1.5 rounded hover:bg-accent transition-colors",e&&"bg-accent text-accent-foreground"),children:n})}function jC(){return o.jsx("div",{className:"w-px h-6 bg-border mx-1"})}function N8t({value:t,onChange:e,placeholder:n="Start writing...",className:r,minHeight:i=200}){const s=$we({extensions:[h1e.configure({heading:{levels:[1,2,3]}}),o1e,Ywe.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline"}}),p1e.configure({placeholder:n})],content:t,onUpdate:({editor:l})=>{e(l.getHTML())},editorProps:{attributes:{class:"prose prose-sm max-w-none focus:outline-none",style:`min-height: ${i}px`}}});b.useEffect(()=>{s&&t!==s.getHTML()&&s.commands.setContent(t)},[t,s]);const a=b.useCallback(()=>
5116{if(!s)return;const l=s.getAttributes("link").href,c=window.prompt("URL",l);if(c!==null){if(c===""){s.chain().focus().extendMarkRange("link").unsetLink().run();return}s.chain().focus().extendMarkRange("link").setLink({href:c}).run()}},[s]);return s?o.jsxs("div",{className:ne("rich-text-editor border rounded-lg overflow-hidden",r),children:[o.jsxs("div",{className:"flex items-center gap-0.5 p-2 border-b bg-muted/50 flex-wrap",children:[o.jsx(Pl,{onClick:()=>s.chain().focus().toggleHeading({level:1}).run(),isActive:s.isActive("heading",{level:1}),title:"Heading 1",children:o.jsx($se,{className:"h-4 w-4"})}),o.jsx(Pl,{onClick:()=>s.chain().focus().toggleHeading({level:2}).run(),isActive:s.isActive("heading",{level:2}),title:"Heading 2",children:o.jsx(Fse,{className:"h-4 w-4"})}),o.jsx(Pl,{onClick:()=>s.chain().focus().toggleHeading({level:3}).run(),isActive:s.isActive("heading",{level:3}),title:"Heading 3",children:o.jsx(Use,{className:"h-4 w-4"})}),o.jsx(jC,{}),o.jsx(Pl,{onClick:()=>s.chain().focus().toggleBold().run(),isActive:s.isActive("bold"),title:"Bold",children:o.jsx(Pse,{className:"h-4 w-4"})}),o.jsx(Pl,{onClick:()=>s.chain().focus().toggleItalic().run(),isActive:s.isActive("italic"),title:"Italic",children:o.jsx(zse,{className:"h-4 w-4"})}),o.jsx(Pl,{onClick:()=>s.chain().focus().toggleUnderline().run(),isActive:s.isActive("underline"),title:"Underline",children:o.jsx($Te,{className:"h-4 w-4"})}),o.jsx(Pl,{onClick:()=>s.chain().focus().toggleStrike().run(),isActive:s.isActive("strike"),title:"Strikethrough",children:o.jsx(Yse,{className:"h-4 w-4"})}),o.jsx(jC,{}),o.jsx(Pl,{onClick:()=>s.chain().focus().toggleBulletList().run(),isActive:s.isActive("bulletList"),title:"Bullet List",children:o.jsx(Wse,{className:"h-4 w-4"})}),o.jsx(Pl,{onClick:()=>s.chain().focus().toggleOrderedList().run(),isActive:s.isActive("orderedList"),title:"Numbered List",children:o.jsx(Hse,{className:"h-4 w-4"})}),o.jsx(jC,{}),o.jsx(Pl,{onClick:a,isActive:s.isActive("link"),title:"Add Link",children:o.jsx(Vse,{className:"h-4 w-4"})}),o.jsx(jC,{}),o.jsx(Pl,{onClick:()=>s.chain().focus().clearNodes().unsetAllMarks().run(),title:"Clear Formatting",children:o.jsx(PTe,{className:"h-4 w-4"})})]}),o.jsx(Dwe,{editor:s,className:"p-3"}),o.jsx("style",{children:`
5117        .rich-text-editor .ProseMirror {
5118          min-height: ${i}px;
5119        }
5120        .rich-text-editor .ProseMirror p.is-editor-empty:first-child::before {
5121          content: attr(data-placeholder);
5122          float: left;
5123          color: hsl(var(--muted-foreground));
5124          pointer-events: none;
5125          height: 0;
5126        }
5127        .rich-text-editor .ProseMirror:focus {
5128          outline: none;
5129        }
5130        .rich-text-editor .ProseMirror h1 {
5131          font-size: 1.5rem;
5132          font-weight: 700;
5133          margin-top: 1rem;
5134          margin-bottom: 0.5rem;
5135        }
5136        .rich-text-editor .ProseMirror h2 {
5137          font-size: 1.25rem;
5138          font-weight: 600;
5139          margin-top: 0.75rem;
5140          margin-bottom: 0.5rem;
5141        }
5142        .rich-text-editor .ProseMirror h3 {
5143          font-size: 1.1rem;
5144          font-weight: 600;
5145          margin-top: 0.5rem;
5146          margin-bottom: 0.25rem;
5147        }
5148        .rich-text-editor .ProseMirror p {
5149          margin-bottom: 0.5rem;
5150        }
5151        .rich-text-editor .ProseMirror ul,
5152        .rich-text-editor .ProseMirror ol {
5153          padding-left: 1.5rem;
5154          margin-bottom: 0.5rem;
5155        }
5156        .rich-text-editor .ProseMirror ul {
5157          list-style-type: disc;
5158        }
5159        .rich-text-editor .ProseMirror ol {
5160          list-style-type: decimal;
5161        }
5162        .rich-text-editor .ProseMirror a {
5163          color: hsl(var(--primary));
5164          text-decoration: underline;
5165        }
5166      `})]}):null}function j8t(){const t=Sa(),[e,n]=b.useState(!1),[r,i]=b.useState(null),[s,a]=b.useState({key:"",name:"",description:"",descriptionLong:"",publicImageUrl:"",valueType:"boolean",displayOrder:0,isActive:!0}),{data:l=[],isLoading:c}=En({queryKey:["admin-features"],queryFn:()=>Ce.get("/admin/features")}),{data:u}=En({queryKey:["admin-features-with-packages"],queryFn:()=>Ce.get("/admin/features-with-packages")}),d=un({mutationFn:({packageId:v,featureId:N,valueBoolean:S,valueNumber:_,valueText:j})=>Ce.post(`/admin/packages/${v}/features`,{featureId:N,valueBoolean:S,valueNumber:_,valueText:j}),onSuccess:()=>{t.invalidateQueries({queryKey:["admin-features-with-packages"]})},onError:v=>{ge.error(v.message||"Failed to update feature")}}),f=un({mutationFn:({packageId:v,featureId:N})=>Ce.delete(`/admin/packages/${v}/features/${N}`),onSuccess:()=>{t.invalidateQueries({queryKey:["admin-features-with-packages"]})},onError:v=>{ge.error(v.message||"Failed to remove feature")}}),h=(u==null?void 0:u.packages)||[],p=(u==null?void 0:u.features)||[],m=un({mutationFn:v=>{var S,_;const N={...v,publicImageUrl:((S=v.publicImageUrl)==null?void 0:S.trim())||null,descriptionLong:((_=v.descriptionLong)==null?void 0:_.trim())||void 0};return r?Ce.patch(`/admin/features/${r.id}`,N):Ce.post("/admin/features",N)},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-features"]}),ge.success(r?"Feature updated":"Feature created"),y()},onError:v=>{ge.error(v.message||"Failed to save feature")}}),x=un({mutationFn:v=>Ce.delete(`/admin/features/${v}`),onSuccess:()=>{t.invalidateQueries({queryKey:["admin-features"]}),ge.success("Feature deleted")},onError:v=>{ge.error(v.message||"Failed to delete feature")}}),y=()=>{n(!1),i(null),a({key:"",name:"",description:"",descriptionLong:"",publicImageUrl:"",valueType:"boolean",displayOrder:0,isActive:!0})},g=v=>{i(v),a({key:v.key,name:v.name,description:v.description||"",descriptionLong:v.descriptionLong||"",publicImageUrl:v.publicImageUrl||"",valueType:v.valueType,displayOrder:v.dis
5166playOrder,isActive:v.isActive}),n(!0)},w=v=>{switch(v){case"boolean":return o.jsx(DTe,{className:"h-4 w-4"});case"number":return o.jsx(Lse,{className:"h-4 w-4"});case"text":return o.jsx(LTe,{className:"h-4 w-4"});default:return null}};return c?o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Manage Features",noIndex:!0}),o.jsx("div",{className:"flex h-64 items-center justify-center",children:o.jsx(Me,{className:"h-8 w-8 animate-spin text-primary"})})]}):o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Manage Features",noIndex:!0}),o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-3xl font-bold",children:"Features"}),o.jsx("p",{className:"mt-1 text-muted-foreground",children:"Define features that can be included in subscription packages"})]}),o.jsxs(le,{onClick:()=>n(!0),children:[o.jsx(yi,{className:"h-4 w-4"}),"Add Feature"]})]}),o.jsxs(Dt,{children:[o.jsxs(Zt,{children:[o.jsx(tn,{children:"Feature Definitions"}),o.jsx(Kn,{children:"Features can be boolean (yes/no), numeric (count), or text values"})]}),o.jsx(Vt,{children:l.length===0?o.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"No features defined yet. Create your first feature to get started."}):o.jsx("div",{className:"rounded-lg border overflow-hidden",children:o.jsxs("table",{className:"w-full",children:[o.jsx("thead",{className:"bg-muted/50",children:o.jsxs("tr",{children:[o.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground",children:"Feature"}),o.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground",children:"Key"}),o.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-muted-foreground",children:"Type"}),o.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-muted-foreground",children:"Image"}),o.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-muted-foreground",children:"Status"}),o.jsx("th",{className:"px-4 py-3 w-10"})]})}),o.jsx("tbody",{className:"divide-y divide-border",children:l.map(v=>o.jsxs("tr",{className:"hover:bg-accent/50",children:[o.jsxs("td",{className:"px-4 py-3",children:[o.jsx("div",{className:"font-medium",children:v.name}),v.description&&o.jsx("p",{className:"text-xs text-muted-foreground mt-1 truncate max-w-[300px]",children:v.description})]}),o.jsx("td",{className:"px-4 py-3",children:o.jsx("code",{className:"text-sm bg-muted px-2 py-1 rounded",children:v.key})}),o.jsx("td",{className:"px-4 py-3 text-center",children:o.jsxs(Ge,{variant:"outline",className:"gap-1",children:[w(v.valueType),v.valueType]})}),o.jsx("td",{className:"px-4 py-3 text-center",children:v.publicImageUrl?o.jsx(NS,{className:"h-4 w-4 text-primary mx-auto"}):o.jsx("span",{className:"text-muted-foreground",children:"—"})}),o.jsx("td",{className:"px-4 py-3 text-center",children:o.jsx(Ge,{variant:v.isActive?"default":"secondary",children:v.isActive?"Active":"Inactive"})}),o.jsx("td",{className:"px-4 py-3",children:o.jsxs(gc,{children:[o.jsx(xc,{asChild:!0,children:o.jsx(le,{variant:"ghost",size:"icon",className:"h-8 w-8",children:o.jsx(ru,{className:"h-4 w-4"})})}),o.jsxs(vl,{align:"end",children:[o.jsxs(lr,{onClick:()=>g(v),children:[o.jsx(cv,{className:"h-4 w-4"})," Edit"]}),o.jsx(Ad,{}),o.jsxs(lr,{onClick:()=>{confirm("Delete this feature? This will remove it from all packages.")&&x.mutate(v.id)},className:"text-destructive focus:text-destructive",children:[o.jsx(Yi,{className:"mr-2 h-4 w-4"})," Delete"]})]})]})})]},v.id))})]})})})]}),h.length>0&&p.length>0&&o.jsxs(Dt,{children:[o.jsxs(Zt,{children:[o.jsx(tn,{children:"Feature Values by Package"}),o.jsx(Kn,{children:"Configure feature values for each package. Changes save when you click away from the input."})]}),o.jsx(Vt,{children:o.jsx("div",{className:"rounded-lg border overflow-hidden overflow-x-auto",children:o.jsxs("table",{className:"w-full",children:[o.jsx("thead",{className:"bg-muted/50",children:o.jsxs("tr",{children:[o.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground sticky left-0 bg-muted/50",children:"Feature"}),h.map(v=>o.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-muted-foreground min-w-[120px]",children:v.name},v.id))]})}),o.jsx("tbody",{className:"divide-y divide-border",children:p.filter(v=>
5166v.isActive).map(v=>{var S;const N=new Map(((S=v.packageFeatures)==null?void 0:S.map(_=>[_.packageId,_]))||[]);return o.jsxs("tr",{className:"hover:bg-accent/50",children:[o.jsx("td",{className:"px-4 py-3 font-medium sticky left-0 bg-background",children:v.name}),h.map(_=>{const j=N.get(_.id),A=!!j;return o.jsxs("td",{className:"px-4 py-3 text-center",children:[v.valueType==="boolean"&&o.jsx("div",{className:"flex justify-center",children:o.jsx(Zi,{checked:(j==null?void 0:j.valueBoolean)??!1,onCheckedChange:C=>{(C||A)&&d.mutate({packageId:_.id,featureId:v.id,valueBoolean:C})}})}),v.valueType==="number"&&o.jsx(gt,{type:"number",className:"h-8 w-20 mx-auto text-center",defaultValue:(j==null?void 0:j.valueNumber)??"",placeholder:"—",onBlur:C=>{const k=C.target.value,M=j==null?void 0:j.valueNumber;k===""&&A?f.mutate({packageId:_.id,featureId:v.id}):k!==""&&parseInt(k)!==M&&d.mutate({packageId:_.id,featureId:v.id,valueNumber:parseInt(k)||0})}},`${_.id}-${v.id}-${(j==null?void 0:j.valueNumber)??"empty"}`),v.valueType==="text"&&o.jsx(gt,{className:"h-8 w-24 mx-auto text-center",defaultValue:(j==null?void 0:j.valueText)??"",placeholder:"—",onBlur:C=>{const k=C.target.value,M=j==null?void 0:j.valueText;k===""&&A?f.mutate({packageId:_.id,featureId:v.id}):k!==M&&d.mutate({packageId:_.id,featureId:v.id,valueText:k})}},`${_.id}-${v.id}-${(j==null?void 0:j.valueText)??"empty"}`)]},_.id)})]},v.id)})})]})})})]}),o.jsx(ur,{open:e,onOpenChange:v=>!v&&y(),children:o.jsxs(tr,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[o.jsxs(dr,{children:[o.jsx(fr,{children:r?"Edit Feature":"Add Feature"}),o.jsx(hr,{children:"Define a feature that can be included in subscription packages"})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{children:"Display Name"}),o.jsx(gt,{value:s.name,onChange:v=>a({...s,name:v.target.value}),placeholder:"e.g., Priority Support"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{children:"Key (lowercase, underscores only)"}),o.jsx(gt,{value:s.key,onChange:v=>a({...s,key:v.target.value.toLowerCase().replace(/[^a-z_]/g,"")}),placeholder:"e.g., priority_support",disabled:!!r}),r&&o.jsx("p",{className:"text-xs text-muted-foreground",children:"Key cannot be changed after creation"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{children:"Short Description (for pricing table)"}),o.jsx(dl,{value:s.description,onChange:v=>a({...s,description:v.target.value}),placeholder:"Brief description shown in pricing comparison",rows:2})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{children:"Cover Image (for features page)"}),o.jsx(S8t,{value:s.publicImageUrl,onChange:v=>a({...s,publicImageUrl:v||""}),bucket:"feature-images",folder:"covers",maxSizeMB:5})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{children:"Long Description (for features page)"}),o.jsx(N8t,{value:s.descriptionLong,onChange:v=>a({...s,descriptionLong:v}),placeholder:"Write detailed feature description...",minHeight:250})]}),o.jsxs("div",{className:"grid gap-4 grid-cols-2",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{children:"Value Type"}),o.jsxs(Tr,{value:s.valueType,onValueChange:v=>a({...s,valueType:v}),children:[o.jsx(yr,{children:o.jsx(Vr,{})}),o.jsxs(vr,{children:[o.jsx(Ht,{value:"boolean",children:"Boolean (Yes/No)"}),o.jsx(Ht,{value:"number",children:"Number"}),o.jsx(Ht,{value:"text",children:"Text"})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{children:"Display Order"}),o.jsx(gt,{type:"number",value:s.displayOrder,onChange:v=>a({...s,displayOrder:parseInt(v.target.value)||0})})]})]}),o.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[o.jsx(Zi,{checked:s.isActive,onCheckedChange:v=>a({...s,isActive:v})}),o.jsx(et,{children:"Active"})]})]}),o.jsxs(Pr,{children:[o.jsx(le,{variant:"outline",onClick:y,children:"Cancel"}),o.jsxs(le,{onClick:()=>m.mutate(s),disabled:m.isPending||!s.name||!s.key,children:[m.isPending&&o.jsx(Me,{className:"mr-2 h-4 w-4 animate-spin"}),r?"Save Changes":"Create Feature"]})]})]})})]})]})}const iw={openai:"/images/logos/openai.svg",anthropic:"/images/logos/claude.svg",google:"/images/logos/gemini.svg",meta:"/images/logos/meta.svg",mistral:"/images/logos/mistral.svg",deepseek:"/images/logos/deepseek.svg",perplexity:"/images/logos/perplexity.svg",custom:"/images/logos/custom.svg"};function CC(t){return t.split("/")[0]||"unknown"}function ff(t){return t==null?"—":t===0?"Free":t<.01?`$${t.toFixed(4)}`:t<1?`$${t.toFixed(3)}`:`$${t.toFixed(2)}`}function uD(t){return t==null?"—":t===0?"Free":t<.01?"<$0.01":t<1?`$${t.toFixed(3)}`:`$${t.toFixed(2)}`}const kp=3;function C8t(){var ve;const t=Sa(),e=Ig(),[n,r]=b.useState(""),[i,s]=b.useState(!1),[a,l]=b.useState(null),[c,u]=b.useState(!1),[d,f]=b.useState(!1),[h,p]=b.useState(null),[m,x]=b.useState({name:"",displayName:"",modelId:"",customHandler:"serpapi_google_ai_mode",description:"",logoUrl:""}),[y,g]=b.useState({}),[w,v]=b.useState(!1),{data:N,isLoading:S}=En({queryKey:["admin-llm-providers"],queryFn:()=>Ce.get("/admin/llm-providers")}),_=(N==null?void 0:N.providers)||[],j=N==null?void 0:N.tokenAverages;b.useEffect(()=>{if(_.length>0&&Object.keys(y).length===0){const X={};_.forEach(de=>
5166{X[de.id]={displayName:de.displayName,isFeatured:de.isFeatured,isDefault:de.isDefault,logoUrl:de.logoUrl||""}}),g(X)}},[_]);const A=X=>y[X.id]||{displayName:X.displayName,isFeatured:X.isFeatured,isDefault:X.isDefault,logoUrl:X.logoUrl||""},C=(X,de)=>{g(Te=>({...Te,[X]:{...Te[X],...de}}))},k=b.useMemo(()=>Object.values(y).filter(X=>X.isFeatured).length,[y]),M=b.useMemo(()=>_.some(X=>{const de=y[X.id];return de?de.displayName!==X.displayName||de.isFeatured!==X.isFeatured||de.isDefault!==X.isDefault||de.logoUrl!==(X.logoUrl||""):!1}),[_,y]),I=k>kp,{data:R,isLoading:E,refetch:P}=En({queryKey:["admin-openrouter-models"],queryFn:()=>Ce.get("/admin/openrouter-models")}),O=(R==null?void 0:R.models)||[],{data:L=[],isLoading:T}=En({queryKey:["admin-platform-defaults"],queryFn:()=>Ce.get("/admin/platform-defaults")}),D=un({mutationFn:()=>Ce.post("/admin/llm-providers/sync-prices"),onSuccess:X=>{t.invalidateQueries({queryKey:["admin-llm-providers"]}),ge.success(`Synced prices for ${X.updated} providers`)},onError:X=>{ge.error(X.message||"Failed to sync prices")}}),F=un({mutationFn:X=>Ce.post("/admin/platform-defaults",X),onSuccess:()=>{t.invalidateQueries({queryKey:["admin-platform-defaults"]}),ge.success("Added to platform defaults"),u(!1),p(null)},onError:X=>{ge.error(X.message||"Failed to add platform default")}}),q=un({mutationFn:({id:X,...de})=>Ce.patch(`/admin/platform-defaults/${X}`,de),onSuccess:()=>{t.invalidateQueries({queryKey:["admin-platform-defaults"]})},onError:X=>{ge.error(X.message||"Failed to update platform default")}}),B=un({mutationFn:X=>Ce.delete(`/admin/platform-defaults/${X}`),onSuccess:()=>{t.invalidateQueries({queryKey:["admin-platform-defaults"]}),ge.success("Removed from platform defaults")},onError:X=>{ge.error(X.message||"Failed to remove platform default")}}),z=un({mutationFn:X=>Ce.post("/admin/llm-providers/custom",X),onSuccess:()=>{t.invalidateQueries({queryKey:["admin-llm-providers"]}),ge.success("Custom LLM provider created"),f(!1),x({name:"",displayName:"",modelId:"",customHandler:"serpapi_google_ai_mode",description:"",logoUrl:""})},onError:X=>{ge.error(X.message||"Failed to create custom LLM")}}),H=un({mutationFn:X=>Ce.post("/admin/llm-providers",X),onSuccess:()=>{t.invalidateQueries({queryKey:["admin-llm-providers"]}),t.invalidateQueries({queryKey:["admin-openrouter-models"]}),ge.success("LLM provider added"),s(!1),l(null)},onError:X=>{ge.error(X.message||"Failed to add provider")}}),W=un({mutationFn:({id:X,...de})=>Ce.patch(`/admin/llm-providers/${X}`,de),onSuccess:()=>{},onError:X=>{ge.error(X.message||"Failed to update provider")}}),G=async()=>{if(I){ge.error(`Cannot have more than ${kp} featured models.`);return}v(!0);try{const X=_.filter(Te=>{const Pe=y[Te.id];return Pe?Pe.displayName!==Te.displayName||Pe.isFeatured!==Te.isFeatured||Pe.isDefault!==Te.isDefault||Pe.logoUrl!==(Te.logoUrl||""):!1});let de=0;for(const Te of X){const Pe=y[Te.id],se=await Ce.patch(`/admin/llm-providers/${Te.id}`,{displayName:Pe.displayName,isFeatured:Pe.isFeatured,isDefault:Pe.isDefault,logoUrl:Pe.logoUrl||null});se.usersAffected&&(de+=se.usersAffected)}t.invalidateQueries({queryKey:["admin-llm-providers"]}),de>0?ge.success(`${X.length} providers updated. ${de} companies affected.`):ge.success(`${X.length} providers updated successfully.`)}catch(X){ge.error(X.message||"Failed to save changes")}finally{v(!1)}},K=()=>{const X={};_.forEach(de=>{X[de.id]={displayName:de.displayName,isFeatured:de.isFeatured,isDefault:de.isDefault,logoUrl:de.logoUrl||""}}),g(X)},ee=un({mutationFn:X=>Ce.delete(`/admin/llm-providers/${X}`),onSuccess:()=>{t.invalidateQueries({queryKey:["admin-llm-providers"]}),t.invalidateQueries({queryKey:["admin-openrouter-models"]}),ge.success("Provider deleted")},onError:X=>{ge.error(X.message||"Failed to delete provider")}}),V=_.filter(X=>X.isActive),J=_.filter(X=>!X.isActive),$=O.filter(X=>X.name.toLowerCase().includes(n.toLowerCase())||X.id.toLowerCase().includes(n.toLowerCase())).filter(X=>!X.isImplemented),fe=X=>{l(X),s(!0)},ce=()=>{if(!a)return;const X=CC(a.id);H.mutate({modelId:a.id,name:a.name,displayName:a.name,provider:X,description:a.description,logoUrl:iw[X],inputPricePer1M:a.promptPricePer1M,outputPricePer1M:a.completionPricePer1M,isActive:!0,isFeatured:!1,isDefault:!1})};return S?o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"LLM Providers",noIndex:!0}),o.jsx("div",{className:"flex h-64 items-center justify-center",children:o.jsx(Me,{className:"h-8 w-8 animate-spin text-primary"})})]}):o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"LLM Providers",noIndex:!0}),o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-3xl font-bold",children:"LLM Providers"}),o.jsx("p",{className:"mt-1 text-muted-foreground",children:"Manage available LLM models for the platform"})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs(le,{variant:"outline",onClick:()=>D.mutate(),disabled:D.isPending,children:[D.isPending?o.jsx(Me,{className:"mr-2 h-4 w-4 animate-spin"}):o.jsx(ws,{className:"h-4 w-4"}),"Sync Prices"]}
5166),M&&o.jsxs(o.Fragment,{children:[o.jsx(le,{variant:"outline",onClick:K,disabled:w,children:"Reset"}),o.jsxs(le,{onClick:G,disabled:w||I,children:[w?o.jsx(Me,{className:"mr-2 h-4 w-4 animate-spin"}):o.jsx(W1,{className:"h-4 w-4"}),"Save Changes"]})]})]})]}),I&&o.jsxs("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-4 flex items-center gap-3",children:[o.jsx(ll,{className:"h-5 w-5 text-destructive shrink-0"}),o.jsxs("p",{className:"text-sm text-destructive",children:["You have ",k," featured models selected. Maximum allowed is ",kp,". Please disable some featured models before saving."]})]}),M&&!I&&o.jsxs("div",{className:"rounded-lg border border-primary/30 bg-primary/5 p-4 flex items-center gap-3",children:[o.jsxs(Ge,{variant:"secondary",children:[k,"/",kp]}),o.jsx("p",{className:"text-sm",children:"Featured models selected. You have unsaved changes."})]}),o.jsxs(J0,{defaultValue:"platform-defaults",children:[o.jsxs(Bg,{children:[o.jsxs(pi,{value:"platform-defaults",children:["Platform Defaults (",L.length,")"]}),o.jsxs(pi,{value:"implemented",children:["All Models (",V.length,")"]}),o.jsxs(pi,{value:"archived",children:["Archived (",J.length,")"]}),o.jsxs(pi,{value:"available",children:["Available to Add (",$.length,")"]})]}),o.jsx(my,{value:"platform-defaults",className:"space-y-4",children:o.jsxs(Dt,{children:[o.jsx(Zt,{children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx(tn,{children:"Platform Default Models"}),o.jsx(Kn,{children:"These models run automatically for ALL companies. Changes here instantly affect all users."})]}),o.jsxs(le,{onClick:()=>u(!0),children:[o.jsx(yi,{className:"h-4 w-4"})," Add to Defaults"]})]})}),o.jsx(Vt,{children:T?o.jsx("div",{className:"flex items-center justify-center py-8",children:o.jsx(Me,{className:"h-8 w-8 animate-spin text-primary"})}):L.length===0?o.jsx("p",{className:"text-center py-8 text-muted-foreground",children:"No platform defaults configured. Add models to set defaults for all users."}):o.jsxs(o.Fragment,{children:[L.filter(X=>X.isActive&&!X.llmProvider.isActive).length>0&&o.jsxs("div",{className:"mb-4 p-3 rounded-lg bg-amber-500/10 border border-amber-500/30 flex items-start gap-3",children:[o.jsx(ll,{className:"h-5 w-5 text-amber-500 shrink-0 mt-0.5"}),o.jsxs("div",{className:"text-sm",children:[o.jsxs("p",{className:"font-medium text-amber-600 dark:text-amber-400",children:[L.filter(X=>X.isActive&&!X.llmProvider.isActive).length," platform default",L.filter(X=>X.isActive&&!X.llmProvider.isActive).length>1?"s have":" has"," an inactive provider"]}),o.jsx("p",{className:"text-muted-foreground",children:`These models are marked as active defaults but their underlying provider is archived. They won't appear for users. Reactivate the provider in the "Archived" tab.`})]})]}),o.jsx("div",{className:"rounded-lg border overflow-hidden",children:o.jsxs("table",{className:"w-full",children:[o.jsx("thead",{className:"bg-muted/50",children:o.jsxs("tr",{children:[o.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground",children:"Model"}),o.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground min-w-[200px]",children:"Display Name (Public)"}),o.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-muted-foreground",children:"Type"}),o.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-muted-foreground",children:"Active"}),o.jsx("th",{className:"px-4 py-3 w-10"})]})}),o.jsx("tbody",{className:"divide-y divide-border",children:L.map(X=>o.jsxs("tr",{className:"hover:bg-accent/50",children:[o.jsx("td",{className:"px-4 py-3",children:o.jsxs("div",{className:"flex items-center gap-3",children:[X.llmProvider.logoUrl?o.jsx(Hn,{src:X.llmProvider.logoUrl,alt:X.llmProvider.name,className:"h-8 w-8 rounded object-contain"}):o.jsx("div",{className:"h-8 w-8 rounded bg-muted flex items-center justify-center text-xs font-bold",children:X.llmProvider.name.charAt(0)}),o.jsxs("div",{children:[o.jsx("p",{className:"font-medium",children:X.llmProvider.displayName}),o.jsx("p",{className:"text-xs text-muted-foreground truncate max-w-[250px]",children:X.llmProvider.modelId})]})]})}),o.jsx("td",{className:"px-4 py-3",children:o.jsx(gt,{value:X.displayName,onChange:de=>{q.mutate({id:X.id,displayName:de.target.value})},className:"h-8 text-sm",placeholder:"Public display name..."})}),o.jsx("td",{className:"px-4 py-3 text-center",children:o.jsx(Ge,{variant:X.llmProvider.providerType==="custom"?"secondary":"outline",children:X.llmProvider.providerType==="custom"?"Custom"
5166:"OpenRouter"})}),o.jsx("td",{className:"px-4 py-3 text-center",children:o.jsxs("div",{className:"flex items-center justify-center gap-2",children:[o.jsx(Zi,{checked:X.isActive,onCheckedChange:de=>{q.mutate({id:X.id,isActive:de})}}),X.isActive&&!X.llmProvider.isActive&&o.jsx(on,{children:o.jsxs(Ft,{children:[o.jsx(Ut,{children:o.jsx(ll,{className:"h-4 w-4 text-amber-500"})}),o.jsx(zt,{children:o.jsx("p",{className:"max-w-[200px]",children:`Provider is archived/inactive. This model won't appear for users until the provider is reactivated in the "Implemented Models" tab.`})})]})})]})}),o.jsx("td",{className:"px-4 py-3",children:o.jsx(le,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive",onClick:()=>{confirm("Remove this model from platform defaults?")&&B.mutate(X.id)},children:o.jsx(Yi,{className:"h-4 w-4"})})})]},X.id))})]})})]})})]})}),o.jsx(my,{value:"implemented",className:"space-y-4",children:o.jsxs(Dt,{children:[o.jsx(Zt,{children:o.jsxs("div",{className:"flex items-start justify-between",children:[o.jsxs("div",{children:[o.jsx(tn,{children:"Active LLM Providers"}),o.jsxs(Kn,{children:["Models available for users to select. Prices shown per 1M tokens. Est. cost = ",(j==null?void 0:j.input)||"~1500"," input + ",(j==null?void 0:j.output)||"~800"," output tokens × 30 days."]})]}),o.jsxs(le,{variant:"outline",onClick:()=>f(!0),children:[o.jsx(yi,{className:"h-4 w-4"})," Add Custom LLM"]})]})}),o.jsx(Vt,{children:V.length===0?o.jsx("p",{className:"text-center py-8 text-muted-foreground",children:'No active providers. Add some from the "Available to Add" tab.'}):o.jsx(on,{children:o.jsx("div",{className:"rounded-lg border overflow-hidden overflow-x-auto",children:o.jsxs("table",{className:"w-full",children:[o.jsx("thead",{className:"bg-muted/50",children:o.jsxs("tr",{children:[o.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground",children:"Model"}),o.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground min-w-[180px]",children:"Display Name"}),o.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground min-w-[200px]",children:"Logo URL"}),o.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-muted-foreground whitespace-nowrap",children:"Input /1M"}),o.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-muted-foreground whitespace-nowrap",children:"Output /1M"}),o.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-muted-foreground whitespace-nowrap",children:o.jsxs(Ft,{children:[o.jsx(Ut,{children:"Est. $/mo"}),o.jsx(zt,{children:"Estimated cost per prompt per month"})]})}),o.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-muted-foreground",children:"Usage"}),o.jsxs("th",{className:"px-4 py-3 text-center text-xs font-medium text-muted-foreground",children:["Featured",o.jsxs("span",{className:"block text-[10px] font-normal normal-case",children:["(",k,"/",kp,")"]})]}),o.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-muted-foreground",children:"Default"}),o.jsx("th",{className:"px-4 py-3 w-10"})]})}),o.jsx("tbody",{className:"divide-y divide-border",children:V.map(X=>{const de=A(X),Te=de.displayName!==X.displayName||de.isFeatured!==X.isFeatured||de.isDefault!==X.isDefault||de.logoUrl!==(X.logoUrl||"");return o.jsxs("tr",{className:`hover:bg-accent/50 ${Te?"bg-yellow-500/10":""}`,children:[o.jsx("td",{className:"px-4 py-3",children:o.jsxs("div",{className:"flex items-center gap-3",children:[X.logoUrl?o.jsx(Hn,{src:X.logoUrl,alt:X.name,className:"h-8 w-8 rounded object-contain"}):o.jsx("div",{className:"h-8 w-8 rounded bg-muted flex items-center justify-center text-xs font-bold",children:X.name.charAt(0)}),o.jsx("div",{children:o.jsx("p",{className:"text-xs text-muted-foreground truncate max-w-[200px]",children:X.modelId})})]})}),o.jsx("td",{className:"px-4 py-3",children:o.jsx(gt,{value:de.displayName,onChange:Pe=>C(X.id,{displayName:Pe.target.value}),className:"h-8 text-sm",placeholder:"Display name..."})}),o.jsx("td",{className:"px-4 py-3",children:o.jsx(gt,{value:de.logoUrl,onChange:Pe=>C(X.id,{logoUrl:Pe.target.value}),className:"h-8 text-sm",placeholder:"https://..."})}),o.jsx("td",{className:"px-4 py-3 text-center text-sm font-mono",children:ff(X.inputPricePer1M)}),o.jsx("td",{className:"px-4 py-3 text-center text-sm font-mono",children:ff(X.outputPricePer1M)}),o.jsx("td",{className:"px-4 py-3 text-center text-sm font-mono",children:uD(X.estimatedCostPerPromptMonth)}),o.jsx("td",{className:"px-4 py-3 text-center",children:o.jsx(Ge,{variant:"outline",children:X.activeUsageCount})}),o.jsx("td",{className:"px-4 py-3 text-center",children:o.jsx(Zi,{checked:de.isFeatured,onCheckedChange:Pe=>{if(Pe&&k>=kp){ge.error(`Maximum ${kp} featured models allowed.`);return}C(X.id,{isFeatured:Pe})}})}),o.jsx("td",{className:"px-4 py-3 text-center",children:o.jsx(Zi,{checked:de.isDefault,onCheckedChange:Pe=>C(X.id,{isDefault:Pe})})}),o.jsx("td",{className:"px-4 py-3",children:o.jsxs(gc,{children:[o.jsx(xc,{asChild:!0,children:o.jsx(le,{variant:"ghost",size:"icon",className:"h-8 w-8",children:o.jsx(ru,{className:"h-4 w-4"})})}
5166),o.jsxs(vl,{align:"end",children:[o.jsxs(lr,{onClick:()=>W.mutate({id:X.id,isActive:!1}),children:[o.jsx(bz,{className:"h-4 w-4"})," Archive"]}),o.jsx(Ad,{}),o.jsxs(lr,{onClick:()=>{confirm("Delete this provider? This cannot be undone.")&&ee.mutate(X.id)},className:"text-destructive focus:text-destructive",children:[o.jsx(Yi,{className:"mr-2 h-4 w-4"})," Delete"]})]})]})})]},X.id)})})]})})})})]})}),o.jsx(my,{value:"archived",className:"space-y-4",children:o.jsxs(Dt,{children:[o.jsxs(Zt,{children:[o.jsx(tn,{className:"text-muted-foreground",children:"Archived Models"}),o.jsx(Kn,{children:"Archived models are hidden from users. You can restore them anytime."})]}),o.jsx(Vt,{children:J.length===0?o.jsx("p",{className:"text-center py-8 text-muted-foreground",children:"No archived providers."}):o.jsx("div",{className:"rounded-lg border overflow-hidden",children:o.jsxs("table",{className:"w-full",children:[o.jsx("thead",{className:"bg-muted/50",children:o.jsxs("tr",{children:[o.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground",children:"Model"}),o.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-muted-foreground whitespace-nowrap",children:"Input /1M"}),o.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-muted-foreground whitespace-nowrap",children:"Output /1M"}),o.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-muted-foreground",children:"Added"}),o.jsx("th",{className:"px-4 py-3 w-10"})]})}),o.jsx("tbody",{className:"divide-y divide-border",children:J.map(X=>o.jsxs("tr",{className:"hover:bg-accent/50 opacity-60",children:[o.jsx("td",{className:"px-4 py-3",children:o.jsxs("div",{className:"flex items-center gap-3",children:[X.logoUrl?o.jsx(Hn,{src:X.logoUrl,alt:X.name,className:"h-8 w-8 rounded object-contain"}):o.jsx("div",{className:"h-8 w-8 rounded bg-muted flex items-center justify-center text-xs font-bold",children:X.name.charAt(0)}),o.jsxs("div",{children:[o.jsx("p",{className:"font-medium",children:X.displayName}),o.jsx("p",{className:"text-xs text-muted-foreground truncate max-w-[200px]",children:X.modelId})]})]})}),o.jsx("td",{className:"px-4 py-3 text-center text-sm font-mono",children:ff(X.inputPricePer1M)}),o.jsx("td",{className:"px-4 py-3 text-center text-sm font-mono",children:ff(X.outputPricePer1M)}),o.jsx("td",{className:"px-4 py-3 text-center text-sm text-muted-foreground whitespace-nowrap",children:bl(X.createdAt,e)}),o.jsx("td",{className:"px-4 py-3",children:o.jsxs(le,{variant:"outline",size:"sm",onClick:()=>W.mutate({id:X.id,isActive:!0}),children:[o.jsx(Eh,{className:"h-4 w-4"})," Restore"]})})]},X.id))})]})})})]})}),o.jsx(my,{value:"available",className:"space-y-4",children:o.jsxs(Dt,{children:[o.jsx(Zt,{children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx(tn,{children:"Available OpenRouter Models"}),o.jsx(Kn,{children:"Browse and add models from OpenRouter's catalog"})]}),o.jsxs(le,{variant:"outline",size:"sm",onClick:()=>P(),disabled:E,children:[E?o.jsx(Me,{className:"mr-2 h-4 w-4 animate-spin"}):o.jsx(ws,{className:"h-4 w-4"}),"Refresh"]})]})}),o.jsxs(Vt,{className:"space-y-4",children:[o.jsxs("div",{className:"relative",children:[o.jsx(Xa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(gt,{placeholder:"Search models...",value:n,onChange:X=>r(X.target.value),className:"pl-9"})]}),E?o.jsx("div",{className:"flex items-center justify-center py-8",children:o.jsx(Me,{className:"h-8 w-8 animate-spin text-primary"})}):$.length===0?o.jsx("p",{className:"text-center py-8 text-muted-foreground",children:n?"No models found matching your search.":"All available models have been added!"}):o.jsx(on,{children:o.jsx("div",{className:"rounded-lg border overflow-hidden max-h-[600px] overflow-y-auto",children:o.jsxs("table",{className:"w-full",children:[o.jsx("thead",{className:"bg-muted/50 sticky top-0",children:o.jsxs("tr",{children:[o.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground",children:"Model"}),o.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-muted-foreground",children:"Context"}),o.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-muted-foreground whitespace-nowrap",children:"Input /1M"}),o.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-muted-foreground whitespace-nowrap",children:"Output /1M"}),o.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-muted-foreground whitespace-nowrap",children:o.jsxs(Ft,{children:[o.jsx(Ut,{children:"Est. $/mo"}),o.jsx(zt,{children:"Estimated cost per prompt per month"})]})}),o.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-muted-foreground",children:"Modalities"}),o.jsx("th",{className:"px-4 py-3 w-10"})]})}),o.jsx("tbody",{className:"divide-y divide-border",children:$.map(X=>{var Te;const de=CC(X.id);return o.jsxs("tr",{className:"hover:bg-accent/50",children:[o.jsx("td",{className:"px-4 py-3",children:o.jsxs("div",{className:"flex items-center gap-3",children:[iw[de]?o.jsx("img",{src:iw[de],alt:de,className:"h-6 w-6 rounded object-contain"}):o.jsx("div",{className:"h-6 w-6 rounded bg-muted flex items-center justify-center text-xs font-bold",children:de.charAt(0).toUpperCase()}),o.jsxs("div",{children:[o.jsx("p",{className:"font-medium text-sm",children:X.name}),o.jsx("p",{className:"text-xs text-muted-foreground truncate max-w-[250px]",children:X.id})]})]})}),o.jsx("td",{className:"px-4 py-3 text-center text-sm text-muted-foreground",children:((Te=X.contextLength)==null?void 0:Te.toLocaleStr
5166ing())||"—"}),o.jsx("td",{className:"px-4 py-3 text-center text-sm font-mono",children:ff(X.promptPricePer1M)}),o.jsx("td",{className:"px-4 py-3 text-center text-sm font-mono",children:ff(X.completionPricePer1M)}),o.jsx("td",{className:"px-4 py-3 text-center text-sm font-mono",children:uD(X.estimatedCostPerPromptMonth)}),o.jsx("td",{className:"px-4 py-3 text-center",children:o.jsxs("div",{className:"flex gap-1 justify-center",children:[X.inputModalities.includes("image")&&o.jsx(Ge,{variant:"outline",className:"text-xs",children:"Vision"}),X.inputModalities.includes("file")&&o.jsx(Ge,{variant:"outline",className:"text-xs",children:"Files"})]})}),o.jsx("td",{className:"px-4 py-3",children:o.jsxs(le,{size:"sm",onClick:()=>fe(X),children:[o.jsx(yi,{className:"mr-1 h-4 w-4"})," Add"]})})]},X.id)})})]})})})]})]})})]}),o.jsx(ur,{open:i,onOpenChange:s,children:o.jsxs(tr,{children:[o.jsxs(dr,{children:[o.jsx(fr,{children:"Add LLM Provider"}),o.jsx(hr,{children:"Add this model to the platform for users to select"})]}),a&&o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted",children:[iw[CC(a.id)]?o.jsx("img",{src:iw[CC(a.id)],alt:"",className:"h-10 w-10 rounded object-contain"}):o.jsx("div",{className:"h-10 w-10 rounded bg-background flex items-center justify-center text-lg font-bold",children:a.name.charAt(0)}),o.jsxs("div",{className:"flex-1",children:[o.jsx("p",{className:"font-medium",children:a.name}),o.jsx("p",{className:"text-xs text-muted-foreground",children:a.id})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-muted-foreground",children:"Input Price /1M"}),o.jsx("p",{className:"font-medium font-mono",children:ff(a.promptPricePer1M)})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-muted-foreground",children:"Output Price /1M"}),o.jsx("p",{className:"font-medium font-mono",children:ff(a.completionPricePer1M)})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-muted-foreground",children:"Context Length"}),o.jsxs("p",{className:"font-medium",children:[((ve=a.contextLength)==null?void 0:ve.toLocaleString())||"—"," tokens"]})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-muted-foreground",children:"Est. Monthly Cost"}),o.jsxs("p",{className:"font-medium font-mono",children:[uD(a.estimatedCostPerPromptMonth),"/prompt"]})]})]}),a.description&&o.jsxs("div",{className:"text-sm",children:[o.jsx("p",{className:"text-muted-foreground mb-1",children:"Description"}),o.jsx("p",{className:"text-muted-foreground line-clamp-3",children:a.description})]})]}),o.jsxs(Pr,{children:[o.jsx(le,{variant:"outline",onClick:()=>s(!1),children:"Cancel"}),o.jsxs(le,{onClick:ce,disabled:H.isPending,children:[H.isPending&&o.jsx(Me,{className:"mr-2 h-4 w-4 animate-spin"}),"Add Provider"]})]})]})}),o.jsx(ur,{open:c,onOpenChange:u,children:o.jsxs(tr,{className:"max-w-2xl",children:[o.jsxs(dr,{children:[o.jsx(fr,{children:"Add to Platform Defaults"}),o.jsx(hr,{children:"Select a model to add to platform defaults. This model will run for ALL companies automatically."})]}),o.jsxs("div",{className:"space-y-4 py-4 max-h-[400px] overflow-y-auto",children:[V.filter(X=>!L.some(de=>de.llmProviderId===X.id)).map(X=>o.jsxs("div",{className:`flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-colors ${(h==null?void 0:h.id)===X.id?"border-primary bg-primary/5":"hover:bg-muted"}`,onClick:()=>p(X),children:[X.logoUrl?o.jsx(Hn,{src:X.logoUrl,alt:X.name,className:"h-10 w-10 rounded object-contain"}):o.jsx("div",{className:"h-10 w-10 rounded bg-muted flex items-center justify-center text-lg font-bold",children:X.name.charAt(0)}),o.jsxs("div",{className:"flex-1",children:[o.jsx("p",{className:"font-medium",children:X.displayName}),o.jsx("p",{className:"text-xs text-muted-foreground",children:X.modelId})]}),o.jsx(Ge,{variant:"outline",children:X.providerType==="custom"?"Custom":"OpenRouter"})]},X.id)),V.filter(X=>!L.some(de=>de.llmProviderId===X.id)).length===0&&o.jsx("p",{className:"text-center py-8 text-muted-foreground",children:"All active models are already in platform defaults."})]}),o.jsxs(Pr,{children:[o.jsx(le,{variant:"outline",onClick:()=>{u(!1),p(null)},children:"Cancel"}),o.jsxs(le,{onClick:()=>{h&&F.mutate({llmProviderId:h.id,displayName:h.displayName})},disabled:!h||F.isPending,children:[F.isPending&&o.jsx(Me,{className:"mr-2 h-4 w-4 animate-spin"}),"Add to Defaults"]})]})]})}),o.jsx(ur,{open:d,onOpenChange:f,children:o.jsxs(tr,{children:[o.jsxs(dr,{children:[o.jsx(fr,{children:"Add Custom LLM Provider"}),o.jsx(hr,{children:"Create a custom LLM provider for non-OpenRouter models (e.g., Google AI Mode via SerpAPI)."})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Name"}),o.jsx(gt,{value:m.name,onChange:X=>x(de=>({...de,name:X.target.value})),placeholder:"e.g., Google AI Mode"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Display Name (Public)"}
5166),o.jsx(gt,{value:m.displayName,onChange:X=>x(de=>({...de,displayName:X.target.value})),placeholder:"e.g., Google AI Mode"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Model ID"}),o.jsx(gt,{value:m.modelId,onChange:X=>x(de=>({...de,modelId:X.target.value})),placeholder:"e.g., custom/serpapi-google-ai-mode-v1"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Use format: custom/provider-model-version"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Handler"}),o.jsx("select",{value:m.customHandler,onChange:X=>x(de=>({...de,customHandler:X.target.value})),className:"w-full h-10 px-3 rounded-md border border-input bg-background text-sm",children:o.jsx("option",{value:"serpapi_google_ai_mode",children:"SerpAPI - Google AI Mode"})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"The backend handler that processes requests for this model."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Description (Optional)"}),o.jsx(gt,{value:m.description,onChange:X=>x(de=>({...de,description:X.target.value})),placeholder:"Brief description of this model..."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Logo URL (Optional)"}),o.jsx(gt,{value:m.logoUrl,onChange:X=>x(de=>({...de,logoUrl:X.target.value})),placeholder:"https://example.com/logo.svg"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"URL to the model's logo image (SVG or PNG recommended)"})]})]}),o.jsxs(Pr,{children:[o.jsx(le,{variant:"outline",onClick:()=>f(!1),children:"Cancel"}),o.jsxs(le,{onClick:()=>z.mutate({...m,logoUrl:m.logoUrl||void 0,description:m.description||void 0}),disabled:!m.name||!m.displayName||!m.modelId||z.isPending,children:[z.isPending&&o.jsx(Me,{className:"mr-2 h-4 w-4 animate-spin"}),"Create Custom LLM"]})]})]})})]})]})}function dD({value:t,onChange:e,color:n}){return o.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:t,onChange:r=>e(parseInt(r.target.value,10)),className:"w-full h-2 rounded-lg appearance-none cursor-pointer",style:{background:`linear-gradient(to right, ${n} 0%, ${n} ${t}%, hsl(var(--muted)) ${t}%, hsl(var(--muted)) 100%)`}})}const k8t={technical:"bg-blue-500/10 text-blue-500 border-blue-500/20",content:"bg-green-500/10 text-green-500 border-green-500/20",aeo:"bg-purple-500/10 text-purple-500 border-purple-500/20"},E8t={critical:"bg-red-500/10 text-red-500 border-red-500/20",high:"bg-orange-500/10 text-orange-500 border-orange-500/20",medium:"bg-yellow-500/10 text-yellow-500 border-yellow-500/20",low:"bg-slate-500/10 text-slate-500 border-slate-500/20"};function A8t(){const t=Sa(),[e,n]=b.useState(!1),[r,i]=b.useState(null),[s,a]=b.useState("all"),[l,c]=b.useState({slug:"",name:"",description:"",howToFix:"",whyItMatters:"",category:"technical",defaultSeverity:"medium",technicalValue:50,contentValue:50,aeoValue:50,displayOrder:0,isActive:!0}),{data:u=[],isLoading:d}=En({queryKey:["admin-issue-types"],queryFn:()=>Ce.get("/admin/issue-types")}),f=un({mutationFn:g=>r?Ce.patch(`/admin/issue-types/${r.id}`,g):Ce.post("/admin/issue-types",g),onSuccess:()=>{t.invalidateQueries({queryKey:["admin-issue-types"]}),ge.success(r?"Issue type updated":"Issue type created"),p()},onError:g=>{ge.error(g.message||"Failed to save issue type")}}),h=un({mutationFn:g=>Ce.delete(`/admin/issue-types/${g}`),onSuccess:()=>{t.invalidateQueries({queryKey:["admin-issue-types"]}),ge.success("Issue type deleted")},onError:g=>{ge.error(g.message||"Failed to delete issue type")}}),p=()=>{n(!1),i(null),c({slug:"",name:"",description:"",howToFix:"",whyItMatters:"",category:"technical",defaultSeverity:"medium",technicalValue:50,contentValue:50,aeoValue:50,displayOrder:0,isActive:!0})},m=g=>{i(g),c({slug:g.slug,name:g.name,description:g.description||"",howToFix:g.howToFix||"",whyItMatters:g.whyItMatters||"",category:g.category,defaultSeverity:g.defaultSeverity,technicalValue:g.technicalValue,contentValue:g.contentValue,aeoValue:g.aeoValue,displayOrder:g.displayOrder,isActive:g.isActive}),n(!0)},x=s==="all"?u:u.filter(g=>g.category===s),y={all:u.length,technical:u.filter(g=>g.category==="technical").length,content:u.filter(g=>
5166g.category==="content").length,aeo:u.filter(g=>g.category==="aeo").length};return d?o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Manage Issue Types",noIndex:!0}),o.jsx("div",{className:"flex h-64 items-center justify-center",children:o.jsx(Me,{className:"h-8 w-8 animate-spin text-primary"})})]}):o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Manage Issue Types",noIndex:!0}),o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-3xl font-bold",children:"Issue Types"}),o.jsx("p",{className:"mt-1 text-muted-foreground",children:"Configure the issue types detected during site health audits"})]}),o.jsxs(le,{onClick:()=>n(!0),children:[o.jsx(yi,{className:"h-4 w-4"}),"Add Issue Type"]})]}),o.jsxs(J0,{value:s,onValueChange:a,children:[o.jsxs(Bg,{children:[o.jsxs(pi,{value:"all",children:["All (",y.all,")"]}),o.jsxs(pi,{value:"technical",children:["Technical (",y.technical,")"]}),o.jsxs(pi,{value:"content",children:["Content (",y.content,")"]}),o.jsxs(pi,{value:"aeo",children:["AEO (",y.aeo,")"]})]}),o.jsx(my,{value:s,className:"mt-4",children:o.jsxs(Dt,{children:[o.jsxs(Zt,{children:[o.jsx(tn,{children:"Issue Type Definitions"}),o.jsx(Kn,{children:"These issue types are detected during automated audits and shown to users"})]}),o.jsx(Vt,{children:x.length===0?o.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"No issue types defined yet. Create your first issue type to get started."}):o.jsx("div",{className:"rounded-lg border overflow-hidden",children:o.jsxs("table",{className:"w-full",children:[o.jsx("thead",{className:"bg-muted/50",children:o.jsxs("tr",{children:[o.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground",children:"Issue"}),o.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground",children:"Slug"}),o.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-muted-foreground",children:"Category"}),o.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-muted-foreground",children:"Severity"}),o.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-muted-foreground",children:"Values"}),o.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-muted-foreground",children:"Status"}),o.jsx("th",{className:"px-4 py-3 w-10"})]})}),o.jsx("tbody",{className:"divide-y divide-border",children:x.map(g=>o.jsxs("tr",{className:"hover:bg-accent/50",children:[o.jsxs("td",{className:"px-4 py-3",children:[o.jsx("div",{className:"font-medium",children:g.name}),g.description&&o.jsx("p",{className:"text-xs text-muted-foreground mt-1 truncate max-w-[300px]",children:g.description})]}),o.jsx("td",{className:"px-4 py-3",children:o.jsx("code",{className:"text-sm bg-muted px-2 py-1 rounded",children:g.slug})}),o.jsx("td",{className:"px-4 py-3 text-center",children:o.jsx(Ge,{variant:"outline",className:k8t[g.category],children:g.category})}),o.jsx("td",{className:"px-4 py-3 text-center",children:o.jsx(Ge,{variant:"outline",className:E8t[g.defaultSeverity],children:g.defaultSeverity})}),o.jsx("td",{className:"px-4 py-3 text-center",children:o.jsxs("div",{className:"flex items-center justify-center gap-2 text-xs",children:[o.jsxs("span",{className:"text-blue-500",children:["T:",g.technicalValue]}),o.jsxs("span",{className:"text-green-500",children:["C:",g.contentValue]}),o.jsxs("span",{className:"text-purple-500",children:["A:",g.aeoValue]})]})}),o.jsx("td",{className:"px-4 py-3 text-center",children:o.jsx(Ge,{variant:g.isActive?"default":"secondary",children:g.isActive?"Active":"Inactive"})}),o.jsx("td",{className:"px-4 py-3",children:o.jsxs(gc,{children:[o.jsx(xc,{asChild:!0,children:o.jsx(le,{variant:"ghost",size:"icon",className:"h-8 w-8",children:o.jsx(ru,{className:"h-4 w-4"})})}),o.jsxs(vl,{align:"end",children:[o.jsxs(lr,{onClick:()=>m(g),children:[o.jsx(cv,{className:"h-4 w-4"})," Edit"]}),o.jsx(Ad,{}),o.jsxs(lr,{onClick:()=>{confirm("Delete this issue type? This will affect all existing issues.")&&h.mutate(g.id)},className:"text-destructive focus:text-destructive",children:[o.jsx(Yi,{className:"mr-2 h-4 w-4"})," Delete"]})]})]})})]},g.id))})]})})})]})})]}),o.jsx(ur,{open:e,onOpenChange:g=>!g&&p(),children:o.jsxs(tr,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[o.jsxs(dr,{children:[o.jsx(fr,{children:r?"Edit Issue Type":"Add Issue Type"}),o.jsx(hr,{children:"Define an issue type that will be detected during site health audits"})]}),o.jsxs("div",{className:"space-y-6 py-4",children:[o.jsxs("div",{className:"grid gap-4 grid-cols-2",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{children:"Display Name"}),o.jsx(gt,{value:l.name,onChange:g=>c({...l,name:g.target.value}),placeholder:"e.g., Missing Meta Description"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{children:"Slug (lowercase, hyphens only)"}),o.jsx(gt,{value:l.slug,onChange:g=>c({...l,slug:g.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/--+/g,"-")}),placeholder:"e.g., missing-meta-description",disabled:!!r}),r&&o.jsx("p",{className:"text-xs text-muted-foreground",children:"Slug cannot be changed after creation"})]})]}),o.jsxs("div",{className:"grid gap-4 grid-cols-2",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{children:"Category"}),o.jsxs(Tr,{value:l.category,onValueChange:g=>c({...l,category:g}),children:[o.jsx(yr,{children:o.jsx(Vr,{})}),o.jsxs(vr,{children:[o.jsx(Ht,{value:"technical",children:"Technical"}),o.jsx(Ht,{value:"content",children:"Content"}),o.jsx(Ht,{value:"aeo",children:"AEO (AI Engine Optimization)"})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{children:"Default Severity"}),o.jsxs(Tr,{value:l.defaultSeverity,onValueChange:g=>c({...l,defaultSeverity:g}),children:[o.jsx(yr,{children:o.jsx(Vr,{})}),o.jsxs(vr,{children:[o.jsx(Ht,{value:"critical",children:"Critical"}),o.jsx(Ht,{value:"high",children:"High"}),o.jsx(Ht,{value:"medium",children:"Medium"}),o.jsx(Ht,{value:"low",children:"Low"})]})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs(et,{className:"flex items-center gap-2",children:[o.jsx(ll,{className:"h-4 w-4"}),"Description"]}),o.jsx(dl,{value:l.description,onChange:g=>c({...l,description:g.target.value}),placeholder:"Explain what this issue means and why it was detected...",rows:3})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs(et,{className:"flex items-center gap-2",children:[o.jsx(_T,{className:"h-4 w-4"}),"How to Fix"]}),o.jsx(dl,{value:l.howToFix,onChange:g=>c({...l,howToFix:g.target.value}),placeholder:"Step-by-step instructions on how to resolve this issue...",rows:4})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs(et,{className:"flex items-center gap-2",children:[o.jsx(Cz,{className:"h-4 w-4"}),"Why It Matters"]}),o.jsx(dl,{value:l.whyItMatters,onChange:g=>c({...l,whyItMatters:g.target.value}),placeholder:"Explain the impact of this issue on SEO, user experience, or AI visibility...",rows:3})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs(et,{className:"flex items-center gap-2",children:[o.jsx(oTe,{className:"h-4 w-4"}),"Impact Values (0-100)"]}),o.jsxs("div",{className:"grid gap-6 grid-cols-3",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-sm text-blue-500",children:"Technical"}),o.jsx("span",{className:"text-sm font-mono",children:l.technicalValue})]}),o.jsx(dD,{value:l.technicalValue,onChange:g=>c({...l,technicalValue:g}),color:"rgb(59, 130, 246)"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-sm text-green-500",children:"Content"}),o.jsx("span",{className:"text-sm font-mono",children:l.contentValue})]}),o.jsx(dD,{value:l.contentValue,onChange:g=>c({...l,contentValue:g}),color:"rgb(34, 197, 94)"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-sm text-purple-500",children:"AEO"}),o.jsx("span",{className:"text-sm font-mono",children:l.aeoValue})]}),o.jsx(dD,{value:l.aeoValue,onChange:g=>c({...l,aeoValue:g}),color:"rgb(168, 85, 247)"})]})]})]}),o.jsxs("div",{className:"grid gap-4 grid-cols-2",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{children:"Display Order"}),o.jsx(gt,{type:"number",value:l.displayOrder,onChange:g=>c({...l,displayOrder:parseInt(g.target.value)||0})})]}),o.jsx("div",{className:"space-y-2 pt-6",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Zi,{checked:l.isActive,onCheckedChange:g=>c({...l,isActive:g})}),o.jsx(et,{children:"Active"})]})})]})]}),o.jsxs(Pr,{children:[o.jsx(le,{variant:"outline",onClick:p,children:"Cancel"}),o.jsxs(le,{onClick:()=>f.mutate(l),disabled:f.isPending||!l.name||!l.slug,children:[f.isPending&&o.jsx(Me,{className:"mr-2 h-4 w-4 animate-spin"}),r?"Save Changes":"Create Issue Type"]})]})]})})]})]})}
5166const kC={research:"openai/gpt-4o",writing:"openai/gpt-4o",summary:"openai/gpt-4o-mini",title:"openai/gpt-4o-mini"},fD={router:"openai/gpt-4o-mini",analysis:"openai/gpt-4o",response:"openai/gpt-4o"};function T8t(){var d,f,h,p,m,x,y,g,w,v,N;const t=Sa(),[e,n]=b.useState(""),{data:r,isLoading:i}=En({queryKey:["admin","settings"],queryFn:()=>Ce.get("/admin/settings")}),{data:s}=En({queryKey:["admin-llm-providers"],queryFn:()=>Ce.get("/admin/llm-providers")}),a=((d=s==null?void 0:s.providers)==null?void 0:d.filter(S=>S.isActive))||[];b.useEffect(()=>{var S;(S=r==null?void 0:r.announcement_banner)!=null&&S.value&&r.announcement_banner.value!==null&&String(r.announcement_banner.value)!=="null"&&n(String(r.announcement_banner.value))},[(f=r==null?void 0:r.announcement_banner)==null?void 0:f.value]);const l=un({mutationFn:async({key:S,value:_})=>{await Ce.put(`/admin/settings/${S}`,{value:_})},onSuccess:()=>{t.invalidateQueries({queryKey:["admin","settings"]})},onError:()=>{ge.error("Failed to update setting")}});if(i||!r)return o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Admin Settings",noIndex:!0}),o.jsx("div",{className:"flex h-64 items-center justify-center",children:o.jsx(Me,{className:"h-8 w-8 animate-spin text-primary"})})]});const c=((h=r.registration_enabled)==null?void 0:h.value)===!0,u=((p=r.maintenance_mode)==null?void 0:p.value)===!0;return o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:"Admin Settings",noIndex:!0}),o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-3xl font-bold",children:"Site Settings"}),o.jsx("p",{className:"text-muted-foreground",children:"Configure platform-wide settings and access controls."})]}),o.jsxs("div",{className:"grid gap-6",children:[o.jsxs(Dt,{children:[o.jsxs(Zt,{children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(UTe,{className:"h-5 w-5 text-primary"}),o.jsx(tn,{children:"User Registration"})]}),o.jsx(Kn,{children:"Control whether new users can create accounts on the platform."})]}),o.jsx(Vt,{children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(et,{htmlFor:"registration",children:"Allow new registrations"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:c?"New users can sign up for accounts":"Registration is closed - only existing users can sign in"})]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(Ge,{variant:c?"default":"secondary",children:c?"Open":"Closed"}),o.jsx(Zi,{id:"registration",checked:c,onCheckedChange:S=>{l.mutate({key:"registration_enabled",value:S})},disabled:l.isPending})]})]})})]}),o.jsxs(Dt,{children:[o.jsxs(Zt,{children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ll,{className:"h-5 w-5 text-orange-500"}),o.jsx(tn,{children:"Maintenance Mode"})]}),o.jsx(Kn,{children:"Enable maintenance mode to prevent users from accessing the platform."})]}),o.jsx(Vt,{children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(et,{htmlFor:"maintenance",children:"Enable maintenance mode"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:u?"Platform is in maintenance mode - users see a maintenance page":"Platform is operating normally"})]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(Ge,{variant:u?"destructive":"outline",children:u?"Active":"Inactive"}),o.jsx(Zi,{id:"maintenance",checked:u,onCheckedChange:S=>{l.mutate({key:"maintenance_mode",value:S})},disabled:l.isPending})]})]})})]}),o.jsxs(Dt,{children:[o.jsxs(Zt,{children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(NTe,{className:"h-5 w-5 text-blue-500"}),o.jsx(tn,{children:"Announcement Banner"})]}),o.jsx(Kn,{children:"Display a site-wide announcement banner to all users."})]}),o.jsx(Vt,{className:"space-y-4",children:o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{htmlFor:"announcement",children:"Banner text"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(gt,{id:"announcement",placeholder:"Enter announcement text (leave empty to hide banner)",value:e,onCh
5166ange:S=>n(S.target.value)}),o.jsx(le,{onClick:()=>{l.mutate({key:"announcement_banner",value:e||null},{onSuccess:()=>ge.success("Announcement saved")})},disabled:l.isPending,children:l.isPending?o.jsx(Me,{className:"h-4 w-4 animate-spin"}):"Save"})]}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Leave empty to hide the announcement banner."})]})})]}),o.jsxs(Dt,{children:[o.jsxs(Zt,{children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ga,{className:"h-5 w-5 text-purple-500"}),o.jsx(tn,{children:"Content Generation AI Models"})]}),o.jsx(Kn,{children:"Configure which AI models are used for each step of article generation."})]}),o.jsxs(Vt,{className:"space-y-6",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{children:"Research Model"}),o.jsxs(Tr,{value:String(((m=r==null?void 0:r.content_gen_research_model)==null?void 0:m.value)||kC.research),onValueChange:S=>{l.mutate({key:"content_gen_research_model",value:S},{onSuccess:()=>ge.success("Research model updated")})},disabled:l.isPending,children:[o.jsx(yr,{children:o.jsx(Vr,{placeholder:"Select model..."})}),o.jsx(vr,{children:a.map(S=>o.jsx(Ht,{value:S.modelId,children:S.displayName},S.id))})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Used for gathering research data from search results."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{children:"Writing Model"}),o.jsxs(Tr,{value:String(((x=r==null?void 0:r.content_gen_writing_model)==null?void 0:x.value)||kC.writing),onValueChange:S=>{l.mutate({key:"content_gen_writing_model",value:S},{onSuccess:()=>ge.success("Writing model updated")})},disabled:l.isPending,children:[o.jsx(yr,{children:o.jsx(Vr,{placeholder:"Select model..."})}),o.jsx(vr,{children:a.map(S=>o.jsx(Ht,{value:S.modelId,children:S.displayName},S.id))})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Used for generating the full article content. Choose a powerful model for best results."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{children:"Meta Description Model"}),o.jsxs(Tr,{value:String(((y=r==null?void 0:r.content_gen_summary_model)==null?void 0:y.value)||kC.summary),onValueChange:S=>{l.mutate({key:"content_gen_summary_model",value:S},{onSuccess:()=>ge.success("Summary model updated")})},disabled:l.isPending,children:[o.jsx(yr,{children:o.jsx(Vr,{placeholder:"Select model..."})}),o.jsx(vr,{children:a.map(S=>o.jsx(Ht,{value:S.modelId,children:S.displayName},S.id))})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Used for generating SEO meta descriptions. A smaller/faster model works well here."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{children:"Title Suggestions Model"}),o.jsxs(Tr,{value:String(((g=r==null?void 0:r.content_gen_title_model)==null?void 0:g.value)||kC.title),onValueChange:S=>{l.mutate({key:"content_gen_title_model",value:S},{onSuccess:()=>ge.success("Title model updated")})},disabled:l.isPending,children:[o.jsx(yr,{children:o.jsx(Vr,{placeholder:"Select model..."})}),o.jsx(vr,{children:a.map(S=>o.jsx(Ht,{value:S.modelId,children:S.displayName},S.id))})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Used for suggesting article titles based on topics."})]}),o.jsx("div",{className:"pt-2 border-t",children:o.jsx("p",{className:"text-sm text-muted-foreground",children:"Note: Changes take effect immediately for new content generation jobs."})})]})]}),o.jsxs(Dt,{children:[o.jsxs(Zt,{children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ga,{className:"h-5 w-5 text-indigo-500"}),o.jsx(tn,{children:"Agent Chat AI Models"})]}),o.jsx(Kn,{children:"Configure which AI models are used for each step of the agent chat pipeline."})]}),o.jsxs(Vt,{className:"space-y-6",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{children:"Router Model"}),o.jsxs(Tr,{value:String(((w=r==null?void 0:r.agent_router_model)==null?void 0:w.value)||fD.router),onValueChange:S=>{l.mutate({key:"agent_router_model",value:S},{onSuccess:()=>ge.success("Agent router model updated")})},disabled:l.isPending,children:[o.jsx(yr,{children:o.jsx(Vr,{placeholder:"Select model..."})}),o.jsx(vr,{children:a.map(S=>o.jsx(Ht,{value:S.modelId,children:S.displayName},S.id))})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Used to determine user intent and select relevant data tools. A fast, cheaper model works well here."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{children:"Analysis Model"}),o.jsxs(Tr,{value:String(((v=r==null?void 0:r.agent_analysis_model)==null?void 0:v.value)||fD.analysis),onValueChange:S=>{l.mutate({key:"agent_analysis_model",value:S},{onSuccess:()=>ge.success("Agent analysis model updated")})},disabled:l.isPending,children:[o.jsx(yr,{children:o.jsx(Vr,{placeholder:"Select model..."})}),o.jsx(vr,{children:a.map(S=>o.jsx(Ht,{value:S.modelId,children:S.displayName},S.id))})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Used to analyze fetched data and extract insights. Choose a capable model for accurate analysis."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(et,{children:"Response Model"}),o.jsxs(Tr,{value:String(((N=r==null?void 0:r.agent_response_model)==null?void 0:N.value)||fD.response),onValueChange:S=>{l.mutate({key:"agent_response_model",value:S},{onSuccess:()=>ge.success("Agent response model updated")})},disabled:l.isPending,children:[o.jsx(yr,{children:o.jsx(Vr,{placeholder:"Select model..."})}),o.jsx(vr,{children:a.map(S=>o.jsx(Ht,{value:S.modelId,children:S.displayName},S.id))})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Used to generate the final streamed response to the user. This model's output is shown directly in the chat."})]}),o.jsx("div",{className:"pt-2 border-t",children:o.jsx("p",{className:"text-sm text-muted-foreground",children:"Note: Changes take effect immediately for new agent chat messages."})})]})]})]})]})]})}function M8t({children:t}){const{user:e,profile:n,isInitialized:r}=Rr(),{companies:i,hasFetched:s,fetchCompanies:a}=Ri(),l=Ya();if(b.useEffect(()=>{e&&!s&&a()},[e,s,a]),!r)return o.jsx("div",{className:"flex h-screen items-center justify-center bg-background",children:o.jsxs("div",{className:"flex flex-col items-center gap-4",children:[o.jsx(Me,{className:"h-8 w-8 animate-spin text-primary"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading..."})]})});if(!e)return o.jsx(Ju,{to:"/login",state:{from:l},replace:!0});if(!s)return o.jsx("div",{className:"flex h-screen items-center justify-center bg-background",children:o.jsxs("div",{className:"flex flex-col items-center gap-4",children:[o.jsx(Me,{className:"h-8 w-8 animate-spin text-primary"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading..."})]})});const c=l.pathname==="/onboarding",u=l.pathname.startsWith("/admin"),d=l.pathname.startsWith("/settings");return(!(n!=null&&n.onboardingCompletedAt)||i.length===0)&&!c&&!u&&!d?o.jsx(Ju,{to:"/onboarding",replace:!0}):o.jsx(o.Fragment,{children:t})}function P8t(){var l;const{token:t}=Gr(),{data:e,isLoading:n,error:r}=En({queryKey:["shared-article",t],queryFn:async()=>{const c=await fetch(`/api/v1/public/articles/${t}`);if(!c.ok)throw new Error("Article not found");return(await c.json()).data},enabled:!!t});if(n)return o.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:o.jsx(Me,{className:"h-8 w-8 animate-spin text-muted-foreground"})});if(r||!e)return o.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center bg-background",children:[o.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Article Not Found"}),o.jsx("p",{className:"text-muted-foreground mb-4",children:"This article may have been removed or is no longer public."}),o.jsx(le,{variant:"outline",asChild:!0,children:o.jsxs(Mt,{to:"/",children:[o.jsx(Ii,{className:"h-4 w-4 mr-2"}),"Go Home"]})})]});
5166const{article:i,company:s}=e,a=i.publishedAt?new Date(i.publishedAt).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}):new Date(i.createdAt).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"});return o.jsxs(o.Fragment,{children:[o.jsx(ot,{title:i.metaTitle||i.title,description:i.metaDescription||void 0}),i.schemaJson&&o.jsx("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(i.schemaJson)}}),o.jsxs("div",{className:"min-h-screen bg-background",children:[o.jsx("header",{className:"border-b bg-card",children:o.jsxs("div",{className:"max-w-4xl mx-auto px-4 py-4 flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[s.logoUrl&&o.jsx("img",{src:s.logoUrl,alt:s.brandName,className:"h-8 w-auto"}),o.jsx("span",{className:"font-semibold",children:s.brandName})]}),s.website&&o.jsx(le,{variant:"outline",size:"sm",asChild:!0,children:o.jsxs("a",{href:s.website,target:"_blank",rel:"noopener noreferrer",children:["Visit Website",o.jsx(Wr,{className:"h-3.5 w-3.5 ml-1"})]})})]})}),o.jsxs("article",{className:"max-w-4xl mx-auto px-4 py-12",children:[o.jsx("h1",{className:"text-4xl md:text-5xl font-bold mb-6 leading-tight",children:i.title}),o.jsxs("div",{className:"flex items-center gap-4 mb-8 text-muted-foreground",children:[i.author&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(RS,{className:"h-6 w-6",children:[o.jsx(IS,{src:i.author.avatarUrl||void 0}),o.jsx(DS,{className:"text-xs",children:((l=i.author.fullName)==null?void 0:l.charAt(0))||"A"})]}),o.jsx("span",{className:"text-sm",children:i.author.fullName})]}),o.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[o.jsx(vT,{className:"h-4 w-4"}),a]}),o.jsxs("span",{className:"text-sm",children:[i.actualWordCount," words"]})]}),o.jsx("div",{className:"tiptap ProseMirror",dangerouslySetInnerHTML:{__html:i.content||""}}),i.faqs&&i.faqs.length>0&&o.jsxs("section",{className:"mt-12 pt-8 border-t",children:[o.jsx("h2",{className:"text-2xl font-bold mb-6",children:"Frequently Asked Questions"}),o.jsx("div",{className:"space-y-6",children:i.faqs.map(c=>o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-2",children:c.question}),o.jsx("p",{className:"text-muted-foreground",children:c.answer})]},c.id))})]}),i.citations&&i.citations.length>0&&o.jsxs("section",{className:"mt-12 pt-8 border-t",children:[o.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Sources & References"}),o.jsx("ul",{className:"space-y-2",children:i.citations.map(c=>o.jsxs("li",{className:"text-sm",children:[o.jsx("a",{href:c.url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:c.title}),o.jsxs("span",{className:"text-muted-foreground ml-2",children:["(",c.source,")"]})]},c.id))})]})]}),o.jsx("footer",{className:"border-t bg-card mt-12",children:o.jsx("div",{className:"max-w-4xl mx-auto px-4 py-6 text-center text-sm text-muted-foreground",children:o.jsxs("p",{children:["Published by ",s.brandName]})})})]})]})}function O8t(){const{initialize:t,isInitialized:e}=Rr(),{connect:n,disconnect:r}=yse(),i=Rr(s=>s.session);return b.useEffect(()=>{t()},[t]),b.useEffect(()=>(i!=null&&i.access_token&&n(i.access_token),()=>{r()}),[i==null?void 0:i.access_token,n,r]),e?o.jsxs(o.Fragment,{children:[o.jsxs(bje,{children:[o.jsxs(kt,{element:o.jsx(abt,{}),children:[o.jsx(kt,{path:"/",element:o.jsx(jbt,{})}),o.jsx(kt,{path:"/pricing",element:o.jsx(Cbt,{})}),o.jsx(kt,{path:"/features",element:o.jsx(kbt,{})}),o.jsx(kt,{path:"/models",element:o.jsx(Ebt,{})}),o.jsx(kt,{path:"/integrations",element:o.jsx(Abt,{})}),o.jsx(kt,{path:"/about",element:o.jsx(Tbt,{})}),o.jsx(kt,{path:"/terms",element:o.jsx(Mbt,{})}),o.jsx(kt,{path:"/privacy",element:o.jsx(Pbt,{})}),o.jsx(kt,{path:"/cookies",element:o.jsx(Obt,{})}),o.jsx(kt,{path:"/ai-disclaimer",element:o.jsx(Rbt,{})})]}),o.jsxs(kt,{element:o.jsx(Rft,{}),children:[o.jsx(kt,{path:"/login",element:o.jsx(CQ,{})}),o.jsx(kt,{path:"/sign-in",element:o.jsx(CQ,{})}
5166),o.jsx(kt,{path:"/signup",element:o.jsx(kQ,{})}),o.jsx(kt,{path:"/sign-up",element:o.jsx(kQ,{})}),o.jsx(kt,{path:"/forgot-password",element:o.jsx($wt,{})})]}),o.jsx(kt,{path:"/shared/article/:token",element:o.jsx(P8t,{})}),o.jsxs(kt,{element:o.jsx(M8t,{children:o.jsx(Oft,{})}),children:[o.jsx(kt,{path:"/onboarding",element:o.jsx(zwt,{})}),o.jsx(kt,{path:"/dashboard",element:o.jsx(Fwt,{})}),o.jsxs(kt,{path:"/company/:companyId",children:[o.jsx(kt,{index:!0,element:o.jsx(S1t,{})}),o.jsx(kt,{path:"prompts",element:o.jsx(j1t,{})}),o.jsx(kt,{path:"prompts/:queryId",element:o.jsx(VTt,{})}),o.jsx(kt,{path:"prompts/:queryId/studio",element:o.jsx(GTt,{})}),o.jsx(kt,{path:"competitors",element:o.jsx(qTt,{})}),o.jsx(kt,{path:"competitors/hidden",element:o.jsx(KTt,{})}),o.jsx(kt,{path:"competitors/:competitorId",element:o.jsx(YTt,{})}),o.jsx(kt,{path:"sources/:sourceUrl",element:o.jsx(wDt,{})}),o.jsx(kt,{path:"opportunities",element:o.jsx(eLt,{})}),o.jsx(kt,{path:"content",element:o.jsx(v8t,{})}),o.jsx(kt,{path:"content/create",element:o.jsx(m$t,{})}),o.jsx(kt,{path:"content/:articleId",element:o.jsx(g8t,{})}),o.jsx(kt,{path:"site-health",element:o.jsx(i$t,{})}),o.jsx(kt,{path:"site-health/page/:pageId",element:o.jsx(c$t,{})}),o.jsx(kt,{path:"issues",element:o.jsx(a$t,{})}),o.jsx(kt,{path:"research",element:o.jsx(hLt,{})}),o.jsx(kt,{path:"research/:topicId",element:o.jsx(qLt,{})}),o.jsx(kt,{path:"analytics/visibility",element:o.jsx(YLt,{})}),o.jsx(kt,{path:"analytics/mentions",element:o.jsx(JLt,{})}),o.jsx(kt,{path:"analytics/sources",element:o.jsx(t$t,{})}),o.jsx(kt,{path:"analytics/traffic",element:o.jsx(n$t,{})}),o.jsx(kt,{path:"agent",element:o.jsx(b8t,{})}),o.jsx(kt,{path:"team",element:o.jsx(_Dt,{})}),o.jsx(kt,{path:"settings",element:o.jsx(SDt,{})})]}),o.jsxs(kt,{path:"/settings",children:[o.jsx(kt,{path:"profile",element:o.jsx(Ju,{to:"/dashboard?settings=profile",replace:!0})}),o.jsx(kt,{path:"notifications",element:o.jsx(Ju,{to:"/dashboard?settings=notifications",replace:!0})}),o.jsx(kt,{path:"billing",element:o.jsx(Ju,{to:"/dashboard?settings=billing",replace:!0})})]})]}),o.jsxs(kt,{element:o.jsx(Hpt,{}),children:[o.jsx(kt,{path:"/admin",element:o.jsx(w8t,{})}),o.jsx(kt,{path:"/admin/packages",element:o.jsx(_8t,{})}),o.jsx(kt,{path:"/admin/features",element:o.jsx(j8t,{})}),o.jsx(kt,{path:"/admin/llm-providers",element:o.jsx(C8t,{})}),o.jsx(kt,{path:"/admin/issue-types",element:o.jsx(A8t,{})}),o.jsx(kt,{path:"/admin/settings",element:o.jsx(T8t,{})})]}),o.jsx(kt,{path:"*",element:o.jsx(Ju,{to:"/",replace:!0})})]}),o.jsx(iCe,{theme:"dark",position:"bottom-right",toastOptions:{style:{background:"var(--color-card)",border:"1px solid var(--color-border)",color:"var(--color-foreground)"}}})]}):o.jsx("div",{className:"flex h-screen items-center justify-center bg-background",children:o.jsxs("div",{className:"flex flex-col items-center gap-4",children:[o.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-primary border-t-transparent"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading..."})]})})}hD.createRoot(document.getElementById("root")).render(o.jsx(te.StrictMode,{children:o.jsx(mNe,{client:H4,children:o.jsx(Eje,{future:{v7_startTransition:!0,v7_relativeSplatPath:!0},children:o.jsx(O8t,{})})})}));

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.